Visual Studio builds: Adapt to the Python-fied glib-genmarshal
authorChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 12 Jul 2017 04:27:44 +0000 (12:27 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 12 Jul 2017 04:37:19 +0000 (12:37 +0800)
glib-genmarshal is used for the Visual Studio builds, and has been
recently converted to a Python script instead of a compiled C program.

Since Visual Studio calls cmd.exe to run Custom Build steps, we need
to call Python explicitly to run glib-genmarshal as shebang lines
are not supported in cmd.exe, which means that Python will become a
hard build-time requirement instead of being optional.  This also means
that the atk.pc pkg-config file will always be generated.

However, since ATK does not yet require a really recent GLib, maintain
compatibility with older GLib by calling glib-genmarshal.exe when the
glib-genmarshal Python script is not found.

win32/vs10/README.txt
win32/vs10/atk-gen-src.props
win32/vs10/atk-install.propsin
win32/vs10/atk.vcxprojin
win32/vs9/README.txt
win32/vs9/atk-gen-src.vsprops
win32/vs9/atk-install.vspropsin
win32/vs9/atk.vcprojin

index 1efbcfa..b394757 100644 (file)
@@ -16,6 +16,13 @@ into atk.vcxproj and atk.vcxproj.filters respectively.
 The dependencies for this package are gettext-runtime (libintl), GLib*\r
 and ZLib.\r
 \r
+You will also need a Python 2.7.x or 3.x installation, as Python will be\r
+used to run glib-genmarshal, which was converted into a Python script from\r
+a compiled C program, in addition to generating the atk.pc pkg-config\r
+file for the build.  See PythonPath (32-bit builds) or PythonPathX64 (x64\r
+builds) in atk-version-paths.props to see that they point to the correct paths.\r
+\r
+\r
 a) look for all of the dependencies (except GLib*) under\r
 \r
    http://ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/ (32-bit) -OR-\r
index 6abbcdc..d699f4f 100644 (file)
@@ -7,13 +7,20 @@
     <GenConfigH>if not exist ..\..\config.h copy ..\..\config.h.win32 ..\..\config.h</GenConfigH>
     <GenMarshalSrc>
 cd ..\..\atk
