[atk] MSVC Builds: Rework Introspection Build



commit 653bd24c67a081c2bf0ea3fce7f5fe033cd7390d
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Jan 10 15:36:29 2014 +0800

    MSVC Builds: Rework Introspection Build
    
    The current approach of building the introspection files for ATK works, but
    is often cumbersome as one needs to set many environmental variables before
    launching a solution file, which runs a Windows batch script to generate
    the .gir/.typelib files.  It was also possible to hand-run the batch script
    from the Visual Studio command prompt, but even more environmental
    variables need to be set.
    
    This changes the approach to build the introspection files using an NMake
    Makefile (but elimating from the Visual Studio Project Files the part to
    build the introspection files) to:
    -Make it clearer to the person building the introspection files what
     environmental variables are needed, specifically for PKG_CONFIG_PATH and
     MINGWDIR and CFG (formerly CONF).  Setting stuff like VSVER, PLAT and
     BASEDIR is no longer required, which was a bit clunky.
    -Allows some more easier flexibility on the build of the intropsection
     files.
    
    This also cleans up the gen-file-list.py file as it can share parts in the
    recently-added msvcfiles.py

 build/Makefile.am                  |    5 +-
 build/atk-introspection-msvc.mak   |   54 ++++++++++++++++
 build/gen-file-list-atk.py         |   35 ++++++++++
 build/introspection-msvc.mak       |   79 +++++++++++++++++++++++
 build/win32/Makefile.am            |    4 -
 build/win32/gen-file-list-atk.py   |  112 --------------------------------
 build/win32/gengir.bat             |  123 ------------------------------------
 build/win32/vs10/Makefile.am       |    2 -
 build/win32/vs10/atk-gengir.props  |   26 --------
 build/win32/vs10/atk.sln           |    6 --
 build/win32/vs10/gengir.vcxproj    |  108 -------------------------------
 build/win32/vs9/Makefile.am        |    2 -
 build/win32/vs9/atk-gengir.vsprops |   21 ------
 build/win32/vs9/atk.sln            |    9 ---
 build/win32/vs9/gengir.vcproj      |   77 ----------------------
 15 files changed, 172 insertions(+), 491 deletions(-)
---
diff --git a/build/Makefile.am b/build/Makefile.am
index 3bbca43..334c8cf 100644
--- a/build/Makefile.am
+++ b/build/Makefile.am
@@ -4,5 +4,8 @@ SUBDIRS = \
 EXTRA_DIST =   \
        atk_msvc_files.py       \
        msvcfiles.py    \
-       testsrules_msvc.mak
+       testsrules_msvc.mak     \
+       introspection-msvc.mak
+       atk-introspection-msvc.mak      \
+       gen-file-list-atk.py
 
