Visual C++ Projects: Add rules to generate GTK DBus sources

Since commit 7c2a5072 the gtkdbusgenerated.[c|h] are not included in the
dist tarball and thus have to be generated, which broke the Visual C++
builds.

This patch adds property sheets and custom build rules for the Visual C++
projects so that gtkdbusgenerated.[c|h] will be generated upon building the
GTK+ DLL sources.

This also tells people building GTK+ from the projects that they need to
have Python 2/3 installed and the Python interpretor needs to be in their
PATH before building GTK+ from the projects.
This commit is contained in:
Chun-wei Fan 2013-11-27 18:05:32 +08:00
parent fd134d8457
commit c13c741143
11 changed files with 111 additions and 14 deletions

View File

@ -37,6 +37,7 @@ EXTRA_DIST += \
gtk-version-paths.props \ gtk-version-paths.props \
gtkprebuild-broadway.props \ gtkprebuild-broadway.props \
gtkprebuild.props \ gtkprebuild.props \
gtk-copy-gdk-broadway.props gtk-copy-gdk-broadway.props \
gtk-gen-sources.props
-include $(top_srcdir)/git.mk -include $(top_srcdir)/git.mk

View File

@ -20,6 +20,11 @@ ATK and GLib. External dependencies are at least Cairo
gettext-runtime, fontconfig*, freetype*, expat*. See the gettext-runtime, fontconfig*, freetype*, expat*. See the
build/win32/vs10/README.txt file in glib for details where to unpack them. build/win32/vs10/README.txt file in glib for details where to unpack them.
You will also need a Python 2.x/3.x interpretor installed on your system,
which can be obtained from the official installers available from
http://www.python.org. Please note that the Python interpretor (python.exe)
needs to be in your path before attempting the build of GTK+.
It is recommended that one builds the dependencies with VS10 as far as It is recommended that one builds the dependencies with VS10 as far as
possible, especially those from and using the GTK+ stack (i.e. GLib, possible, especially those from and using the GTK+ stack (i.e. GLib,
Cairo, ATK, Pango, GDK-Pixbuf), so that crashes caused by mixing calls Cairo, ATK, Pango, GDK-Pixbuf), so that crashes caused by mixing calls

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
<Import Project="gtk-build-defines.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros">
<GenerateGtkDbusBuiltSources>
cd ..\..\..\gtk
python $(GlibEtcInstallRoot)\bin\gdbus-codegen --interface-prefix org.Gtk. --c-namespace _Gtk --generate-c-code gtkdbusgenerated ./gtkdbusinterfaces.xml
cd $(SolutionDir)
</GenerateGtkDbusBuiltSources>
</PropertyGroup>
<ItemGroup>
<BuildMacro Include="GenerateGtkDbusBuiltSources">
<Value>$(GenerateGtkDbusBuiltSources)</Value>
</BuildMacro>
</ItemGroup>
</Project>

View File

@ -2,9 +2,9 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="UserMacros"> <PropertyGroup Label="UserMacros">
<VSVer>10</VSVer> <VSVer>10</VSVer>
<GlibEtcInstallRoot>..\..\..\..\vs$(VSVer)\$(Platform)</GlibEtcInstallRoot> <GlibEtcInstallRoot>$(SolutionDir)\..\..\..\..\vs$(VSVer)\$(Platform)</GlibEtcInstallRoot>
<GlibEtcInstallRootFromBuildWin32>..\..\..\vs$(VSVer)\$(Platform)</GlibEtcInstallRootFromBuildWin32> <GlibEtcInstallRootFromBuildWin32>..\..\..\vs$(VSVer)\$(Platform)</GlibEtcInstallRootFromBuildWin32>
<CopyDir>$(GlibEtcInstallRoot)</CopyDir> <CopyDir>..\..\..\..\vs$(VSVer)\$(Platform)</CopyDir>
<ApiVersion>3.0</ApiVersion> <ApiVersion>3.0</ApiVersion>
<GtkLibtoolCompatibleDllPrefix>lib</GtkLibtoolCompatibleDllPrefix> <GtkLibtoolCompatibleDllPrefix>lib</GtkLibtoolCompatibleDllPrefix>
<GtkLibtoolCompatibleDllSuffix>-$(ApiVersion)-0</GtkLibtoolCompatibleDllSuffix> <GtkLibtoolCompatibleDllSuffix>-$(ApiVersion)-0</GtkLibtoolCompatibleDllSuffix>