-
-$(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --header &gt; atkmarshal.h
-
-$(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --body &gt; atkmarshal.c
-
+if exist $(GLibEtcInstallRoot)\bin\glib-genmarshal $(PythonPath)\python $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --header &gt; atkmarshal.h
+if not exist atkmarshal.h $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --header &gt; atkmarshal.h
+if exist $(GLibEtcInstallRoot)\bin\glib-genmarshal $(PythonPath)\python $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --body &gt; atkmarshal.c
+if not exist atkmarshal.c $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --body &gt; atkmarshal.c
 cd $(SolutionDir)
     </GenMarshalSrc>
+    <GenMarshalSrcX64>
+cd ..\..\atk
+if exist $(GLibEtcInstallRoot)\bin\glib-genmarshal $(PythonPathX64)\python $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --header &gt; atkmarshal.h
+if not exist atkmarshal.h $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --header &gt; atkmarshal.h
+if exist $(GLibEtcInstallRoot)\bin\glib-genmarshal $(PythonPathX64)\python $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --body &gt; atkmarshal.c
+if not exist atkmarshal.c $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --body &gt; atkmarshal.c
+cd $(SolutionDir)
+    </GenMarshalSrcX64>
   </PropertyGroup>
   <PropertyGroup>
     <_PropertySheetDisplayName>atkgensrcprops</_PropertySheetDisplayName>
@@ -25,5 +32,8 @@ cd $(SolutionDir)
     <BuildMacro Include="GenMarshalSrc">
       <Value>$(GenMarshalSrc)</Value>
     </BuildMacro>
+    <BuildMacro Include="GenMarshalSrcX64">
+      <Value>$(GenMarshalSrcX64)</Value>
+    </BuildMacro>
   </ItemGroup>
 </Project>
index b790fa8..81c2dc5 100644 (file)
@@ -18,10 +18,11 @@ copy $(BinDir)\atk-$(ApiVersion).lib $(CopyDir)\lib
 mkdir $(CopyDir)\include\atk-$(ApiVersion)\atk
 #include "atk.vs10.headers"
 
-if exist ..\atk.pc (mkdir $(CopyDir)\lib\pkgconfig &amp; copy ..\atk.pc $(CopyDir)\lib\pkgconfig)
+mkdir $(CopyDir)\lib\pkgconfig
+copy ..\atk.pc $(CopyDir)\lib\pkgconfig
     </AtkDoInstall>
-    <AtkGenPC>if exist $(PythonPath)\python.exe $(PythonPath)\python.exe ..\atkpc.py --prefix=$(CopyDir) --version=$(AtkMajorVersion).$(AtkMinorVersion).$(AtkMicroVersion)</AtkGenPC>
-    <AtkGenPCX64>if exist $(PythonPathX64)\python.exe $(PythonPathX64)\python.exe ..\atkpc.py --prefix=$(CopyDir) --version=$(AtkMajorVersion).$(AtkMinorVersion).$(AtkMicroVersion)</AtkGenPCX64>
+    <AtkGenPC>$(PythonPath)\python.exe ..\atkpc.py --prefix=$(CopyDir) --version=$(AtkMajorVersion).$(AtkMinorVersion).$(AtkMicroVersion)</AtkGenPC>
+    <AtkGenPCX64>$(PythonPathX64)\python.exe ..\atkpc.py --prefix=$(CopyDir) --version=$(AtkMajorVersion).$(AtkMinorVersion).$(AtkMicroVersion)</AtkGenPCX64>
     <AtkPCFiles>..\atk.pc</AtkPCFiles>
   </PropertyGroup>
   <ItemGroup>
index 4f96b7c..b1c79d2 100644 (file)
   </ItemGroup>
   <ItemGroup>
     <CustomBuild Include="..\..\config.h.win32">
-      <Message Condition="'$(Configuration)'=='Debug'">Copying config.h from config.h.win32...</Message>
-      <Command Condition="'$(Configuration)'=='Debug'">$(GenConfigH)</Command>
-      <Outputs Condition="'$(Configuration)'=='Debug'">..\..\config.h;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Release'">Copying config.h from config.h.win32...</Message>
-      <Command Condition="'$(Configuration)'=='Release'">$(GenConfigH)</Command>
-      <Outputs Condition="'$(Configuration)'=='Release'">..\..\config.h;%(Outputs)</Outputs>
+      <Message>Copying config.h from config.h.win32...</Message>
+      <Command>$(GenConfigH)</Command>
+      <Outputs>..\..\config.h;%(Outputs)</Outputs>
     </CustomBuild>
     <CustomBuild Include="..\..\atk\atkmarshal.list">
-      <Message Condition="'$(Configuration)'=='Debug'">Generating Marshalling Sources...</Message>
-      <Command Condition="'$(Configuration)'=='Debug'">$(GenMarshalSrc)</Command>
-      <Outputs Condition="'$(Configuration)'=='Debug'">..\..\atk\atkmarshal.h;..\..\atk\atkmarshal.c;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Release'">Generating Marshalling Sources...</Message>
-      <Command Condition="'$(Configuration)'=='Release'">$(GenMarshalSrc)</Command>
-      <Outputs Condition="'$(Configuration)'=='Release'">..\..\atk\atkmarshal.h;..\..\atk\atkmarshal.c;%(Outputs)</Outputs>
+      <Message Condition="'$(Platform)'=='Win32'">Generating Marshalling Sources...</Message>
+      <Command Condition="'$(Platform)'=='Win32'">$(GenMarshalSrc)</Command>
+      <Outputs Condition="'$(Platform)'=='Win32'">..\..\atk\atkmarshal.h;..\..\atk\atkmarshal.c;%(Outputs)</Outputs>
+      <Message Condition="'$(Platform)'=='x64'">Generating Marshalling Sources...</Message>
+      <Command Condition="'$(Platform)'=='x64'">$(GenMarshalSrcX64)</Command>
+      <Outputs Condition="'$(Platform)'=='x64'">..\..\atk\atkmarshal.h;..\..\atk\atkmarshal.c;%(Outputs)</Outputs>
     </CustomBuild>
   </ItemGroup>
   <ItemGroup>
index ad90fe2..1798877 100644 (file)
@@ -16,6 +16,12 @@ atk.vcproj.
 The dependencies for this package are gettext-runtime (libintl), GLib*\r
 and ZLib.\r
 \r
+You will also need a Python 2.7.x or 3.x installation, as Python will be\r
+used to run glib-genmarshal, which was converted into a Python script from\r
+a compiled C program, in addition to generating the atk.pc pkg-config\r
+file for the build.  See PythonPath (32-bit builds) or PythonPathX64 (x64\r
+builds) in atk-version-paths.vsprops to see that they point to the correct paths.\r
+\r
 a) look for all of the dependencies (except GLib*) under\r
 \r
    http://ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/ (32-bit) -OR-\r
index 7e39862..ccfcb68 100644 (file)
                Name="GenMarshalSrc"
                Value="
 cd ..\..\atk&#x0D;&#x0A;
-$(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --header &gt; atkmarshal.h&#x0D;&#x0A;
-$(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --body &gt; atkmarshal.c&#x0D;&#x0A;
+if exist $(GLibEtcInstallRoot)\bin\glib-genmarshal $(PythonPath)\python $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --header &gt; atkmarshal.h&#x0D;&#x0A;
+if not exist atkmarshal.h $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --header &gt; atkmarshal.h&#x0D;&#x0A;
+if exist $(GLibEtcInstallRoot)\bin\glib-genmarshal $(PythonPath)\python $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --body &gt; atkmarshal.c&#x0D;&#x0A;
+if not exist atkmarshal.c $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --body &gt; atkmarshal.c&#x0D;&#x0A;
 cd $(SolutionDir)&#x0D;&#x0A;
                      "
        />
+       <UserMacro
+                Name="GenMarshalSrcX64"
+                Value="
+cd ..\..\atk&#x0D;&#x0A;
+if exist $(GLibEtcInstallRoot)\bin\glib-genmarshal $(PythonPathX64)\python $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --header &gt; atkmarshal.h&#x0D;&#x0A;
+if not exist atkmarshal.h $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --header &gt; atkmarshal.h&#x0D;&#x0A;
+if exist $(GLibEtcInstallRoot)\bin\glib-genmarshal $(PythonPathX64)\python $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --body &gt; atkmarshal.c&#x0D;&#x0A;
+if not exist atkmarshal.c $(GLibEtcInstallRoot)\bin\glib-genmarshal --prefix=atk_marshal atkmarshal.list --body &gt; atkmarshal.c&#x0D;&#x0A;
+cd $(SolutionDir)&#x0D;&#x0A;
+                      "
+        />
 </VisualStudioPropertySheet>
index aed8fd5..880dad5 100644 (file)
@@ -19,15 +19,16 @@ copy $(SolutionDir)$(ConfigurationName)\$(PlatformName)\bin\atk-$(ApiVersion).li
 mkdir $(CopyDir)\include\atk-$(ApiVersion)\atk&#x0D;&#x0A;
 #include "atk.headers"
 
-if exist ..\atk.pc (mkdir $(CopyDir)\lib\pkgconfig &amp; copy ..\atk.pc $(CopyDir)\lib\pkgconfig)&#x0D;&#x0A;
+mkdir $(CopyDir)\lib\pkgconfig&#x0D;&#x0A;
+copy ..\atk.pc $(CopyDir)\lib\pkgconfig&#x0D;&#x0A;
 "
        />
        <UserMacro
                Name="AtkGenPC"
-               Value="if exist $(PythonPath)\python.exe $(PythonPath)\python.exe ..\atkpc.py --prefix=$(CopyDir) --version=$(AtkMajorVersion).$(AtkMinorVersion).$(AtkMicroVersion)"
+               Value="$(PythonPath)\python.exe ..\atkpc.py --prefix=$(CopyDir) --version=$(AtkMajorVersion).$(AtkMinorVersion).$(AtkMicroVersion)"
        />
        <UserMacro
                Name="AtkGenPCX64"
-               Value="if exist $(PythonPathX64)\python.exe $(PythonPathX64)\python.exe ..\atkpc.py --prefix=$(CopyDir) --version=$(AtkMajorVersion).$(AtkMinorVersion).$(AtkMicroVersion)"
+               Value="$(PythonPathX64)\python.exe ..\atkpc.py --prefix=$(CopyDir) --version=$(AtkMajorVersion).$(AtkMinorVersion).$(AtkMicroVersion)"
        />
 </VisualStudioPropertySheet>
index 69c354d..a51a747 100644 (file)
                                        <Tool
                                                Name="VCCustomBuildTool"
                                                Description="Generating Marshalling Sources..."
-                                               CommandLine="$(GenMarshalSrc)"
+                                               CommandLine="$(GenMarshalSrcX64)"
                                                Outputs="..\..\atk\atkmarshal.h;..\..\atk\atkmarshal.c"
                                        />
                                </FileConfiguration>
                                        <Tool
                                                Name="VCCustomBuildTool"
                                                Description="Generating Marshalling Sources..."
-                                               CommandLine="$(GenMarshalSrc)"
+                                               CommandLine="$(GenMarshalSrcX64)"
                                                Outputs="..\..\atk\atkmarshal.h;..\..\atk\atkmarshal.c"
                                        />
                                </FileConfiguration>