[gtk+] Visual Studio builds: Adapt to new glib-mkenums



commit ffc15bf9221af662277c36e4a36b3f7a30487bd2
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Aug 1 16:05:57 2017 +0800

    Visual Studio builds: Adapt to new glib-mkenums
    
    glib-mkenums is now done in Python, but since the Visual Studio build
    environment (cmd.exe) does not support shebang lines, we need to call
    the interpretor explicitly to run the script.
    
    This means that we need to update on how we generate
    gsk/gskenumtypes.[c|h] in our projects, as at this point GTK+-3.91.x
    does not require a GLib installation that ships with the Python-fied
    glib-mkenums.  As a result, we adapt to this by first using Python
    to call glib-mkenums.  If this fails (where the output file becomes 0
    in size), then we use PERL to call the glib-mkenums script.  Note that
    during the build this will cause a warning message to be displayed,
    stating that '&' cannot be found, but due to the way Windows .bat script
    are done, we need to live with that until a solution can be found on
    this.
    
    This is likely a problem that does not exist in the Meson builds, as
    Meson will take care of calling the interpretor for us by looking at
    the shebang lines for our case.
    
    Also, clean up the .batin Windows batch script that is used to call
    glib-mkenums by using a for loop in there.

 win32/gen-enums.batin          |   14 ++++++++------
 win32/vs12/gsk-4.vcxprojin     |   33 +++++++++------------------------
 win32/vs12/gtk4-gen-srcs.props |    6 +++++-
 3 files changed, 22 insertions(+), 31 deletions(-)
---
diff --git a/win32/gen-enums.batin b/win32/gen-enums.batin
index 64f2cd8..a99b60a 100644
--- a/win32/gen-enums.batin
+++ b/win32/gen-enums.batin
@@ -5,12 +5,14 @@ cd ..\gsk
 if exist gskenumtypes.h del gskenumtypes.h
 if exist gskenumtypes.c del gskenumtypes.c
 
-call perl %1\bin\glib-mkenums ^
---template gskenumtypes.h.template ^
+for %%f in (gskenumtypes.h gskenumtypes.c) do ^
+%2\python %1\bin\glib-mkenums ^
+--template %%f.template ^
 #include "gsk.enum.headers"
-&1> gskenumtypes.h
+&1> %%f
 
-call perl %1\bin\glib-mkenums ^
---template gskenumtypes.c.template ^
+for %%f in (gskenumtypes.h gskenumtypes.c) do ^
+if %%~zf EQU 0 perl %1\bin\glib-mkenums ^
+--template %%f.template ^
 #include "gsk.enum.headers"
-&1> gskenumtypes.c
+&1> %%f
diff --git a/win32/vs12/gsk-4.vcxprojin b/win32/vs12/gsk-4.vcxprojin
index db6f34d..5b12f4a 100644
--- a/win32/vs12/gsk-4.vcxprojin
+++ b/win32/vs12/gsk-4.vcxprojin
@@ -222,32 +222,17 @@
   </ItemDefinitionGroup>
   <ItemGroup>
     <CustomBuild Include="..\..\gsk\gskenumtypes.c.template">
-      <Message Condition="'$(Configuration)'=='Debug'">Generating GSK enumeration sources...</Message>
-      <Command Condition="'$(Configuration)'=='Debug'">$(GenGSKEnumSrcs)</Command>
-      <Outputs 
Condition="'$(Configuration)'=='Debug'">..\..\gsk\gskenumtypes.h;..\..\gsk\gskenumtypes.c;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Debug_Vulkan'">Generating GSK enumeration sources...</Message>
-      <Command Condition="'$(Configuration)'=='Debug_Vulkan'">$(GenGSKEnumSrcs)</Command>
-      <Outputs 
Condition="'$(Configuration)'=='Debug_Vulkan'">..\..\gsk\gskenumtypes.h;..\..\gsk\gskenumtypes.c;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Release'">Generating GSK enumeration sources...</Message>
-      <Command Condition="'$(Configuration)'=='Release'">$(GenGSKEnumSrcs)</Command>
-      <Outputs 
Condition="'$(Configuration)'=='Release'">..\..\gsk\gskenumtypes.h;..\..\gsk\gskenumtypes.c;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Release_Vulkan'">Generating GSK enumeration 
sources...</Message>
-      <Command Condition="'$(Configuration)'=='Release_Vulkan'">$(GenGSKEnumSrcs)</Command>
-      <Outputs 
Condition="'$(Configuration)'=='Release_Vulkan'">..\..\gsk\gskenumtypes.h;..\..\gsk\gskenumtypes.c;%(Outputs)</Outputs>
+      <Message Condition="'$(Platform)'=='Win32'">Generating GSK enumeration sources...</Message>
+      <Command Condition="'$(Platform)'=='Win32'">$(GenGSKEnumSrcs)</Command>
+      <Outputs 
Condition="'$(Platform)'=='Win32'">..\..\gsk\gskenumtypes.h;..\..\gsk\gskenumtypes.c;%(Outputs)</Outputs>
+      <Message Condition="'$(Platform)'=='x64'">Generating GSK enumeration sources...</Message>
+      <Command Condition="'$(Platform)'=='x64'">$(GenGSKEnumSrcsX64)</Command>
+      <Outputs 
Condition="'$(Platform)'=='x64'">..\..\gsk\gskenumtypes.h;..\..\gsk\gskenumtypes.c;%(Outputs)</Outputs>
     </CustomBuild>
     <CustomBuild Include="..\..\gsk\gsk.gresource.xml">
