[gtk+] MSVC builds: Allow different Python versions per toolset



commit 1eb8d2ad09412ac397c6039c56354f72f4996bad
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Jul 31 17:25:56 2017 +0800

    MSVC builds: Allow different Python versions per toolset
    
    Use conditionals to select the Python installation, so that we can stick
    closer to the default Visual Studio versions used to compile each official
    Python releases.
    
    This means by default:
    -2013 builds use Python 3.4.x, which is built with 2010
    -2015 and 2017 builds use Python 3.6.x, which is built with 2015.
    
    Also rename PythonPath/PythonPathX64 in the property sheets to
    PythonDir/PythonDirX64 repsectively, as PythonPath is the envvar name
    where additional Python modules is searched for, so we don't want to get
    confused with it.
    
    Last but not least, distinguish between the Python interpretors that are
    used on x64 and x86/32-bit builds for generating the libgtk4.manifest
    file and the gdbus-generated sources, for consistency reasons.

 win32/vs12/gtk-4.vcxprojin             |   51 +++++++++----------------------
 win32/vs12/gtk4-gen-srcs.props         |   10 ++++--
 win32/vs12/gtk4-install.propsin        |    4 +-
 win32/vs12/gtk4-version-paths.props.in |   14 +++++----
 4 files changed, 32 insertions(+), 47 deletions(-)
---
diff --git a/win32/vs12/gtk-4.vcxprojin b/win32/vs12/gtk-4.vcxprojin
index 1561e15..3b8f402 100644
--- a/win32/vs12/gtk-4.vcxprojin
+++ b/win32/vs12/gtk-4.vcxprojin
@@ -316,46 +316,25 @@
   </ItemDefinitionGroup>
   <ItemGroup>
     <CustomBuild Include="..\..\gtk\gtkdbusinterfaces.xml">
-      <Message Condition="'$(Configuration)'=='Debug'">Generating GTK+ DBus Sources...</Message>
-      <Command Condition="'$(Configuration)'=='Debug'">$(GenerateGtkDbusBuiltSources)</Command>
-      <Outputs 
Condition="'$(Configuration)'=='Debug'">..\..\gtk\gtkdbusgenerated.c;..\..\gtk\gtkdbusgenerated.h;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Release'">Generating GTK+ DBus Sources...</Message>
-      <Command Condition="'$(Configuration)'=='Release'">$(GenerateGtkDbusBuiltSources)</Command>
-      <Outputs 
Condition="'$(Configuration)'=='Release'">..\..\gtk\gtkdbusgenerated.c;..\..\gtk\gtkdbusgenerated.h;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Debug_Vulkan'">Generating GTK+ DBus Sources...</Message>
-      <Command Condition="'$(Configuration)'=='Debug_Vulkan'">$(GenerateGtkDbusBuiltSources)</Command>
-      <Outputs 
Condition="'$(Configuration)'=='Debug_Vulkan'">..\..\gtk\gtkdbusgenerated.c;..\..\gtk\gtkdbusgenerated.h;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Release_Vulkan'">Generating GTK+ DBus Sources...</Message>
-      <Command Condition="'$(Configuration)'=='Release_Vulkan'">$(GenerateGtkDbusBuiltSources)</Command>
-      <Outputs 
Condition="'$(Configuration)'=='Release_Vulkan'">..\..\gtk\gtkdbusgenerated.c;..\..\gtk\gtkdbusgenerated.h;%(Outputs)</Outputs>
+      <Message Condition="'$(Platform)'=='Win32'">Generating GTK+ DBus Sources...</Message>
+      <Command Condition="'$(Platform)'=='Win32'">$(GenerateGtkDbusBuiltSources)</Command>
+      <Outputs 
Condition="'$(Platform)'=='Win32'">..\..\gtk\gtkdbusgenerated.c;..\..\gtk\gtkdbusgenerated.h;%(Outputs)</Outputs>
+      <Message Condition="'$(Platform)'=='x64'">Generating GTK+ DBus Sources...</Message>
+      <Command Condition="'$(Platform)'=='x64'">$(GenerateGtkDbusBuiltSourcesX64)</Command>
+      <Outputs 
Condition="'$(Platform)'=='x64'">..\..\gtk\gtkdbusgenerated.c;..\..\gtk\gtkdbusgenerated.h;%(Outputs)</Outputs>
     </CustomBuild>
     <CustomBuild Include="..\..\gtk\gtk-win32.rc.body">