View File

@ -17,6 +17,9 @@
<ItemGroup> <ItemGroup>
<ResourceCompile Include="..\..\..\gtk\gtk-win32.rc"><Filter>Resource Files</Filter></ResourceCompile> <ResourceCompile Include="..\..\..\gtk\gtk-win32.rc"><Filter>Resource Files</Filter></ResourceCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\..\gtk\gtkdbusinterfaces.xml"><Filter>Resource Files</Filter></CustomBuild>
</ItemGroup>
<ItemGroup> <ItemGroup>
#include "libgtk.vs10.sourcefiles.filters" #include "libgtk.vs10.sourcefiles.filters"
<ClCompile Include="..\..\..\modules\input\gtkimcontextime.c"><Filter>Source Files</Filter></ClCompile> <ClCompile Include="..\..\..\modules\input\gtkimcontextime.c"><Filter>Source Files</Filter></ClCompile>

View File

@ -51,19 +51,19 @@
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="gtk-build-defines.props" /> <Import Project="gtk-gen-sources.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="gtk-build-defines.props" /> <Import Project="gtk-gen-sources.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="gtk-build-defines.props" /> <Import Project="gtk-gen-sources.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="gtk-build-defines.props" /> <Import Project="gtk-gen-sources.props" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup> <PropertyGroup>
@ -158,6 +158,22 @@
<TargetMachine>MachineX64</TargetMachine> <TargetMachine>MachineX64</TargetMachine>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup>
<CustomBuild Include="..\..\..\gtk\gtkdbusinterfaces.xml">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating GTK+ DBus Sources...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GenerateGtkDbusBuiltSources)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generating GTK+ DBus Sources...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GenerateGtkDbusBuiltSources)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generating GTK+ DBus Sources...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GenerateGtkDbusBuiltSources)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generating GTK+ DBus Sources...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GenerateGtkDbusBuiltSources)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="..\..\..\gtk\gtk-win32.rc" /> <ResourceCompile Include="..\..\..\gtk\gtk-win32.rc" />
</ItemGroup> </ItemGroup>

View File

@ -25,6 +25,7 @@ EXTRA_DIST += \
gtk-version-paths.vsprops \ gtk-version-paths.vsprops \
gtkprebuild.vsprops \ gtkprebuild.vsprops \
gtkprebuild-broadway.vsprops \ gtkprebuild-broadway.vsprops \
gtk-copy-gdk-broadway.vsprops gtk-copy-gdk-broadway.vsprops \
gtk-gen-sources.vsprops
-include $(top_srcdir)/git.mk -include $(top_srcdir)/git.mk

View File

@ -19,6 +19,11 @@ ATK and GLib. External dependencies are at least Cairo
gettext-runtime, fontconfig*, freetype*, expat*. See the gettext-runtime, fontconfig*, freetype*, expat*. See the
build/win32/vs9/README.txt file in glib for details where to unpack them. build/win32/vs9/README.txt file in glib for details where to unpack them.
You will also need a Python 2.x/3.x interpretor installed on your system,
which can be obtained from the official installers available from
http://www.python.org. Please note that the Python interpretor (python.exe)
needs to be in your path before attempting the build of GTK+.
It is recommended that one builds the dependencies with VS9 as far as It is recommended that one builds the dependencies with VS9 as far as
possible, especially those from and using the GTK+ stack (i.e. GLib, possible, especially those from and using the GTK+ stack (i.e. GLib,
Cairo, ATK, Pango, GDK-Pixbuf), so that crashes caused by mixing calls Cairo, ATK, Pango, GDK-Pixbuf), so that crashes caused by mixing calls

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioPropertySheet
ProjectType="Visual C++"
Version="8.00"
Name="gtkgensourcesprops"
InheritedPropertySheets=".\gtk-build-defines.vsprops"
>
<UserMacro
Name="GenerateGtkDbusBuiltSources"
Value="
cd ..\..\..\gtk&#x0D;&#x0A;
python $(GlibEtcInstallRoot)\bin\gdbus-codegen --interface-prefix org.Gtk. --c-namespace _Gtk --generate-c-code gtkdbusgenerated ./gtkdbusinterfaces.xml&#x0D;&#x0A;
cd $(SolutionDir)&#x0D;&#x0A;
"
/>
</VisualStudioPropertySheet>

