[pango] MSVC Builds: Use Autotools Module for Introspection



commit e89c467538b89f1c9a4c29ec6e5d703279ff845c
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Sep 4 17:38:24 2015 +0800

    MSVC Builds: Use Autotools Module for Introspection
    
    This uses the newly-added autotools module so that the file list
    for introspection using Visual Studio is now generated during
    'make dist', along with the g-ir-scanner command line to generate
    the .gir files and the compilation of the .typelib files.
    
    This would help to simplify maintenance of the introspection
    builds in Visual Studio, which is done using NMake.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764984

 build/Makefile.am                        |    6 -
 build/gen-file-list-pango.py             |  161 ------------------------------
 build/introspection-msvc.mak             |   65 ------------
 build/pango-introspection-msvc.mak       |   97 ------------------
 build/win32/Makefile.am                  |   30 ++++++-
 build/{ => win32}/detectenv-msvc.mak     |   21 +++-
 build/win32/introspection-msvc.mak       |   94 +++++++++++++++++
 build/win32/pango-introspection-msvc.mak |   53 ++++++++++
 pango/Makefile.am                        |   47 +++++++++-
 9 files changed, 238 insertions(+), 336 deletions(-)
---
diff --git a/build/Makefile.am b/build/Makefile.am
index d562d7a..73e7a6f 100644
--- a/build/Makefile.am
+++ b/build/Makefile.am
@@ -1,9 +1,3 @@
 SUBDIRS = win32
 
-EXTRA_DIST = \
-       pango-introspection-msvc.mak    \
-       introspection-msvc.mak  \
-       detectenv-msvc.mak      \
-       gen-file-list-pango.py
-
 -include $(top_srcdir)/git.mk
diff --git a/build/win32/Makefile.am b/build/win32/Makefile.am
index 0a33798..71e5b47 100644
--- a/build/win32/Makefile.am
+++ b/build/win32/Makefile.am
@@ -1,3 +1,27 @@
+if HAVE_INTROSPECTION
+GENERATED_ITEMS = \
+       introspection.body.mak  \
+       Pango_1_0_gir_list              \
+       PangoCairo_1_0_gir_list
+
+MSVC_INTROSPECTION_INTERMEDIATE_FILES = PangoCairo-1.0.gir.msvc.introspect Pango-1.0.gir.msvc.introspect
+
+introspection.body.mak: $(MSVC_INTROSPECTION_INTERMEDIATE_FILES)
+       -$(RM) introspection.body.mak
+       for F in `ls *.msvc.introspect`; do \
+               case $$F in \
+                       *)      cat $(top_builddir)/build/win32/$$F >>introspection.body.mak \
+                       ;; \
+               esac; \
+       done
+       $(RM) $(MSVC_INTROSPECTION_INTERMEDIATE_FILES)
+
+DISTCLEANFILES = $(GENERATED_ITEMS)
+
+else
+GENERATED_ITEMS =
+endif
+
 SUBDIRS =      \
        vs9     \
        vs10    \
@@ -6,6 +30,10 @@ SUBDIRS =     \
        vs14
 
 EXTRA_DIST =   \
-       unistd.h
+       unistd.h        \
+       pango-introspection-msvc.mak    \
+       introspection-msvc.mak  \
+       detectenv-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 020548a..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"
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/build/win32/pango-introspection-msvc.mak b/build/win32/pango-introspection-msvc.mak
new file mode 100644
index 0000000..b2961a7
--- /dev/null
+++ b/build/win32/pango-introspection-msvc.mak
@@ -0,0 +1,53 @@
+# NMake Makefile to build Introspection Files for Pango
+
+!include detectenv-msvc.mak
+
+APIVERSION = 1.0
+
+CHECK_PACKAGE = gobject-2.0 cairo
+
+!include introspection-msvc.mak
+
+!if "$(BUILD_INTROSPECTION)" == "TRUE"
+!if "$(BUILD_PANGOFT2_INTROSPECTION)" == "1"
+
+# Build of PangoFT2 introspection files is not currently supported.
+PangoFT2LIBS = --library=pangoft2-1.0
+PangoFT2GIR = --include-uninstalled=./PangoFT2-$(APIVERSION)
+
+all: setbuildenv Pango-$(APIVERSION).gir Pango-$(APIVERSION).typelib PangoFT2-$(APIVERSION).gir 
PangoFT2-$(APIVERSION).typelib PangoCairo-$(APIVERSION).gir PangoCairo-$(APIVERSION).typelib
+
+!else
+
+PangoFT2LIBS =
+PangoFT2GIR =
+
+all: setbuildenv Pango-$(APIVERSION).gir Pango-$(APIVERSION).typelib PangoCairo-$(APIVERSION).gir 
PangoCairo-$(APIVERSION).typelib
+
+install-introspection: setbuildenv Pango-$(APIVERSION).gir Pango-$(APIVERSION).typelib 
PangoCairo-$(APIVERSION).gir PangoCairo-$(APIVERSION).typelib
+       @-copy Pango-$(APIVERSION).gir $(G_IR_INCLUDEDIR)
+       @-copy /b Pango-$(APIVERSION).typelib $(G_IR_TYPELIBDIR)
+       @-copy PangoCairo-$(APIVERSION).gir $(G_IR_INCLUDEDIR)
+       @-copy /b PangoCairo-$(APIVERSION).typelib $(G_IR_TYPELIBDIR)
+!endif
+
+setbuildenv:
+       @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;$(PREFIX)\lib;$(LIB)
+
+!include introspection.body.mak
+
+!else
+all:
+       @-echo $(ERROR_MSG)
+!endif
+
+clean:
+       @-del /f/q PangoCairo-$(APIVERSION).typelib
+       @-del /f/q PangoCairo-$(APIVERSION).gir
+       @-del /f/q PangoFT2-$(APIVERSION).typelib
+       @-del /f/q PangoFT2-$(APIVERSION).gir
+       @-del /f/q Pango-$(APIVERSION).typelib
+       @-del /f/q Pango-$(APIVERSION).gir
diff --git a/pango/Makefile.am b/pango/Makefile.am
index 832df3f..eca0d8b 100644
--- a/pango/Makefile.am
+++ b/pango/Makefile.am
@@ -495,12 +495,57 @@ pangocairo_EXCLUDES = dummy
 
 include $(top_srcdir)/build/Makefile.msvcproj
 