-      <Message Condition="'$(Configuration)'=='Debug'">Copying GTK+ Win32 Version Resource...</Message>
-      <Command Condition="'$(Configuration)'=='Debug'">$(CopyGtkWin32RC)</Command>
-      <Outputs Condition="'$(Configuration)'=='Debug'">..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Release'">Copying GTK+ Win32 Version Resource...</Message>
-      <Command Condition="'$(Configuration)'=='Release'">$(CopyGtkWin32RC)</Command>
-      <Outputs Condition="'$(Configuration)'=='Release'">..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Debug_Vulkan'">Copying GTK+ Win32 Version 
Resource...</Message>
-      <Command Condition="'$(Configuration)'=='Debug_Vulkan'">$(CopyGtkWin32RC)</Command>
-      <Outputs Condition="'$(Configuration)'=='Debug_Vulkan'">..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Release_Vulkan'">Copying GTK+ Win32 Version 
Resource...</Message>
-      <Command Condition="'$(Configuration)'=='Release_Vulkan'">$(CopyGtkWin32RC)</Command>
-      <Outputs Condition="'$(Configuration)'=='Release_Vulkan'">..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
+      <Message>Copying GTK+ Win32 Version Resource...</Message>
+      <Command>$(CopyGtkWin32RC)</Command>
+      <Outputs>..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
     </CustomBuild>
     <CustomBuild Include="..\..\gtk\libgtk4.manifest.in">
-      <Message Condition="'$(Configuration)'=='Debug'">Generating GTK+ Win32 Manifest...</Message>
-      <Command Condition="'$(Configuration)'=='Debug'">$(GenerateGtkWin32Manifest)</Command>
-      <Outputs Condition="'$(Configuration)'=='Debug'">..\..\gtk\libgtk4.manifest;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Release'">Generating GTK+ Win32 Manifest...</Message>
-      <Command Condition="'$(Configuration)'=='Release'">$(GenerateGtkWin32Manifest)</Command>
-      <Outputs Condition="'$(Configuration)'=='Release'">..\..\gtk\libgtk4.manifest;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Debug_Vulkan'">Generating GTK+ Win32 Manifest...</Message>
-      <Command Condition="'$(Configuration)'=='Debug_Vulkan'">$(GenerateGtkWin32Manifest)</Command>
-      <Outputs Condition="'$(Configuration)'=='Debug_Vulkan'">..\..\gtk\libgtk4.manifest;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Release_Vulkan'">Generating GTK+ Win32 Manifest...</Message>
-      <Command Condition="'$(Configuration)'=='Release_Vulkan'">$(GenerateGtkWin32Manifest)</Command>
-      <Outputs 
Condition="'$(Configuration)'=='Release_Vulkan'">..\..\gtk\libgtk4.manifest;%(Outputs)</Outputs>
+      <Message Condition="'$(Platform)'=='Win32'">Generating GTK+ Win32 Manifest...</Message>
+      <Command Condition="'$(Platform)'=='Win32'">$(GenerateGtkWin32Manifest)</Command>
+      <Outputs Condition="'$(Platform)'=='Win32'">..\..\gtk\libgtk4.manifest;%(Outputs)</Outputs>
+      <Message Condition="'$(Platform)'=='x64'">Generating GTK+ Win32 Manifest...</Message>
+      <Command Condition="'$(Platform)'=='x64'">$(GenerateGtkWin32ManifestX64)</Command>
+      <Outputs Condition="'$(Platform)'=='x64'">..\..\gtk\libgtk4.manifest;%(Outputs)</Outputs>
     </CustomBuild>
   </ItemGroup>
   <ItemGroup>