View File

@ -10,7 +10,7 @@
/> />
<UserMacro <UserMacro
Name="GlibEtcInstallRoot" Name="GlibEtcInstallRoot"
Value="..\..\..\..\vs$(VSVer)\$(PlatformName)" Value="$(SolutionDir)\..\..\..\..\vs$(VSVer)\$(PlatformName)"
/> />
<UserMacro <UserMacro
Name="GlibEtcInstallRootFromBuildWin32" Name="GlibEtcInstallRootFromBuildWin32"
@ -18,7 +18,7 @@
/> />
<UserMacro <UserMacro
Name="CopyDir" Name="CopyDir"
Value="$(GlibEtcInstallRoot)" Value="..\..\..\..\vs$(VSVer)\$(PlatformName)"
/> />
<UserMacro <UserMacro
Name="ApiVersion" Name="ApiVersion"

View File

@ -21,7 +21,7 @@
<Configurations> <Configurations>
<Configuration <Configuration
Name="Debug|Win32" Name="Debug|Win32"
InheritedPropertySheets=".\gtk-build-defines.vsprops" InheritedPropertySheets=".\gtk-gen-sources.vsprops"
ConfigurationType="2" ConfigurationType="2"
CharacterSet="2" CharacterSet="2"
> >
@ -53,7 +53,7 @@
</Configuration> </Configuration>
<Configuration <Configuration
Name="Release|Win32" Name="Release|Win32"
InheritedPropertySheets=".\gtk-build-defines.vsprops" InheritedPropertySheets=".\gtk-gen-sources.vsprops"
ConfigurationType="2" ConfigurationType="2"
CharacterSet="2" CharacterSet="2"
WholeProgramOptimization="1" WholeProgramOptimization="1"
@ -85,7 +85,7 @@
</Configuration> </Configuration>
<Configuration <Configuration
Name="Debug|x64" Name="Debug|x64"
InheritedPropertySheets=".\gtk-build-defines.vsprops" InheritedPropertySheets=".\gtk-gen-sources.vsprops"
ConfigurationType="2" ConfigurationType="2"
CharacterSet="2" CharacterSet="2"
> >
@ -117,7 +117,7 @@
</Configuration> </Configuration>
<Configuration <Configuration
Name="Release|x64" Name="Release|x64"
InheritedPropertySheets=".\gtk-build-defines.vsprops" InheritedPropertySheets=".\gtk-gen-sources.vsprops"
ConfigurationType="2" ConfigurationType="2"
CharacterSet="2" CharacterSet="2"
WholeProgramOptimization="1" WholeProgramOptimization="1"
@ -162,6 +162,36 @@
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
> >
<File RelativePath="..\..\..\gtk\gtkdbusinterfaces.xml">
<FileConfiguration Name="Debug|Win32">
<Tool Name="VCCustomBuildTool"
Description="Generating GTK+ DBus Sources..."
CommandLine="$(GenerateGtkDbusBuiltSources)"
Outputs="..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h"
/>
</FileConfiguration>
<FileConfiguration Name="Release|Win32">
<Tool Name="VCCustomBuildTool"
Description="Generating GTK+ DBus Sources..."
CommandLine="$(GenerateGtkDbusBuiltSources)"
Outputs="..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h"
/>
</FileConfiguration>
<FileConfiguration Name="Debug|x64">
<Tool Name="VCCustomBuildTool"
Description="Generating GTK+ DBus Sources..."
CommandLine="$(GenerateGtkDbusBuiltSources)"
Outputs="..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h"
/>
</FileConfiguration>
<FileConfiguration Name="Release|x64">
<Tool Name="VCCustomBuildTool"
Description="Generating GTK+ DBus Sources..."
CommandLine="$(GenerateGtkDbusBuiltSources)"
Outputs="..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h"
/>
</FileConfiguration>
</File>
<File RelativePath="..\..\..\gtk\gtk-win32.rc" /> <File RelativePath="..\..\..\gtk\gtk-win32.rc" />
</Filter> </Filter>
<Filter <Filter