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 \
gtkprebuild-broadway.props \
gtkprebuild.props \
gtk-copy-gdk-broadway.props
gtk-copy-gdk-broadway.props \
gtk-gen-sources.props
-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
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
possible, especially those from and using the GTK+ stack (i.e. GLib,
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">
<PropertyGroup Label="UserMacros">
<VSVer>10</VSVer>
<GlibEtcInstallRoot>..\..\..\..\vs$(VSVer)\$(Platform)</GlibEtcInstallRoot>
<GlibEtcInstallRoot>$(SolutionDir)\..\..\..\..\vs$(VSVer)\$(Platform)</GlibEtcInstallRoot>
<GlibEtcInstallRootFromBuildWin32>..\..\..\vs$(VSVer)\$(Platform)</GlibEtcInstallRootFromBuildWin32>
<CopyDir>$(GlibEtcInstallRoot)</CopyDir>
<CopyDir>..\..\..\..\vs$(VSVer)\$(Platform)</CopyDir>
<ApiVersion>3.0</ApiVersion>
<GtkLibtoolCompatibleDllPrefix>lib</GtkLibtoolCompatibleDllPrefix>
<GtkLibtoolCompatibleDllSuffix>-$(ApiVersion)-0</GtkLibtoolCompatibleDllSuffix>

View File

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

View File

@ -51,19 +51,19 @@
</ImportGroup>
<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="gtk-build-defines.props" />
<Import Project="gtk-gen-sources.props" />
</ImportGroup>
<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="gtk-build-defines.props" />
<Import Project="gtk-gen-sources.props" />
</ImportGroup>
<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="gtk-build-defines.props" />
<Import Project="gtk-gen-sources.props" />
</ImportGroup>
<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="gtk-build-defines.props" />
<Import Project="gtk-gen-sources.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
@ -158,6 +158,22 @@
<TargetMachine>MachineX64</TargetMachine>
</Link>
</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>
<ResourceCompile Include="..\..\..\gtk\gtk-win32.rc" />
</ItemGroup>

View File

@ -25,6 +25,7 @@ EXTRA_DIST += \
gtk-version-paths.vsprops \
gtkprebuild.vsprops \
gtkprebuild-broadway.vsprops \
gtk-copy-gdk-broadway.vsprops
gtk-copy-gdk-broadway.vsprops \
gtk-gen-sources.vsprops
-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
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
possible, especially those from and using the GTK+ stack (i.e. GLib,
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
Name="GlibEtcInstallRoot"
Value="..\..\..\..\vs$(VSVer)\$(PlatformName)"
Value="$(SolutionDir)\..\..\..\..\vs$(VSVer)\$(PlatformName)"
/>
<UserMacro
Name="GlibEtcInstallRootFromBuildWin32"
@ -18,7 +18,7 @@
/>
<UserMacro
Name="CopyDir"
Value="$(GlibEtcInstallRoot)"
Value="..\..\..\..\vs$(VSVer)\$(PlatformName)"
/>
<UserMacro
Name="ApiVersion"

View File

@ -21,7 +21,7 @@
<Configurations>
<Configuration
Name="Debug|Win32"
InheritedPropertySheets=".\gtk-build-defines.vsprops"
InheritedPropertySheets=".\gtk-gen-sources.vsprops"
ConfigurationType="2"
CharacterSet="2"
>
@ -53,7 +53,7 @@
</Configuration>
<Configuration
Name="Release|Win32"
InheritedPropertySheets=".\gtk-build-defines.vsprops"
InheritedPropertySheets=".\gtk-gen-sources.vsprops"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
@ -85,7 +85,7 @@
</Configuration>
<Configuration
Name="Debug|x64"
InheritedPropertySheets=".\gtk-build-defines.vsprops"
InheritedPropertySheets=".\gtk-gen-sources.vsprops"
ConfigurationType="2"
CharacterSet="2"
>
@ -117,7 +117,7 @@
</Configuration>
<Configuration
Name="Release|x64"
InheritedPropertySheets=".\gtk-build-defines.vsprops"
InheritedPropertySheets=".\gtk-gen-sources.vsprops"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
@ -162,6 +162,36 @@
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
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" />
</Filter>
<Filter