diff --git a/win32/vs12/gtk4-gen-srcs.props b/win32/vs12/gtk4-gen-srcs.props
index a085324..c611d74 100644
--- a/win32/vs12/gtk4-gen-srcs.props
+++ b/win32/vs12/gtk4-gen-srcs.props
@@ -39,10 +39,11 @@ echo $(Configuration) &gt; ..\..\MSVC_$(Configuration)_Vulkan
 :DONE_GDKCONFIG_H
     </GenGdkConfigHVulkan>
     <GDbusCodeGenCmd>$(GlibEtcInstallRoot)\bin\gdbus-codegen --interface-prefix org.Gtk. --c-namespace _Gtk 
--generate-c-code gtkdbusgenerated ./gtkdbusinterfaces.xml</GDbusCodeGenCmd>
-    <GenerateGtkDbusBuiltSources>cd ..\..\gtk &amp; $(PythonPath)\python $(GDbusCodeGenCmd) &amp; cd 
$(SolutionDir)</GenerateGtkDbusBuiltSources>
-    <GenerateGtkDbusBuiltSourcesX64>cd ..\..\gtk &amp; $(PythonPathX64)\python $(GDbusCodeGenCmd) &amp; cd 
$(SolutionDir)</GenerateGtkDbusBuiltSourcesX64>
+    <GenerateGtkDbusBuiltSources>cd ..\..\gtk &amp; $(PythonDir)\python $(GDbusCodeGenCmd) &amp; cd 
$(SolutionDir)</GenerateGtkDbusBuiltSources>
+    <GenerateGtkDbusBuiltSourcesX64>cd ..\..\gtk &amp; $(PythonDirX64)\python $(GDbusCodeGenCmd) &amp; cd 
$(SolutionDir)</GenerateGtkDbusBuiltSourcesX64>
     <CopyGtkWin32RC>copy ..\..\gtk\gtk-win32.rc.body ..\..\gtk\gtk-win32.rc</CopyGtkWin32RC>
-    <GenerateGtkWin32Manifest>$(PythonPath)\python ..\replace.py --action=replace-var 
--input=..\..\gtk\libgtk4.manifest.in --output=..\..\gtk\libgtk4.manifest --var=EXE_MANIFEST_ARCHITECTURE 
--outstring=*</GenerateGtkWin32Manifest>
+    <GenerateGtkWin32Manifest>$(PythonDir)\python ..\replace.py --action=replace-var 
--input=..\..\gtk\libgtk4.manifest.in --output=..\..\gtk\libgtk4.manifest --var=EXE_MANIFEST_ARCHITECTURE 
--outstring=*</GenerateGtkWin32Manifest>
+    <GenerateGtkWin32ManifestX64>$(PythonDirX64)\python ..\replace.py --action=replace-var 
--input=..\..\gtk\libgtk4.manifest.in --output=..\..\gtk\libgtk4.manifest --var=EXE_MANIFEST_ARCHITECTURE 
--outstring=*</GenerateGtkWin32ManifestX64>
     <CopyDemosH>copy ..\..\demos\gtk-demo\demos.h.win32 ..\..\demos\gtk-demo\demos.h</CopyDemosH>
     <GenGSKEnumSrcs>(cd ..) &amp; (call gen-enums.bat $(GlibEtcInstallRoot)) &amp; (cd 
$(SolutionDir))</GenGSKEnumSrcs>
     <GenGSKRsrcSrcs>
@@ -87,6 +88,9 @@ $(GlibEtcInstallRoot)\bin\glib-compile-resources.exe --sourcedir=..\..\gsk --c-n
     <BuildMacro Include="GenerateGtkWin32Manifest">
       <Value>$(GenerateGtkWin32Manifest)</Value>
     </BuildMacro>
+    <BuildMacro Include="GenerateGtkWin32ManifestX64">
+      <Value>$(GenerateGtkWin32ManifestX64)</Value>
+    </BuildMacro>
     <BuildMacro Include="CopyDemosH">
       <Value>$(CopyDemosH)</Value>
     </BuildMacro>
