[gdk-pixbuf] MSVC Builds: Generate the Introspection Commands



commit 0a4d00c8d64105131d14cd743600706a96094790
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Sep 15 15:09:01 2015 +0800

    MSVC Builds: Generate the Introspection Commands
    
    Use the autotools module that was added in the previous commit so that
    we can use it to generate the file list for introspection at 'make dist',
    as well as the command lines for g-ir-scanner and g-ir-compiler to
    generate the .gir files and to compile the .typelib files.
    
    This also makes detectenv-msvc.mak and introspection-msvc.mak generic so that
    they may be respectively updated from $(glib_srcroot)/build/win32 and
    $(gi_srcroot)/build/win32, as they are now copies of them.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765034

 build/Makefile.am                             |    9 +--
 build/gdk-pixbuf-introspection-msvc.mak       |   56 -------------
 build/gen-file-list-gdkpixbuf.py              |  109 -------------------------
 build/introspection-msvc.mak                  |   65 ---------------
 build/win32/Makefile.am                       |   27 ++++++
 build/{ => win32}/detectenv-msvc.mak          |   28 ++++---
 build/win32/gdk-pixbuf-introspection-msvc.mak |   35 ++++++++
 build/win32/introspection-msvc.mak            |   94 +++++++++++++++++++++
 gdk-pixbuf/Makefile.am                        |   31 +++++++-
 9 files changed, 202 insertions(+), 252 deletions(-)
---
diff --git a/build/Makefile.am b/build/Makefile.am
index f24715b..73e7a6f 100644
--- a/build/Makefile.am
+++ b/build/Makefile.am
@@ -1,10 +1,3 @@
-SUBDIRS = \
-       win32
-
-EXTRA_DIST =   \
-       detectenv-msvc.mak      \
-       introspection-msvc.mak  \
-       gdk-pixbuf-introspection-msvc.mak       \
-       gen-file-list-gdkpixbuf.py
+SUBDIRS = win32
 
 -include $(top_srcdir)/git.mk
diff --git a/build/win32/Makefile.am b/build/win32/Makefile.am
index 6a7b4b1..4ce78ec 100644
--- a/build/win32/Makefile.am
+++ b/build/win32/Makefile.am
@@ -1,3 +1,24 @@
+if HAVE_INTROSPECTION
+GENERATED_ITEMS = \
+       introspection.body.mak  \
+       GdkPixbuf_2_0_gir_list
+
+introspection.body.mak: GdkPixbuf-2.0.gir.msvc.introspect
+       -$(RM) introspection.body.mak
+       for F in `ls *.msvc.introspect`; do \
+               case $$F in \
+                       *)      cat $(top_builddir)/build/win32/$$F >>$@ \
+                       ;; \
+               esac; \
+       done
+       $(RM) GdkPixbuf-2.0.gir.msvc.introspect
+
+DISTCLEANFILES = $(GENERATED_ITEMS)
+
+else
+GENERATED_ITEMS =
+endif
+
 SUBDIRS =      \
        vs9     \
        vs10    \
@@ -5,4 +26,10 @@ SUBDIRS =     \
        vs12    \
        vs14
 
+EXTRA_DIST =   \
+       detectenv-msvc.mak                      \
+       introspection-msvc.mak          \
+       gdk-pixbuf-introspection-msvc.mak       \
+       $(GENERATED_ITEMS)
+
 -include $(top_srcdir)/git.mk
diff --git a/build/detectenv-msvc.mak b/build/win32/detectenv-msvc.mak
similarity index 68%
rename from build/detectenv-msvc.mak
rename to build/win32/detectenv-msvc.mak
index 06c908e..61f979d 100644
--- a/build/detectenv-msvc.mak
+++ b/build/win32/detectenv-msvc.mak
@@ -1,3 +1,8 @@
+# Common NMake Makefile module for checking the build environment
+# This can be copied from $(glib_srcroot)\build\win32 for GNOME items
+# that support MSVC builds and introspection under MSVC, and can be used
+# for building test programs as well.
+
 # Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
 # VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
 !if !defined(VCINSTALLDIR) && !defined(WINDOWSSDKDIR)
@@ -35,6 +40,8 @@ VSVER = 10
 VSVER = 11
 !elseif $(VCVERSION) > 1799 && $(VCVERSION) < 1900
 VSVER = 12
+!elseif $(VCVERSION) > 1899 && $(VCVERSION) < 2000
+VSVER = 14
 !else
 VSVER = 0
 !endif
@@ -42,20 +49,24 @@ VSVER = 0
 !if "$(VSVER)" == "0"
 MSG = ^
 This NMake Makefile set supports Visual Studio^
-9 (2008) through 12 (2013).  Your Visual Studio^
+9 (2008) through 14 (2015).  Your Visual Studio^
 version is not supported.
 !error $(MSG)
 !endif
 
 VALID_CFGSET = FALSE
-!if "$(CFG)" == "release" || "$(CFG)" == "debug"
+!if "$(CFG)" == "release" || "$(CFG)" == "debug" || "$(CFG)" == "Release" || "$(CFG)" == "Debug"
 VALID_CFGSET = TRUE
 !endif
 