-      <Message Condition="'$(Configuration)'=='Debug'">Generating GSK resource sources...</Message>
-      <Command Condition="'$(Configuration)'=='Debug'">$(GenGSKRsrcSrcs)</Command>
-      <Outputs 
Condition="'$(Configuration)'=='Debug'">..\..\gsk\gskresources.h;..\..\gsk\gskresources.c;..\..\gsk\gsk.gresource.xml;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Debug_Vulkan'">Generating GSK resource sources...</Message>
-      <Command Condition="'$(Configuration)'=='Debug_Vulkan'">$(GenGSKRsrcSrcs)</Command>
-      <Outputs 
Condition="'$(Configuration)'=='Debug_Vulkan'">..\..\gsk\gskresources.h;..\..\gsk\gskresources.c;..\..\gsk\gsk.gresource.xml;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Release'">Generating GSK resource sources...</Message>
-      <Command Condition="'$(Configuration)'=='Release'">$(GenGSKRsrcSrcs)</Command>
-      <Outputs 
Condition="'$(Configuration)'=='Release'">..\..\gsk\gskresources.h;..\..\gsk\gskresources.c;..\..\gsk\gsk.gresource.xml;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)'=='Release_Vulkan'">Generating GSK resource sources...</Message>
-      <Command Condition="'$(Configuration)'=='Release_Vulkan'">$(GenGSKRsrcSrcs)</Command>
-      <Outputs 
Condition="'$(Configuration)'=='Release_Vulkan'">..\..\gsk\gskresources.h;..\..\gsk\gskresources.c;..\..\gsk\gsk.gresource.xml;%(Outputs)</Outputs>
+      <Message>Generating GSK resource sources...</Message>
+      <Command>$(GenGSKRsrcSrcs)</Command>
+      
<Outputs>..\..\gsk\gskresources.h;..\..\gsk\gskresources.c;..\..\gsk\gsk.gresource.xml;%(Outputs)</Outputs>
     </CustomBuild>
   </ItemGroup>
   <ItemGroup>
diff --git a/win32/vs12/gtk4-gen-srcs.props b/win32/vs12/gtk4-gen-srcs.props
index c611d74..4837210 100644
--- a/win32/vs12/gtk4-gen-srcs.props
+++ b/win32/vs12/gtk4-gen-srcs.props
@@ -45,7 +45,8 @@ echo $(Configuration) &gt; ..\..\MSVC_$(Configuration)_Vulkan
     <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>
+    <GenGSKEnumSrcs>(cd ..) &amp; (call gen-enums.bat $(GlibEtcInstallRoot) $(PythonDir)) &amp; (cd 
$(SolutionDir))</GenGSKEnumSrcs>
+    <GenGSKEnumSrcsX64>(cd ..) &amp; (call gen-enums.bat $(GlibEtcInstallRoot) $(PythonDirX64)) &amp; (cd 
$(SolutionDir))</GenGSKEnumSrcsX64>
     <GenGSKRsrcSrcs>
 echo ^&lt;?xml version='1.0' encoding='UTF-8'?^&gt; &gt; ..\..\gsk\gsk.gresource.xml
 echo ^&lt;gresources^&gt; &gt;&gt; ..\..\gsk\gsk.gresource.xml
@@ -97,6 +98,9 @@ $(GlibEtcInstallRoot)\bin\glib-compile-resources.exe --sourcedir=..\..\gsk --c-n
     <BuildMacro Include="GenGSKEnumSrcs">
       <Value>$(GenGSKEnumSrcs)</Value>
     </BuildMacro>
+    <BuildMacro Include="GenGSKEnumSrcsX64">
+      <Value>$(GenGSKEnumSrcsX64)</Value>
+    </BuildMacro>
     <BuildMacro Include="GenGSKRsrcSrcs">
       <Value>$(GenGSKRsrcSrcs)</Value>
     </BuildMacro>


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