diff --git a/win32/vs12/gtk4-install.propsin b/win32/vs12/gtk4-install.propsin
index 7a9f2b3..ac5fbea 100644
--- a/win32/vs12/gtk4-install.propsin
+++ b/win32/vs12/gtk4-install.propsin
@@ -104,8 +104,8 @@ $(GlibEtcInstallRoot)\bin\glib-compile-schemas.exe $(CopyDir)\share\glib-2.0\sch
 echo "Generating icon cache..."
 $(CopyDir)\bin\gtk$(ApiVersionShort)-update-icon-cache.exe --ignore-theme-index --force 
"$(CopyDir)\share\icons\hicolor"
     </GtkPostInstall>
-    <GenerateGtkPC>$(PythonPath)\python ..\gtkpc.py --prefix=$(CopyDir) --version=$(GtkVersion) 
--host=i686-pc-vs$(VSVer)</GenerateGtkPC>
-    <GenerateGtkPCX64>$(PythonPathX64)\python ..\gtkpc.py --prefix=$(CopyDir) --version=$(GtkVersion) 
--host=x86_64-pc-vs$(VSVer)</GenerateGtkPCX64>
+    <GenerateGtkPC>$(PythonDir)\python ..\gtkpc.py --prefix=$(CopyDir) --version=$(GtkVersion) 
--host=i686-pc-vs$(VSVer)</GenerateGtkPC>
+    <GenerateGtkPCX64>$(PythonDirX64)\python ..\gtkpc.py --prefix=$(CopyDir) --version=$(GtkVersion) 
--host=x86_64-pc-vs$(VSVer)</GenerateGtkPCX64>
     <GtkPCFiles>..\gtk+-$(ApiVersion).pc</GtkPCFiles>
   </PropertyGroup>
   <PropertyGroup>
diff --git a/win32/vs12/gtk4-version-paths.props.in b/win32/vs12/gtk4-version-paths.props.in
index 3b1da88..d9f504b 100644
--- a/win32/vs12/gtk4-version-paths.props.in
+++ b/win32/vs12/gtk4-version-paths.props.in
@@ -13,8 +13,10 @@
     <GtkSeparateVSDllSuffix>-vs$(VSVer)</GtkSeparateVSDllSuffix>
     <GtkDllPrefix>$(GtkSeparateVSDllPrefix)</GtkDllPrefix>
     <GtkDllSuffix>$(GtkSeparateVSDllSuffix)</GtkDllSuffix>
-    <PythonPath>c:\python34</PythonPath>
-    <PythonPathX64>$(PythonPath).x64</PythonPathX64>
+    <PythonDir Condition="'$(VisualStudioVersion)' == '12.0'">c:\\python34</PythonDir>
+    <PythonDir Condition="'$(VisualStudioVersion)' == '14.0'">c:\\python36</PythonDir>
+    <PythonDir Condition="'$(VisualStudioVersion)' == '15.0'">c:\\python36</PythonDir>
+    <PythonDirX64>$(PythonDir).x64</PythonDirX64>
   </PropertyGroup>
   <PropertyGroup>
     <_PropertySheetDisplayName>gtk4versionpathsprops</_PropertySheetDisplayName>
@@ -56,11 +58,11 @@
     <BuildMacro Include="GtkDllSuffix">
       <Value>$(GtkDllSuffix)</Value>
     </BuildMacro>
-    <BuildMacro Include="PythonPath">
-      <Value>$(PythonPath)</Value>
+    <BuildMacro Include="PythonDir">
+      <Value>$(PythonDir)</Value>
     </BuildMacro>
-    <BuildMacro Include="PythonPathX64">
-      <Value>$(PythonPathX64)</Value>
+    <BuildMacro Include="PythonDirX64">
+      <Value>$(PythonDirX64)</Value>
     </BuildMacro>
   </ItemGroup>
 </Project>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]