Visual Studio projects: Fix generating gtktypefuncs.inc

From the Meson port, gtk/gtktesteutils.c now includes
gtk/gtktypefuncs.in instead of gtk/gtktypefuncs.c, so we should do the
same thing in the Visual Studio projects, to fix the build.

Also, since build/win32/gentypefuncs.py is an adaptation of the script
from GTK master (in gtk/), and that we now have gtk/gentypefuncs.py, we
should use the version of the script in gtk/ and drop the one in
build/win32.
This commit is contained in:
Chun-wei Fan 2019-06-18 14:30:50 +08:00
parent bd80b34ca8
commit 0b50915878
7 changed files with 16 additions and 70 deletions

View File

@ -36,7 +36,6 @@ SUBDIRS = \
EXTRA_DIST += \
detectenv-msvc.mak \
gentypefuncs.py \
gtk-introspection-msvc.mak \
introspection-msvc.mak \
replace.py \

View File

@ -1,53 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import re
import os
debug = os.getenv('GTK_GENTYPEFUNCS_DEBUG') is not None
out_file = sys.argv[1]
in_file = sys.argv[2]
funcs = []
if debug: print ('Output file: ', out_file)
# if debug: print (len(in_files), 'input files')
def open_file(filename, mode):
if sys.version_info[0] < 3:
return open(filename, mode=mode)
else:
return open(filename, mode=mode, encoding='utf-8')
with open(in_file, 'r') as f:
for line in f:
line = line.rstrip('\n').rstrip('\r')
# print line
match = re.search(r'\bg[td]k_[a-zA-Z0-9_]*_get_type\b', line)
if match:
func = match.group(0)
if not func in funcs:
funcs.append(func)
if debug: print ('Found ', func)
file_output = 'G_GNUC_BEGIN_IGNORE_DEPRECATIONS\n'
funcs = sorted(funcs)
for f in funcs:
if f.startswith('gdk_x11') or f.startswith('gtk_socket') or f.startswith('gtk_plug'):
file_output += '#ifdef GDK_WINDOWING_X11\n'
file_output += '*tp++ = {0}();\n'.format(f)
file_output += '#endif\n'
else:
file_output += '*tp++ = {0}();\n'.format(f)
if debug: print (len(funcs), 'functions')
ofile = open(out_file, "w")
ofile.write(file_output)
ofile.close()

View File

@ -21,7 +21,7 @@
<CustomBuild Include="..\..\..\gtk\gtkdbusinterfaces.xml"><Filter>Resource Files</Filter></CustomBuild>
<CustomBuild Include="..\..\..\gtk\gtk-win32.rc.body"><Filter>Resource Files</Filter></CustomBuild>
<CustomBuild Include="..\..\..\gtk\libgtk3.manifest.in"><Filter>Resource Files</Filter></CustomBuild>
<CustomBuild Include="..\gentypefuncs.py"><Filter>Resource Files</Filter></CustomBuild>
<CustomBuild Include="..\..\..\gtk\gentypefuncs.py"><Filter>Resource Files</Filter></CustomBuild>
</ItemGroup>
<ItemGroup>
#include "gtk-3.vs10.sourcefiles.filters"

View File

@ -178,10 +178,10 @@
<Command>$(GenerateGtkWin32Manifest)</Command>
<Outputs>..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="..\gentypefuncs.py">
<Message>Generating ..\..\..\gtk\gtktypefuncs.c</Message>
<CustomBuild Include="..\..\..\gtk\gentypefuncs.py">
<Message>Generating ..\..\..\gtk\gtktypefuncs.inc</Message>
<Command>$(GenerateTypeFuncs)</Command>
<Outputs>..\..\..\gtk\gtktypefuncs.c</Outputs>
<Outputs>..\..\..\gtk\gtktypefuncs.inc</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>

View File

