From 46802d33e1c1f7bfeda3784eceedb4aae1459106 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Thu, 3 Apr 2014 15:49:05 +0800 Subject: [PATCH] Visual C++ Builds: Build Introspection for GdkWin32 Add support to build the introspection files for GdkWin32, as done recently in the autotools builds and clean up the NMake Makefile for building the introspection files a bit. For some reason, gdk_win32_display_manager_get_type() was not exported in gdk-3.0.lib, force its export, so that the GdkWin32-3.0.gir can be built properly with the Visual C++ builds. This is a known problem that some symbols in static libraries that are linked into a DLL in Visual C++, even if they were marked with __declspec(dllexport) via _GDK_EXTERN. --- build/gen-file-list-gtk.py | 20 ++++++- build/gtk-introspection-msvc.mak | 58 ++++++++++++------- build/win32/vs10/gtk-copy-gdk-broadway.props | 3 + build/win32/vs10/gtk-ignore-broadway.props | 1 + build/win32/vs9/gtk-copy-gdk-broadway.vsprops | 4 ++ build/win32/vs9/gtk-ignore-broadway.vsprops | 1 + 6 files changed, 63 insertions(+), 24 deletions(-) diff --git a/build/gen-file-list-gtk.py b/build/gen-file-list-gtk.py index 34a46fd1fc..f25cf4ae50 100644 --- a/build/gen-file-list-gtk.py +++ b/build/gen-file-list-gtk.py @@ -28,10 +28,23 @@ def gen_gdk_filelist(srcroot, subdir, dest): for i in sources: d.write(srcroot + '\\' + subdir + '\\' + i.replace('/', '\\') + '\n') -def gen_filelist_gtk(srcroot, subdir, dest): +def gen_gdkwin32_filelist(srcroot, subdir, dest): + vars = read_vars_from_AM(os.path.join(srcroot, subdir, 'Makefile.am'), + vars = {}, + conds = {'HAVE_INTROSPECTION': True, + 'OS_WIN32': True}, + filters = ['w32_introspection_files']) + + files = vars['w32_introspection_files'].split() + + with open(dest, 'w') as d: + for i in files: + d.write(srcroot + '\\' + subdir + '\\' + i.replace('/', '\\') + '\n') + +def gen_gtk_filelist(srcroot, subdir, dest): vars = read_vars_from_AM(os.path.join(srcroot, 'gtk', 'Makefile.am'), vars = {}, - conds = {'USE_WIN32':True, + conds = {'USE_WIN32': True, 'USE_QUARTZ': False, 'USE_X11': False, 'USE_EXTERNAL_ICON_CACHE': False}, @@ -60,7 +73,8 @@ def main(argv): subdir_gtk = 'gtk' gen_gdk_filelist(srcroot, subdir_gdk, 'gdk_list') - gen_filelist_gtk(srcroot, subdir_gtk, 'gtk_list') + gen_gdkwin32_filelist(srcroot, subdir_gdk, 'gdkwin32_list') + gen_gtk_filelist(srcroot, subdir_gtk, 'gtk_list') return 0 if __name__ == '__main__': diff --git a/build/gtk-introspection-msvc.mak b/build/gtk-introspection-msvc.mak index 2da6c48e67..ba6c4415fa 100644 --- a/build/gtk-introspection-msvc.mak +++ b/build/gtk-introspection-msvc.mak @@ -6,6 +6,9 @@ APIVERSION = 3.0 CHECK_PACKAGE = gdk-pixbuf-2.0 atk pangocairo gio-2.0 +built_install_girs = Gdk-$(APIVERSION).gir GdkWin32-$(APIVERSION).gir Gtk-$(APIVERSION).gir +built_install_typelibs = Gdk-$(APIVERSION).typelib GdkWin32-$(APIVERSION).typelib Gtk-$(APIVERSION).typelib + !if "$(PLAT)" == "x64" TIME_T_DEFINE = -Dtime_t=long long !else @@ -15,9 +18,9 @@ TIME_T_DEFINE = -Dtime_t=long !include introspection-msvc.mak !if "$(BUILD_INTROSPECTION)" == "TRUE" -all: setgirbuildnev Gdk-$(APIVERSION).gir Gdk-$(APIVERSION).typelib Gtk-$(APIVERSION).gir Gtk-$(APIVERSION).typelib +all: setgirbuildnev $(built_install_girs) $(built_install_typelibs) -gdk_list gtk_list: +gdk_list gdkwin32_list gtk_list: @-echo Generating Filelist to Introspect for GDK/GTK... $(PYTHON2) gen-file-list-gtk.py @@ -28,6 +31,10 @@ setgirbuildnev: @set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) @set LIB=win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(LIB) +win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkWin32-$(APIVERSION).lib: win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\gdk-$(APIVERSION).lib + @-echo Copying win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkWin32-$(APIVERSION).lib from win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\gdk-$(APIVERSION).lib... + @-copy /b win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\gdk-$(APIVERSION).lib win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkWin32-$(APIVERSION).lib + Gdk-$(APIVERSION).gir: gdk_list @-echo Generating Gdk-$(APIVERSION).gir... $(PYTHON2) $(G_IR_SCANNER) --verbose -I.. -I..\gdk \ @@ -41,7 +48,22 @@ Gdk-$(APIVERSION).gir: gdk_list --reparse-validate --add-include-path=$(G_IR_INCLUDEDIR) --add-include-path=. \ --pkg-export gdk-3.0 --warn-all --c-include="gdk/gdk.h" \ -DG_LOG_DOMAIN=\"Gdk\" -DGDK_COMPILATION \ - --filelist=gdk_list -o Gdk-3.0.gir + --filelist=gdk_list -o $@ + +GdkWin32-$(APIVERSION).gir: gdkwin32_list win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkWin32-$(APIVERSION).lib + @-echo Generating GdkWin32-$(APIVERSION).gir... + $(PYTHON2) $(G_IR_SCANNER) --verbose -I.. -I..\gdk \ + -I$(BASEDIR)\include\glib-2.0 -I$(BASEDIR)\lib\glib-2.0\include \ + -I$(BASEDIR)\include\pango-1.0 -I$(BASEDIR)\include\atk-1.0 \ + -I$(BASEDIR)\include\gdk-pixbuf-2.0 -I$(BASEDIR)\include \ + $(TIME_T_DEFINE) --namespace=GdkWin32 --nsversion=3.0 \ + --include=Gio-2.0 --include=GdkPixbuf-2.0 \ + --include=Pango-1.0 --include-uninstalled=./Gdk-$(APIVERSION).gir \ + --no-libtool --library=gdk-3.0 \ + --reparse-validate --add-include-path=$(G_IR_INCLUDEDIR) --add-include-path=. \ + --pkg-export gdk-win32-3.0 --warn-all --c-include="gdk/gdkwin32.h" \ + -DG_LOG_DOMAIN=\"Gdk\" -DGDK_COMPILATION \ + --filelist=gdkwin32_list -o $@ Gtk-$(APIVERSION).gir: gtk_list $(PYTHON2) $(G_IR_SCANNER) --verbose -I.. -I..\gtk -I..\gdk \ @@ -56,7 +78,7 @@ Gtk-$(APIVERSION).gir: gtk_list --pkg-export gtk+-3.0 --warn-all --c-include="gtk/gtkx.h" \ -DG_LOG_DOMAIN=\"Gtk\" -DGTK_LIBDIR=\"/dummy/lib\" \ $(TIME_T_DEFINE) -DGTK_DATADIR=\"/dummy/share\" -DGTK_DATA_PREFIX=\"/dummy\" \ - -DGTK_SYSCONFDIR=\"/dummy/etc\" -DGTK_VERSION=\"3.11.8\" \ + -DGTK_SYSCONFDIR=\"/dummy/etc\" -DGTK_VERSION=\"3.12.0\" \ -DGTK_BINARY_VERSION=\"3.0.0\" -DGTK_HOST=\"i686-pc-vs$(VSVER)\" \ -DGTK_COMPILATION -DGTK_PRINT_BACKENDS=\"file\" \ -DGTK_PRINT_PREVIEW_COMMAND=\"undefined-gtk-print-preview-command\" \ @@ -65,21 +87,15 @@ Gtk-$(APIVERSION).gir: gtk_list -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 --filelist=gtk_list \ - -o Gtk-3.0.gir + -o $@ -Gdk-$(APIVERSION).typelib: Gdk-$(APIVERSION).gir - @-echo Compiling Gdk-$(APIVERSION).typelib... - $(G_IR_COMPILER) --includedir=. --debug --verbose Gdk-$(APIVERSION).gir -o Gdk-$(APIVERSION).typelib +$(built_install_typelibs): $(built_install_girs) + @-echo Compiling $*.typelib... + @-$(G_IR_COMPILER) --includedir=. --debug --verbose $*.gir -o $@ -Gtk-$(APIVERSION).typelib: Gtk-$(APIVERSION).gir Gdk-$(APIVERSION).typelib - @-echo Compiling Gtk-$(APIVERSION).typelib... - $(G_IR_COMPILER) --includedir=. --debug --verbose Gtk-$(APIVERSION).gir -o Gtk-$(APIVERSION).typelib - -install-introspection: setgirbuildnev Gdk-$(APIVERSION).gir Gdk-$(APIVERSION).typelib Gtk-$(APIVERSION).gir Gtk-$(APIVERSION).typelib - @-copy Gdk-$(APIVERSION).gir $(G_IR_INCLUDEDIR) - @-copy /b Gdk-$(APIVERSION).typelib $(G_IR_TYPELIBDIR) - @-copy Gtk-$(APIVERSION).gir $(G_IR_INCLUDEDIR) - @-copy /b Gtk-$(APIVERSION).typelib $(G_IR_TYPELIBDIR) +install-introspection: setgirbuildnev $(built_install_girs) $(built_install_typelibs) + @-copy *.gir $(G_IR_INCLUDEDIR) + @-copy /b *.typelib $(G_IR_TYPELIBDIR) !else all: @@ -87,10 +103,10 @@ all: !endif clean: - @-del /f/q Gtk-$(APIVERSION).typelib - @-del /f/q Gtk-$(APIVERSION).gir - @-del /f/q Gdk-$(APIVERSION).typelib - @-del /f/q Gdk-$(APIVERSION).gir + @-del /f/q *.typelib + @-del /f/q *.gir + @-del /f/q win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkWin32-$(APIVERSION).lib @-del /f/q gtk_list + @-del /f/q gdkwin32_list @-del /f/q gdk_list @-del /f/q *.pyc diff --git a/build/win32/vs10/gtk-copy-gdk-broadway.props b/build/win32/vs10/gtk-copy-gdk-broadway.props index d62e744146..65279ca45e 100644 --- a/build/win32/vs10/gtk-copy-gdk-broadway.props +++ b/build/win32/vs10/gtk-copy-gdk-broadway.props @@ -7,6 +7,9 @@ <_PropertySheetDisplayName>gtkcopygdkbroadwayprops + + /EXPORT:gdk_win32_display_manager_get_type + if "$(Configuration)" == "Release" goto END diff --git a/build/win32/vs10/gtk-ignore-broadway.props b/build/win32/vs10/gtk-ignore-broadway.props index cbe02f7774..f86c36b191 100644 --- a/build/win32/vs10/gtk-ignore-broadway.props +++ b/build/win32/vs10/gtk-ignore-broadway.props @@ -12,6 +12,7 @@ $(OutDir)\gdk-win32.lib;%(AdditionalDependencies) + /EXPORT:gdk_win32_display_manager_get_type \ No newline at end of file diff --git a/build/win32/vs9/gtk-copy-gdk-broadway.vsprops b/build/win32/vs9/gtk-copy-gdk-broadway.vsprops index 148dab2220..93161c3811 100644 --- a/build/win32/vs9/gtk-copy-gdk-broadway.vsprops +++ b/build/win32/vs9/gtk-copy-gdk-broadway.vsprops @@ -5,6 +5,10 @@ Name="gtkcopygdkbroadwayprops" InheritedPropertySheets=".\gtk-build-defines.vsprops" > + \ No newline at end of file