gtk2/win32/gen-enums.batin
Chun-wei Fan ffc15bf922 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.
2017-08-01 16:26:43 +08:00

19 lines
404 B
Plaintext

@ECHO OFF
cd ..\gsk
if exist gskenumtypes.h del gskenumtypes.h
if exist gskenumtypes.c del gskenumtypes.c
for %%f in (gskenumtypes.h gskenumtypes.c) do ^
%2\python %1\bin\glib-mkenums ^
--template %%f.template ^
#include "gsk.enum.headers"
&1> %%f
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> %%f