+if HAVE_INTROSPECTION
+# Introspection Items for MSVC
+MSVC_INTROSPECT_GIRS = Pango-1.0.gir PangoCairo-1.0.gir
+
+BASE_MSVC_GIR_CFLAGS =                 \
+       -DG_LOG_DOMAIN=\"Pango\"        \
+       -DPANGO_ENABLE_BACKEND          \
+       -DPANGO_ENABLE_ENGINE
+
+INTROSPECTION_INTERMEDIATE_ITEMS = \
+       $(top_builddir)/build/win32/Pango-1.0.gir.msvc.introspect               \
+       $(top_builddir)/build/win32/Pango_1_0_gir_list                  \
+       $(top_builddir)/build/win32/PangoCairo-1.0.gir.msvc.introspect  \
+       $(top_builddir)/build/win32/PangoCairo_1_0_gir_list
+
+Pango_1_0_gir_MSVC_FILES = $(Pango_1_0_gir_FILES)
+Pango_1_0_gir_MSVC_PACKAGES = gobject-2.0 cairo glib-2.0
+Pango_1_0_gir_MSVC_EXPORT_PACKAGES = $(Pango_1_0_gir_EXPORT_PACKAGES)
+Pango_1_0_gir_MSVC_INCLUDE_GIRS = $(Pango_1_0_gir_INCLUDES)
+Pango_1_0_gir_MSVC_LIBS = pango-1.0
+Pango_1_0_gir_MSVC_CFLAGS = -I../.. $(BASE_MSVC_GIR_CFLAGS)
+Pango_1_0_gir_MSVC_SCANNERFLAGS = $(Pango_1_0_gir_SCANNERFLAGS)
+
+pangocairo_msvc_introspection_files =  \
+       $(pangocairo_core_sources)      \
+       pangocairo-win32font.c          \
+       pangocairo-win32fontmap.c       \
+       pangocairo-win32.h              \
+       $(pangocairo_headers)
+
+PangoCairo_1_0_gir_MSVC_FILES = $(filter-out %-private.h, $(pangocairo_msvc_introspection_files))
+PangoCairo_1_0_gir_MSVC_GIR_DEPS = Pango-1.0.gir
+PangoCairo_1_0_gir_MSVC_PACKAGES = $(PangoCairo_1_0_gir_PACKAGES)
+PangoCairo_1_0_gir_MSVC_EXPORT_PACKAGES = $(PangoCairo_1_0_gir_EXPORT_PACKAGES)
+PangoCairo_1_0_gir_MSVC_INCLUDE_GIRS = $(PangoCairo_1_0_gir_INCLUDES) win32-1.0
+PangoCairo_1_0_gir_MSVC_LIBS = $(Pango_1_0_gir_MSVC_LIBS) pangocairo-1.0
+PangoCairo_1_0_gir_MSVC_CFLAGS = $(Pango_1_0_gir_MSVC_CFLAGS)
+PangoCairo_1_0_gir_MSVC_SCANNERFLAGS = --include-uninstalled=./Pango-1.0.gir --c-include "pango/pangocairo.h"
+
+include $(top_srcdir)/build/Makefile.msvc-introspection
+else
+INTROSPECTION_INTERMEDIATE_ITEMS =
+endif
+
 dist-hook: \
        $(top_builddir)/build/win32/vs9/pango.vcproj            \
        $(top_builddir)/build/win32/vs9/pangowin32.vcproj       \
        $(top_builddir)/build/win32/vs9/pangoft2.vcproj         \
        $(top_builddir)/build/win32/vs9/pangocairo.vcproj       \
-       $(top_builddir)/build/win32/vs9/pango.headers
+       $(top_builddir)/build/win32/vs9/pango.headers           \
+       $(INTROSPECTION_INTERMEDIATE_ITEMS)
 
 TESTS = check.defs
 


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