-!if "$(CFG)" == "release"
-CFLAGS_ADD = /MD /O2
+# We want debugging symbols logged for all builds,
+# using .pdb files for release builds
+CFLAGS_BASE = /Zi
+
+!if "$(CFG)" == "release" || "$(CFG)" == "Release"
+CFLAGS_ADD = /MD /O2 $(CFLAGS_BASE)
 !else
-CFLAGS_ADD = /MDd /Od /Zi
+CFLAGS_ADD = /MDd /Od $(CFLAGS_BASE)
 !endif
 
 !if "$(PLAT)" == "x64"
@@ -63,10 +74,3 @@ LDFLAGS_ARCH = /machine:x64
 !else
 LDFLAGS_ARCH = /machine:x86
 !endif
-
-LD = link.exe
-LD_CFLAGS = /link
-EXEEXT = .exe
-GLIB_LIBS = gobject-2.0.lib gmodule-2.0.lib glib-2.0.lib
-
-ATK_API_VERSION = 1.0
diff --git a/build/win32/gdk-pixbuf-introspection-msvc.mak b/build/win32/gdk-pixbuf-introspection-msvc.mak
new file mode 100644
index 0000000..850b8e9
--- /dev/null
+++ b/build/win32/gdk-pixbuf-introspection-msvc.mak
@@ -0,0 +1,35 @@
+# NMake Makefile to build Introspection Files for GDK-Pixbuf
+
+!include detectenv-msvc.mak
+
+APIVERSION = 2.0
+
+CHECK_PACKAGE = gio-2.0
+
+!include introspection-msvc.mak
+
+!if "$(BUILD_INTROSPECTION)" == "TRUE"
+all: setgirbuildenv GdkPixbuf-$(APIVERSION).gir GdkPixbuf-$(APIVERSION).typelib
+
+setgirbuildenv:
+       @-set PYTHONPATH=$(PREFIX)\lib\gobject-introspection
+       @-set PATH=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(PREFIX)\bin;$(PATH)
+       @-set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
+       @-set LIB=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(LIB)
+
+!include introspection.body.mak
+
+install-introspection: all
+       @-copy GdkPixbuf-$(APIVERSION).gir $(G_IR_INCLUDEDIR)
+       @-copy /b GdkPixbuf-$(APIVERSION).typelib $(G_IR_TYPELIBDIR)
+
+!else
+all:
+       @-echo $(ERROR_MSG)
+
+install-introspection: all
+!endif
+
+clean:
+       @-del /f/q GdkPixbuf-$(APIVERSION).typelib
+       @-del /f/q GdkPixbuf-$(APIVERSION).gir
diff --git a/build/win32/introspection-msvc.mak b/build/win32/introspection-msvc.mak
new file mode 100644
index 0000000..8739844
--- /dev/null
+++ b/build/win32/introspection-msvc.mak
@@ -0,0 +1,94 @@
+# Common NMake Makefile module for checking the build environment is sane
+# for building introspection files under MSVC/NMake.
+# This can be copied from $(gi_srcroot)\build\win32 for GNOME items
+# that support MSVC builds and introspection under MSVC.
+
+# Can override with env vars as needed
+# You will need to have built gobject-introspection for this to work.
+# Change or pass in or set the following to suit your environment
+
+!if "$(PREFIX)" == ""
+PREFIX = ..\..\..\vs$(VSVER)\$(PLAT)
+!endif
+
+!if ![setlocal]                && \
+    ![set PFX=$(PREFIX)]       && \
+    ![for %P in (%PFX%) do @echo PREFIX_FULL=%~dpnfP > pfx.x]
+!endif
+!include pfx.x
+
+!if "$(PKG_CONFIG_PATH)" == ""
+PKG_CONFIG_PATH=$(PREFIX_FULL)\lib\pkgconfig
+!else
+PKG_CONFIG_PATH=$(PREFIX_FULL)\lib\pkgconfig;$(PKG_CONFIG_PATH)
+!endif
+
+!if ![del $(ERRNUL) /q/f pfx.x]
+!endif
+
+# Note: The PYTHON must be the Python release series that was used to build
+# the GObject-introspection scanner Python module!
+# Either having python.exe your PATH will work or passing in
+# PYTHON=<full path to your Python interpretor> will do
+
+# This is required, and gobject-introspection needs to be built
+# before this can be successfully run.
+!if "$(PYTHON)" == ""
+PYTHON=python
+!endif
+
+# Path to the pkg-config tool, if not already in the PATH
+!if "$(PKG_CONFIG)" == ""
+PKG_CONFIG=pkg-config
+!endif
+
+# Don't change anything following this line!
+
+GIR_SUBDIR = share\gir-1.0
+GIR_TYPELIBDIR = lib\girepository-1.0
+G_IR_SCANNER = $(PREFIX)\bin\g-ir-scanner
+G_IR_COMPILER = $(PREFIX)\bin\g-ir-compiler.exe
+G_IR_INCLUDEDIR = $(PREFIX)\$(GIR_SUBDIR)
+G_IR_TYPELIBDIR = $(PREFIX)\$(GIR_TYPELIBDIR)
+
+VALID_PKG_CONFIG_PATH = FALSE
+
+MSG_INVALID_PKGCONFIG = You must set or specifiy a valid PKG_CONFIG_PATH
+MSG_INVALID_CFG = You need to specify or set CFG to be release or debug to use this Makefile to build the 
Introspection Files
+
+ERROR_MSG =
+
+BUILD_INTROSPECTION = TRUE
+
+!if ![set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)]  \
+       && ![$(PKG_CONFIG) --print-errors --errors-to-stdout $(CHECK_PACKAGE) > pkgconfig.x]    \
+       && ![setlocal]  \
+       && ![set file="pkgconfig.x"]    \
+       && ![FOR %A IN (%file%) DO @echo PKG_CHECK_SIZE=%~zA > pkgconfig.chksize]       \
+       && ![del $(ERRNUL) /q/f pkgconfig.x]
+!endif
+
+!include pkgconfig.chksize
+!if "$(PKG_CHECK_SIZE)" == "0"
+VALID_PKG_CONFIG_PATH = TRUE
+!else
+VALID_PKG_CONFIG_PATH = FALSE
+!endif
+
+!if ![del $(ERRNUL) /q/f pkgconfig.chksize]
+!endif
+
+VALID_CFGSET = FALSE
+!if "$(CFG)" == "release" || "$(CFG)" == "debug" || "$(CFG)" == "Release" || "$(CFG)" == "Debug"
+VALID_CFGSET = TRUE
+!endif
+
+!if "$(VALID_PKG_CONFIG_PATH)" != "TRUE"
+BUILD_INTROSPECTION = FALSE
+ERROR_MSG = $(MSG_INVALID_PKGCONFIG)
+!endif
+
+!if "$(VALID_CFGSET)" != "TRUE"
+BUILD_INTROSPECTION = FALSE
+ERROR_MSG = $(MSG_INVALID_CFG)
+!endif
diff --git a/gdk-pixbuf/Makefile.am b/gdk-pixbuf/Makefile.am
index ef88e9d..99dcf13 100644
--- a/gdk-pixbuf/Makefile.am
+++ b/gdk-pixbuf/Makefile.am
@@ -663,8 +663,6 @@ gdk_pixbuf_HEADERS_EXCLUDES = gdkpdummy
 
 include $(top_srcdir)/build/Makefile.msvcproj
 