@ -47,7 +47,7 @@ echo $(Configuration) &gt; ..\..\..\MSVC_$(Configuration)_Broadway
echo #undef GTK_COMPILATION &gt; ..\..\..\gtk\gtktypefuncs.preproc.c
echo #include "gtkx.h" &gt;&gt; ..\..\..\gtk\gtktypefuncs.preproc.c
cl /EP /I..\..\..\gtk /I..\..\..\gdk /I..\..\..\gdk\win32 /I..\..\.. /I$(GlibEtcInstallRoot)\include\gdk-pixbuf-2.0 /I$(GlibEtcInstallRoot)\include\pango-1.0 /I$(GlibEtcInstallRoot)\include\atk-1.0 /I$(GlibEtcInstallRoot)\include\cairo /I$(GlibEtcInstallRoot)\include\gio-win32-2.0 /I$(GlibEtcInstallRoot)\include\glib-2.0 /I$(GlibEtcInstallRoot)\lib\glib-2.0\include /I$(GlibEtcInstallRoot)\include /DHAVE_CONFIG_H /DG_DISABLE_SINGLE_INCLUDES /DATK_DISABLE_SINGLE_INCLUDES /DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES /DGTK_DISABLE_SINGLE_INCLUDES /D_USE_MATH_DEFINES /DINCLUDE_IM_am_et /DINCLUDE_IM_cedilla /DINCLUDE_IM_cyrillic_translit /DINCLUDE_IM_ime /DINCLUDE_IM_inuktitut /DINCLUDE_IM_ipa /DINCLUDE_IM_multipress /DINCLUDE_IM_thai /DINCLUDE_IM_ti_er /DINCLUDE_IM_ti_et /DINCLUDE_IM_viqr /DGTK_COMPILATION /DG_LOG_DOMAIN=\"Gtk\" /DGTK_HOST=\"i686-pc-vs$(VSVer)\" /DGTK_PRINT_BACKENDS=\"file\" /DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED /D$(GtkIncludedImmodulesDefines) /DGTK_LIBDIR=\"$(GtkDummyPrefix)/lib\" /DGTK_DATADIR=\"$(GtkDummyPrefix)/share\" /DGTK_DATA_PREFIX=\"$(GtkDummyPrefix)\" /DGTK_SYSCONFDIR=\"$(GtkDummyPrefix)/etc\" /DMULTIPRESS_CONFDIR=\"$(GtkDummyPrefix)/etc/gtk-$(ApiVersion)\" /DMULTIPRESS_LOCALEDIR=\"$(GtkDummyPrefix)/share/locale\" /DGTK_VERSION=\"$(GtkVersion)\" /DGTK_BINARY_VERSION=\"$(GtkBinaryVersion)\" /DGDK_DISABLE_DEPRECATED /DISOLATION_AWARE_ENABLED ..\..\..\gtk\gtktypefuncs.preproc.c &gt; ..\..\..\gtk\gtktypefuncs.combined.c
$(PythonDir)\python ..\gentypefuncs.py ..\..\..\gtk\gtktypefuncs.c ..\..\..\gtk\gtktypefuncs.combined.c
$(PythonDir)\python ..\..\..\gtk\gentypefuncs.py ..\..\..\gtk\gtktypefuncs.inc ..\..\..\gtk\gtktypefuncs.combined.c
del ..\..\..\gtk\gtktypefuncs.combined.c ..\..\..\gtk\gtktypefuncs.preproc.c
</GenerateTypeFuncs>
</PropertyGroup>

View File

@ -252,33 +252,33 @@
/>
</FileConfiguration>
</File>
<File RelativePath="..\gentypefuncs.py">
<File RelativePath="..\..\..\gtk\gentypefuncs.py">
<FileConfiguration Name="Debug|Win32">
<Tool Name="VCCustomBuildTool"
Description="Generating ..\..\..\gtk\gtktypefuncs.c..."
Description="Generating ..\..\..\gtk\gtktypefuncs.inc..."
CommandLine="$(GenerateTypeFuncs)"
Outputs="..\..\..\gtk\gtktypefuncs.c"
Outputs="..\..\..\gtk\gtktypefuncs.inc"
/>
</FileConfiguration>
<FileConfiguration Name="Release|Win32">
<Tool Name="VCCustomBuildTool"
Description="Generating ..\..\..\gtk\gtktypefuncs.c..."
Description="Generating ..\..\..\gtk\gtktypefuncs.inc..."
CommandLine="$(GenerateTypeFuncs)"
Outputs="..\..\..\gtk\gtktypefuncs.c"
Outputs="..\..\..\gtk\gtktypefuncs.inc"
/>
</FileConfiguration>
<FileConfiguration Name="Debug|x64">
<Tool Name="VCCustomBuildTool"
Description="Generating ..\..\..\gtk\gtktypefuncs.c..."
Description="Generating ..\..\..\gtk\gtktypefuncs.inc..."
CommandLine="$(GenerateTypeFuncsX64)"
Outputs="..\..\..\gtk\gtktypefuncs.c"
Outputs="..\..\..\gtk\gtktypefuncs.inc"
/>
</FileConfiguration>
<FileConfiguration Name="Release|x64">
<Tool Name="VCCustomBuildTool"
Description="Generating ..\..\..\gtk\gtktypefuncs.c..."
Description="Generating ..\..\..\gtk\gtktypefuncs.inc..."
CommandLine="$(GenerateTypeFuncsX64)"
Outputs="..\..\..\gtk\gtktypefuncs.c"
Outputs="..\..\..\gtk\gtktypefuncs.inc"
/>
</FileConfiguration>
</File>

