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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -45,7 +45,8 @@ echo $(Configuration) > ..\..\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 ..) & (call gen-enums.bat $(GlibEtcInstallRoot)) & (cd $(SolutionDir))</GenGSKEnumSrcs>
|
||||
<GenGSKEnumSrcs>(cd ..) & (call gen-enums.bat $(GlibEtcInstallRoot) $(PythonDir)) & (cd $(SolutionDir))</GenGSKEnumSrcs>
|
||||
<GenGSKEnumSrcsX64>(cd ..) & (call gen-enums.bat $(GlibEtcInstallRoot) $(PythonDirX64)) & (cd $(SolutionDir))</GenGSKEnumSrcsX64>
|
||||
<GenGSKRsrcSrcs>
|
||||
echo ^<?xml version='1.0' encoding='UTF-8'?^> > ..\..\gsk\gsk.gresource.xml
|
||||
echo ^<gresources^> >> ..\..\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>
|
||||
|
||||
Reference in New Issue
Block a user