[atk] MSVC Builds: Generate the Introspection Build Commands



commit d7b5fb069ef764bb6e420a6ed98afad0d1f42991
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Sep 16 11:52:33 2015 +0800

    MSVC Builds: Generate the Introspection Build Commands
    
    This uses the common autotools module that was added in the previous commit
    to generate the command lines used to generate the .gir and compile the
    .typelib files, as well as the file list that is to be consumed during the
    generation of the .gir files.
    
    This also makes the detectmsvc-msvc.mak and introspection-msvc.mak NMake
    modules the same as the ones in $(glib_srcroot)/build/win32 and
    $(gi_srcroot)/build/win32 respectively, so that they may be copied from
    these locations when they are updated.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764983

 atk/Makefile.am                        |   35 +++++-
 build/Makefile.am                      |   10 +-
 build/atk-introspection-msvc.mak       |   50 -------
 build/gen-file-list-atk.py             |   35 -----
 build/introspection-msvc.mak           |   65 --------
 build/msvcfiles.py                     |  254 --------------------------------
 build/win32/Makefile.am                |   29 ++++-
 build/win32/atk-introspection-msvc.mak |   34 +++++
 build/{ => win32}/detectenv-msvc.mak   |   28 ++--
 build/win32/introspection-msvc.mak     |   94 ++++++++++++
 tests/testatk_vc.mak                   |    6 +
 11 files changed, 213 insertions(+), 427 deletions(-)
---
diff --git a/atk/Makefile.am b/atk/Makefile.am
index c194e82..875f616 100644
--- a/atk/Makefile.am
+++ b/atk/Makefile.am
@@ -217,9 +217,42 @@ atk_HEADERS_EXCLUDES = $(top_builddir)/atk/atkversion.h
 
 include $(top_srcdir)/build/Makefile.msvcproj
 
+if HAVE_INTROSPECTION
+# Introspection Items for MSVC
+MSVC_INTROSPECT_GIRS = Atk-1.0.gir
+
+INTROSPECTION_INTERMEDIATE_ITEMS = \
+       $(top_builddir)/build/win32/Atk-1.0.gir.msvc.introspect \
+       $(top_builddir)/build/win32/Atk_1_0_gir_list
+
+Atk_1_0_gir_MSVC_EXPORT_PACKAGES = atk
+Atk_1_0_gir_MSVC_INCLUDE_GIRS = $(Atk_1_0_gir_INCLUDES)
+Atk_1_0_gir_MSVC_LIBS = atk-1.0
+Atk_1_0_gir_MSVC_FILES =               \
+       $(introspection_sources)        \
+       atkversion.h                    \
+       atk-enum-types.c                \
+       atk-enum-types.h
+
+Atk_1_0_gir_MSVC_CFLAGS =              \
+       -I../..                         \
+       -DG_DISABLE_DEPRECATED  \
+       -DATK_DISABLE_DEPRECATED        \
+       -DATK_COMPILATION       \
+       -DATK_LOCALEDIR="\\\"/dummy/share/locale\\\""
+
+Atk_1_0_gir_MSVC_SCANNERFLAGS = --warn-all --c-include "atk/atk.h"
+
+include $(top_srcdir)/build/Makefile.msvc-introspection
+
+else
+INTROSPECTION_INTERMEDIATE_ITEMS =
+endif
+
 dist-hook: \
        $(top_builddir)/build/win32/vs9/atk.vcproj      \
-       $(top_builddir)/build/win32/vs9/atk.headers
+       $(top_builddir)/build/win32/vs9/atk.headers     \
+       $(INTROSPECTION_INTERMEDIATE_ITEMS)
 
 distclean-local:
        if test $(srcdir) = .; then :; else \
diff --git a/build/Makefile.am b/build/Makefile.am
index 583966b..f5bfe80 100644
--- a/build/Makefile.am
+++ b/build/Makefile.am
@@ -1,10 +1,2 @@
-SUBDIRS = \
-       win32
-
-EXTRA_DIST =   \
-       msvcfiles.py    \
-       detectenv-msvc.mak      \
-       introspection-msvc.mak  \
-       atk-introspection-msvc.mak      \
-       gen-file-list-atk.py
+SUBDIRS = win32
 
diff --git a/build/win32/Makefile.am b/build/win32/Makefile.am
index 897dc8b..39eca58 100644
--- a/build/win32/Makefile.am
+++ b/build/win32/Makefile.am
@@ -1,6 +1,33 @@
-SUBDIRS =      \
+if HAVE_INTROSPECTION
+GENERATED_ITEMS = \
+       introspection.body.mak  \
+       Atk_1_0_gir_list
+
+introspection.body.mak: Atk-1.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) Atk-1.0.gir.msvc.introspect
+
+DISTCLEANFILES = $(GENERATED_ITEMS)
+
+else
+GENERATED_ITEMS =
+endif
+
+SUBDIRS =      \
        vs9     \
        vs10    \
        vs11    \
        vs12    \
        vs14
+
+EXTRA_DIST =   \
+       detectenv-msvc.mak      \
+       introspection-msvc.mak  \
+       atk-introspection-msvc.mak      \
+       $(GENERATED_ITEMS)
diff --git a/build/win32/atk-introspection-msvc.mak b/build/win32/atk-introspection-msvc.mak
new file mode 100644
index 0000000..8bc734f
--- /dev/null
+++ b/build/win32/atk-introspection-msvc.mak
@@ -0,0 +1,34 @@
+# NMake Makefile to build Introspection Files for ATK
+
+!include detectenv-msvc.mak
+
+APIVERSION = 1.0
+
+CHECK_PACKAGE = gobject-2.0
+
+!include introspection-msvc.mak
+
+!if "$(BUILD_INTROSPECTION)" == "TRUE"
+all: setgirbuildenv Atk-$(APIVERSION).gir Atk-$(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 Atk-$(APIVERSION).gir $(G_IR_INCLUDEDIR)
+       @-copy /b Atk-$(APIVERSION).typelib $(G_IR_TYPELIBDIR)
+
+!else
+all:
+       @-echo $(ERROR_MSG)
+!endif
+
+clean:
+       @-del /f/q Atk-$(APIVERSION).typelib
+       @-del /f/q Atk-$(APIVERSION).gir
+       @-del /f/q *.pyc
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/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/tests/testatk_vc.mak b/tests/testatk_vc.mak
index 39aeee0..17e2a7a 100644
--- a/tests/testatk_vc.mak
+++ b/tests/testatk_vc.mak
@@ -1,5 +1,11 @@
 !include ..\build\detectenv-msvc.mak
 
+LD_CFLAGS = /link
+EXEEXT = .exe
+GLIB_LIBS = gobject-2.0.lib gmodule-2.0.lib glib-2.0.lib
+
+ATK_API_VERSION = 1.0
+
 BUILD_PATH = ..\build\win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin
 LDFLAGS_PATH = /libpath:$(BUILD_PATH) /libpath:..\..\vs$(VSVER)\$(PLAT)\lib
 


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