View File

@ -84,7 +84,7 @@ echo $(ConfigurationName) &gt; ..\..\..\MSVC_$(ConfigurationName)_Broadway&#x0D;
echo #undef GTK_COMPILATION &gt; ..\..\..\gtk\gtktypefuncs.preproc.c&#x0D;&#x0A;
echo #include &quot;gtkx.h&quot; &gt;&gt; ..\..\..\gtk\gtktypefuncs.preproc.c&#x0D;&#x0A;
cl /EP /I..\..\..\gtk /I..\..\..\gdk /I..\..\..\gdk\win32 /I..\..\.. /I$(GlibEtcInstallRoot)\include\gdk-pixbuf-2.0 /I$(GlibEtcInstallRoot)\include\pango-1.0 /I$(GlibEtcInstallRoot)\include\atk-1.0 /I$(GlibEtcInstallRoot)\include\cairo /I$(GlibEtcInstallRoot)\include\gio-win32-2.0 /I$(GlibEtcInstallRoot)\include\glib-2.0 /I$(GlibEtcInstallRoot)\lib\glib-2.0\include /I$(GlibEtcInstallRoot)\include /DHAVE_CONFIG_H /DG_DISABLE_SINGLE_INCLUDES /DATK_DISABLE_SINGLE_INCLUDES /DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES /DGTK_DISABLE_SINGLE_INCLUDES /D_USE_MATH_DEFINES /DINCLUDE_IM_am_et /DINCLUDE_IM_cedilla /DINCLUDE_IM_cyrillic_translit /DINCLUDE_IM_ime /DINCLUDE_IM_inuktitut /DINCLUDE_IM_ipa /DINCLUDE_IM_multipress /DINCLUDE_IM_thai /DINCLUDE_IM_ti_er /DINCLUDE_IM_ti_et /DINCLUDE_IM_viqr /DGTK_COMPILATION /DG_LOG_DOMAIN=\&quot;Gtk\&quot; /DGTK_HOST=\&quot;i686-pc-vs$(VSVer)\&quot; /DGTK_PRINT_BACKENDS=\&quot;file\&quot; /DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED /D$(GtkIncludedImmodulesDefines) /DGTK_LIBDIR=\&quot;$(GtkDummyPrefix)/lib\&quot; /DGTK_DATADIR=\&quot;$(GtkDummyPrefix)/share\&quot; /DGTK_DATA_PREFIX=\&quot;$(GtkDummyPrefix)\&quot; /DGTK_SYSCONFDIR=\&quot;$(GtkDummyPrefix)/etc\&quot; /DMULTIPRESS_CONFDIR=\&quot;$(GtkDummyPrefix)/etc/gtk-$(ApiVersion)\&quot; /DMULTIPRESS_LOCALEDIR=\&quot;$(GtkDummyPrefix)/share/locale\&quot; /DGTK_VERSION=\&quot;$(GtkVersion)\&quot; /DGTK_BINARY_VERSION=\&quot;$(GtkBinaryVersion)\&quot; /DGDK_DISABLE_DEPRECATED /DISOLATION_AWARE_ENABLED ..\..\..\gtk\gtktypefuncs.preproc.c &gt; ..\..\..\gtk\gtktypefuncs.combined.c&#x0D;&#x0A;
$(PythonDir)\python ..\gentypefuncs.py ..\..\..\gtk\gtktypefuncs.c ..\..\..\gtk\gtktypefuncs.combined.c&#x0D;&#x0A;
$(PythonDir)\python ..\..\..\gtk\gentypefuncs.py ..\..\..\gtk\gtktypefuncs.inc ..\..\..\gtk\gtktypefuncs.combined.c&#x0D;&#x0A;
del ..\..\..\gtk\gtktypefuncs.combined.c ..\..\..\gtk\gtktypefuncs.preproc.c&#x0D;&#x0A;
"
/>
@ -94,7 +94,7 @@ del ..\..\..\gtk\gtktypefuncs.combined.c ..\..\..\gtk\gtktypefuncs.preproc.c&#x0
echo #undef GTK_COMPILATION &gt; ..\..\..\gtk\gtktypefuncs.preproc.c&#x0D;&#x0A;
echo #include &quot;gtkx.h&quot; &gt;&gt; ..\..\..\gtk\gtktypefuncs.preproc.c&#x0D;&#x0A;
cl /EP /I..\..\..\gtk /I..\..\..\gdk /I..\..\..\gdk\win32 /I..\..\.. /I$(GlibEtcInstallRoot)\include\gdk-pixbuf-2.0 /I$(GlibEtcInstallRoot)\include\pango-1.0 /I$(GlibEtcInstallRoot)\include\atk-1.0 /I$(GlibEtcInstallRoot)\include\cairo /I$(GlibEtcInstallRoot)\include\gio-win32-2.0 /I$(GlibEtcInstallRoot)\include\glib-2.0 /I$(GlibEtcInstallRoot)\lib\glib-2.0\include /I$(GlibEtcInstallRoot)\include /DHAVE_CONFIG_H /DG_DISABLE_SINGLE_INCLUDES /DATK_DISABLE_SINGLE_INCLUDES /DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES /DGTK_DISABLE_SINGLE_INCLUDES /D_USE_MATH_DEFINES /DINCLUDE_IM_am_et /DINCLUDE_IM_cedilla /DINCLUDE_IM_cyrillic_translit /DINCLUDE_IM_ime /DINCLUDE_IM_inuktitut /DINCLUDE_IM_ipa /DINCLUDE_IM_multipress /DINCLUDE_IM_thai /DINCLUDE_IM_ti_er /DINCLUDE_IM_ti_et /DINCLUDE_IM_viqr /DGTK_COMPILATION /DG_LOG_DOMAIN=\&quot;Gtk\&quot; /DGTK_HOST=\&quot;i686-pc-vs$(VSVer)\&quot; /DGTK_PRINT_BACKENDS=\&quot;file\&quot; /DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED /D$(GtkIncludedImmodulesDefines) /DGTK_LIBDIR=\&quot;$(GtkDummyPrefix)/lib\&quot; /DGTK_DATADIR=\&quot;$(GtkDummyPrefix)/share\&quot; /DGTK_DATA_PREFIX=\&quot;$(GtkDummyPrefix)\&quot; /DGTK_SYSCONFDIR=\&quot;$(GtkDummyPrefix)/etc\&quot; /DMULTIPRESS_CONFDIR=\&quot;$(GtkDummyPrefix)/etc/gtk-$(ApiVersion)\&quot; /DMULTIPRESS_LOCALEDIR=\&quot;$(GtkDummyPrefix)/share/locale\&quot; /DGTK_VERSION=\&quot;$(GtkVersion)\&quot; /DGTK_BINARY_VERSION=\&quot;$(GtkBinaryVersion)\&quot; /DGDK_DISABLE_DEPRECATED /DISOLATION_AWARE_ENABLED ..\..\..\gtk\gtktypefuncs.preproc.c &gt; ..\..\..\gtk\gtktypefuncs.combined.c&#x0D;&#x0A;
$(PythonDirX64)\python ..\gentypefuncs.py ..\..\..\gtk\gtktypefuncs.c ..\..\..\gtk\gtktypefuncs.combined.c&#x0D;&#x0A;
$(PythonDirX64)\python ..\..\..\gtk\gentypefuncs.py ..\..\..\gtk\gtktypefuncs.inc ..\..\..\gtk\gtktypefuncs.combined.c&#x0D;&#x0A;
del ..\..\..\gtk\gtktypefuncs.combined.c ..\..\..\gtk\gtktypefuncs.preproc.c&#x0D;&#x0A;
"
/>