diff --git a/build/atk-introspection-msvc.mak b/build/atk-introspection-msvc.mak
new file mode 100644
index 0000000..0c20812
--- /dev/null
+++ b/build/atk-introspection-msvc.mak
@@ -0,0 +1,54 @@
+# NMake Makefile to build Introspection Files for ATK
+
+# Change or pass in as a variable/env var if needed
+DLLNAME = atk-1-vs$(VSVER)
+
+# Please do not change anything after this line
+
+!include testsrules_msvc.mak
+
+APIVERSION = 1.0
+
+CHECK_PACKAGE = gobject-2.0
+
+!include introspection-msvc.mak
+
+!if "$(BUILD_INTROSPECTION)" == "TRUE"
+all: Atk-$(APIVERSION).gir Atk-$(APIVERSION).typelib
+
+atk_list:
+       @-echo Generating Filelist to Introspect for ATK...
+       $(PYTHON2) gen-file-list-atk.py
+
+Atk-$(APIVERSION).gir: atk_list
+       @-echo Generating Atk-$(APIVERSION).gir...
+       @set CC=$(CC)
+       @set PYTHONPATH=$(BASEDIR)\lib\gobject-introspection
+       @set PATH=win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(PATH);$(MINGWDIR)\bin
+       @set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
+       $(PYTHON2) $(G_IR_SCANNER) --verbose -I.. --add-include-path=.. \
+       --namespace=Atk --nsversion=$(APIVERSION) --include=GObject-2.0 \
+       --no-libtool --pkg=glib-2.0 --library=$(DLLNAME)        \
+       --reparse-validate --add-include-path=$(G_IR_INCLUDEDIR)        \
+       --pkg-export atk --warn-all --c-include "atk/atk.h"     \
+       -DATK_DISABLE_DEPRECATED -DATK_COMPILATION -DATK_LOCALEDIR=\"/dummy/share/locale\"      \
+       --filelist=atk_list -o Atk-$(APIVERSION).gir
+
+Atk-$(APIVERSION).typelib: Atk-$(APIVERSION).gir
+       @-echo Compiling Atk-$(APIVERSION).typelib...
+       $(G_IR_COMPILER) --includedir=. --debug --verbose Atk-1.0.gir -o Atk-1.0.typelib
+
+install-introspection: Atk-$(APIVERSION).gir Atk-$(APIVERSION).typelib
+       @-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 atk_list
+       @-del /f/q *.pyc
diff --git a/build/gen-file-list-atk.py b/build/gen-file-list-atk.py
new file mode 100644
index 0000000..f008022
--- /dev/null
+++ b/build/gen-file-list-atk.py
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+# vim: encoding=utf-8
+# Generate the file lists for processing with g-ir-scanner
+import os
+import sys
+import re
+import string
+import subprocess
+import optparse
+
+from msvcfiles import read_vars_from_AM
+
+def gen_atk_filelist(srcroot, subdir, dest):
+    vars = read_vars_from_AM(os.path.join(srcroot, subdir, 'Makefile.am'),
+                             vars = {'top_builddir':'.'},
+                             conds = {'HAVE_INTROSPECTION':True},
+                             filters = ['introspection_sources', 'introspection_generated_sources'])
+
+    files = vars['introspection_sources'].split() + \
+            vars['introspection_generated_sources'].split()
+
+    with open(dest, 'w') as d:
+        for i in files:
+            if (i.startswith('./atk/')):
+                i = i.replace('./atk/','')
+            d.write(srcroot + '\\' + subdir + '\\' + i.replace('/', '\\') + '\n')
+
+def main(argv):
+    srcroot = os.path.join('..')
+    subdir = 'atk'
+    gen_atk_filelist(srcroot, subdir, 'atk_list')
+    return 0
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/build/introspection-msvc.mak b/build/introspection-msvc.mak
new file mode 100644
index 0000000..3670c2f
--- /dev/null
+++ b/build/introspection-msvc.mak
@@ -0,0 +1,79 @@
+# Common Utility NMake Makefile Template
+# Used to Generate Introspection files for various Projects
+
+# 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
+
+BASEDIR = ..\..\vs$(VSVER)\$(PLAT)
+GIR_SUBDIR = share\gir-1.0
+GIR_SUBDIR = share\gir-1.0
+G_IR_SCANNER = $(BASEDIR)\bin\g-ir-scanner
+G_IR_COMPILER = $(BASEDIR)\bin\g-ir-compiler.exe
+G_IR_INCLUDEDIR = $(BASEDIR)\$(GIR_SUBDIR)
+G_IR_TYPELIBDIR = $(BASEDIR)\$(GIR_SUBDIR)
+
+# Note: The PYTHON2 must be a Python 2.6.x or 2.7.x Interpretor!
+# Either having python.exe from Python 2.6.x/2.7.x in your PATH will work
+# or passing in PYTHON2=<full path to your Python 2.6.x/2.7.x interpretor> will do
+
+# This is required, and gobject-introspection needs to be built
+# before this can be successfully run.
+PYTHON2=python
+
+# Don't change anything following this line!
+VALID_PKG_CONFIG_PATH = FALSE
+VALID_GCC_INSTPATH = FALSE
+
+MSG_INVALID_PKGCONFIG = You must set or specifiy a valid PKG_CONFIG_PATH
+MSG_INVALID_MINGWDIR = You must set or specifiy a valid MINGWDIR, where gcc.exe can be found in 
%MINGWDIR%\bin
+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 ![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 ![IF EXIST %MINGWDIR%\bin\gcc.exe @echo VALID_GCC_INSTPATH=TRUE > gcccheck.x]
+!endif
+
+!if ![IF NOT EXIST %MINGWDIR%\bin\gcc.exe @echo VALID_GCC_INSTPATH=FALSE > gcccheck.x]
+!endif
+
+!include gcccheck.x
+
+!if ![del $(ERRNUL) /q/f pkgconfig.chksize gcccheck.x]
+!endif
+
+VALID_CFGSET = FALSE
+!if "$(CFG)" == "release" || "$(CFG)" == "debug"
+VALID_CFGSET = TRUE
+!endif
+
+!if "$(VALID_GCC_INSTPATH)" != "TRUE"
+BUILD_INTROSPECTION = FALSE
+ERROR_MSG = $(MSG_INVALID_MINGWDIR)
+!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/Makefile.am b/build/win32/Makefile.am
index 4eff83d..e013d16 100644
--- a/build/win32/Makefile.am
+++ b/build/win32/Makefile.am
@@ -1,7 +1,3 @@
 SUBDIRS =      \
        vs9  \
        vs10
-
-EXTRA_DIST =   \
-       gengir.bat      \
-       gen-file-list-atk.py
diff --git a/build/win32/vs10/Makefile.am b/build/win32/vs10/Makefile.am
index 34f1c58..71329c6 100644
--- a/build/win32/vs10/Makefile.am
+++ b/build/win32/vs10/Makefile.am
@@ -6,10 +6,8 @@ EXTRA_DIST =   \
        atk.vcxproj.filters     \
        atk.vcxproj.filtersin   \
        install.vcxproj \
-       gengir.vcxproj  \
        atk-build-defines.props \
        atk-gen-src.props       \
-       atk-gengir.props        \
        atk-install.props       \
        atk-install.propsin     \
        atk-version-paths.props
diff --git a/build/win32/vs10/atk.sln b/build/win32/vs10/atk.sln
index d439412..55d5531 100644
--- a/build/win32/vs10/atk.sln
+++ b/build/win32/vs10/atk.sln
@@ -5,8 +5,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "atk", "atk.vcxproj", "{86EA
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "install", "install.vcxproj", 
"{00702787-1566-484D-991F-3E7E459BB909}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gengir", "gengir.vcxproj", 
"{2093D218-190E-4194-9421-3BA7CBF33B15}"
-EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Win32 = Debug|Win32
@@ -31,10 +29,6 @@ Global
                {00702787-1566-484D-991F-3E7E459BB909}.Release|Win32.Build.0 = Release|Win32
                {00702787-1566-484D-991F-3E7E459BB909}.Release|x64.ActiveCfg = Release|x64
                {00702787-1566-484D-991F-3E7E459BB909}.Release|x64.Build.0 = Release|x64
-               {2093D218-190E-4194-9421-3BA7CBF33B15}.Debug|Win32.ActiveCfg = Debug|Win32
-               {2093D218-190E-4194-9421-3BA7CBF33B15}.Debug|x64.ActiveCfg = Debug|x64
-               {2093D218-190E-4194-9421-3BA7CBF33B15}.Release|Win32.ActiveCfg = Release|Win32
-               {2093D218-190E-4194-9421-3BA7CBF33B15}.Release|x64.ActiveCfg = Release|x64
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
diff --git a/build/win32/vs9/Makefile.am b/build/win32/vs9/Makefile.am
index f7ed4f5..02185a3 100644
--- a/build/win32/vs9/Makefile.am
+++ b/build/win32/vs9/Makefile.am
@@ -4,10 +4,8 @@ EXTRA_DIST =   \
        atk.vcproj      \
        atk.vcprojin    \
        install.vcproj  \
-       gengir.vcproj   \
        atk-build-defines.vsprops       \
        atk-gen-src.vsprops     \
-       atk-gengir.vsprops      \
        atk-install.vsprops     \
        atk-install.vspropsin   \
        atk-version-paths.vsprops
diff --git a/build/win32/vs9/atk.sln b/build/win32/vs9/atk.sln
index 1cc5759..d2c9af7 100644
--- a/build/win32/vs9/atk.sln
+++ b/build/win32/vs9/atk.sln
@@ -8,11 +8,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "install", "install.vcproj",
                {86EACD59-F69F-4AAD-854B-AA03D5447360} = {86EACD59-F69F-4AAD-854B-AA03D5447360}
        EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gengir", "gengir.vcproj", 
"{2093D218-190E-4194-9421-3BA7CBF33B15}"
-       ProjectSection(ProjectDependencies) = postProject
-               {86EACD59-F69F-4AAD-854B-AA03D5447360} = {86EACD59-F69F-4AAD-854B-AA03D5447360}
-       EndProjectSection
-EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Win32 = Debug|Win32
@@ -37,10 +32,6 @@ Global
                {00702787-1566-484D-991F-3E7E459BB909}.Debug|x64.Build.0 = Debug|x64
                {00702787-1566-484D-991F-3E7E459BB909}.Release|x64.ActiveCfg = Release|x64
                {00702787-1566-484D-991F-3E7E459BB909}.Release|x64.Build.0 = Release|x64
-               {2093D218-190E-4194-9421-3BA7CBF33B15}.Debug|Win32.ActiveCfg = Debug|Win32
-               {2093D218-190E-4194-9421-3BA7CBF33B15}.Release|Win32.ActiveCfg = Release|Win32
-               {2093D218-190E-4194-9421-3BA7CBF33B15}.Debug|x64.ActiveCfg = Debug|x64
-               {2093D218-190E-4194-9421-3BA7CBF33B15}.Release|x64.ActiveCfg = Release|x64
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE


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