-dist-hook: $(top_builddir)/build/win32/vs9/gdk-pixbuf.vcproj 
$(top_builddir)/build/win32/vs9/gdk-pixbuf.headers
-
 if HAVE_INTROSPECTION
 
 GdkPixbuf-2.0.gir: libgdk_pixbuf-2.0.la Makefile
@@ -690,8 +688,37 @@ typelibsdir = $(libdir)/girepository-1.0
 typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
 
 CLEANFILES += $(gir_DATA) $(typelibs_DATA)
+
+# --- MSVC Introspection Items ---
+
+MSVC_INTROSPECT_GIRS = GdkPixbuf-2.0.gir
+
+MSVC_INTROSPECTION_INTERMEDIATE_ITEMS = \
+       $(top_builddir)/build/win32/GdkPixbuf-2.0.gir.msvc.introspect   \
+       $(top_builddir)/build/win32/GdkPixbuf_2_0_gir_list
+
+GdkPixbuf_2_0_gir_MSVC_INCLUDE_GIRS = $(GdkPixbuf_2_0_gir_INCLUDES)
+GdkPixbuf_2_0_gir_MSVC_EXPORT_PACKAGES = $(GdkPixbuf_2_0_gir_EXPORT_PACKAGES)
+GdkPixbuf_2_0_gir_MSVC_LIBS = gdk_pixbuf-2.0
+GdkPixbuf_2_0_gir_MSVC_FILES = $(GdkPixbuf_2_0_gir_FILES)
+
+GdkPixbuf_2_0_gir_MSVC_CFLAGS =                \
+       -DGDK_PIXBUF_COMPILATION        \
+       -I../..                         \
+       -I../../gdk-pixbuf
+
+GdkPixbuf_2_0_gir_MSVC_SCANNERFLAGS = $(GdkPixbuf_2_0_gir_SCANNERFLAGS)
+
+include $(top_srcdir)/build/Makefile.msvc-introspection
+else
+MSVC_INTROSPECTION_INTERMEDIATE_ITEMS =
 endif
 
+dist-hook:     \
+       $(top_builddir)/build/win32/vs9/gdk-pixbuf.vcproj       \
+       $(top_builddir)/build/win32/vs9/gdk-pixbuf.headers      \
+       $(MSVC_INTROSPECTION_INTERMEDIATE_ITEMS)
+
 if CROSS_COMPILING
 RUN_QUERY_LOADER_TEST=false
 else


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