[gdk-pixbuf] MSVC builds: Add NMake Makefile for Introspection Builds
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] MSVC builds: Add NMake Makefile for Introspection Builds
- Date: Tue, 25 Feb 2014 07:36:29 +0000 (UTC)
commit 74b1145b1f271fd3593caf9ab776aaf78d5060cc
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Tue Feb 25 15:36:18 2014 +0800
MSVC builds: Add NMake Makefile for Introspection Builds
This adds an NMake Makefile that is used to generate the introspection
files for GDK-Pixbuf, which replaces the previous approach of generating
them via the Visual Studio Projects. This makes it clearer to people on
what things are needed in order to build the introspection files if so
desired, and makes things a bit cleaner as the build results can be
cleaned away easily. This also takes the recent change in g-i into
account, where we no longer pass in the DLL file name but instead pass in
the library name on Windows, just as it was done on *nix.
The existing .bat file for this purpose is removed as a result.
build/Makefile.am | 6 +
build/detectenv-msvc.mak | 72 ++++++++++++++
build/gdk-pixbuf-introspection-msvc.mak | 61 ++++++++++++
build/{win32 => }/gen-file-list-gdkpixbuf.py | 2 +-
build/introspection-msvc.mak | 79 +++++++++++++++
build/win32/Makefile.am | 4 -
build/win32/gengir_gdkpixbuf.bat | 135 --------------------------
7 files changed, 219 insertions(+), 140 deletions(-)
---
diff --git a/build/Makefile.am b/build/Makefile.am
index afa76bc..f24715b 100644
--- a/build/Makefile.am
+++ b/build/Makefile.am
@@ -1,4 +1,10 @@
SUBDIRS = \
win32
+EXTRA_DIST = \
+ detectenv-msvc.mak \
+ introspection-msvc.mak \
+ gdk-pixbuf-introspection-msvc.mak \
+ gen-file-list-gdkpixbuf.py
+
-include $(top_srcdir)/git.mk
diff --git a/build/detectenv-msvc.mak b/build/detectenv-msvc.mak
new file mode 100644
index 0000000..06c908e
--- /dev/null
+++ b/build/detectenv-msvc.mak
@@ -0,0 +1,72 @@
+# 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)
+MSG = ^
+This Makefile is only for Visual Studio 2008 and later.^
+You need to ensure that the Visual Studio Environment is properly set up^
+before running this Makefile.
+!error $(MSG)
+!endif
+
+ERRNUL = 2>NUL
+_HASH=^#
+
+!if ![echo VCVERSION=_MSC_VER > vercl.x] \
+ && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
+ && ![echo PLAT=Win32 >> vercl.x] \
+ && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
+ && ![echo PLAT=x64 >> vercl.x] \
+ && ![echo $(_HASH)endif >> vercl.x] \
+ && ![cl -nologo -TC -P vercl.x $(ERRNUL)]
+!include vercl.i
+!if ![echo VCVER= ^\> vercl.vc] \
+ && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
+!include vercl.vc
+!endif
+!endif
+!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
+!endif
+
+!if $(VCVERSION) > 1499 && $(VCVERSION) < 1600
+VSVER = 9
+!elseif $(VCVERSION) > 1599 && $(VCVERSION) < 1700
+VSVER = 10
+!elseif $(VCVERSION) > 1699 && $(VCVERSION) < 1800
+VSVER = 11
+!elseif $(VCVERSION) > 1799 && $(VCVERSION) < 1900
+VSVER = 12
+!else
+VSVER = 0
+!endif
+
+!if "$(VSVER)" == "0"
+MSG = ^
+This NMake Makefile set supports Visual Studio^
+9 (2008) through 12 (2013). Your Visual Studio^
+version is not supported.
+!error $(MSG)
+!endif
+
+VALID_CFGSET = FALSE
+!if "$(CFG)" == "release" || "$(CFG)" == "debug"
+VALID_CFGSET = TRUE
+!endif
+
+!if "$(CFG)" == "release"
+CFLAGS_ADD = /MD /O2
+!else
+CFLAGS_ADD = /MDd /Od /Zi
+!endif
+
+!if "$(PLAT)" == "x64"
+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/gdk-pixbuf-introspection-msvc.mak b/build/gdk-pixbuf-introspection-msvc.mak
new file mode 100644
index 0000000..43d7d7a
--- /dev/null
+++ b/build/gdk-pixbuf-introspection-msvc.mak
@@ -0,0 +1,61 @@
+# 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: setgirbuildnev GdkPixbuf-$(APIVERSION).gir GdkPixbuf-$(APIVERSION).typelib
+
+gdkpixbuf_list:
+ @-echo Generating Filelist to Introspect for GDK-Pixbuf...
+ $(PYTHON2) gen-file-list-gdkpixbuf.py
+
+win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkPixbuf-$(APIVERSION).lib:
win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\gdk_pixbuf-$(APIVERSION).lib
+ @-echo Copying win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkPixbuf-$(APIVERSION).lib from
win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\gdk_pixbuf-$(APIVERSION).lib...
+ @-copy /b win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\gdk_pixbuf-$(APIVERSION).lib
win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkPixbuf-$(APIVERSION).lib
+
+setgirbuildnev:
+ @-set CC=$(CC)
+ @-set PYTHONPATH=$(BASEDIR)\lib\gobject-introspection
+ @-set PATH=win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(BASEDIR)\bin;$(PATH);$(MINGWDIR)\bin
+ @-set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
+ @-set LIB=win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(LIB)
+
+GdkPixbuf-$(APIVERSION).gir: gdkpixbuf_list win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkPixbuf-$(APIVERSION).lib
+ @-echo Generating GdkPixbuf-$(APIVERSION).gir...
+ $(PYTHON2) $(G_IR_SCANNER) --verbose -I.. -I..\gdk-pixbuf \
+ -I$(BASEDIR)\include\glib-2.0 -I$(BASEDIR)\lib\glib-2.0\include \
+ --namespace=GdkPixbuf --nsversion=$(APIVERSION) \
+ --include=GModule-2.0 --include=Gio-2.0 \
+ --no-libtool --library=gdk_pixbuf-2.0 \
+ --reparse-validate --add-include-path=$(BASEDIR)\share\gir-1.0 \
+ --pkg-export gdk-pixbuf-2.0 --warn-all --strip-prefix=Gdk \
+ --c-include="gdk-pixbuf/gdk-pixbuf.h" -DGDK_PIXBUF_COMPILATION \
+ --filelist=gdkpixbuf_list -o $@
+
+GdkPixbuf-$(APIVERSION).typelib: GdkPixbuf-$(APIVERSION).gir
+ @-echo Compiling GdkPixbuf-$(APIVERSION).typelib...
+ $(G_IR_COMPILER) --includedir=. --debug --verbose GdkPixbuf-$(APIVERSION).gir -o $@
+
+install-introspection: setgirbuildnev GdkPixbuf-$(APIVERSION).gir GdkPixbuf-$(APIVERSION).typelib
+ @-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
+ @-del /f/q win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\GdkPixbuf-$(APIVERSION).lib
+ @-del /f/q gdkpixbuf_list
+ @-del /f/q *.pyc
diff --git a/build/win32/gen-file-list-gdkpixbuf.py b/build/gen-file-list-gdkpixbuf.py
similarity index 99%
rename from build/win32/gen-file-list-gdkpixbuf.py
rename to build/gen-file-list-gdkpixbuf.py
index c3ddfa6..b282313 100644
--- a/build/win32/gen-file-list-gdkpixbuf.py
+++ b/build/gen-file-list-gdkpixbuf.py
@@ -100,7 +100,7 @@ def read_vars_from_AM(path, vars = {}, conds = {}, filters = None):
return cur_vars
def main(argv):
- srcroot = '..\\..'
+ srcroot = '..'
subdir = 'gdk-pixbuf'
gen_gdkpixbuf_filelist(srcroot, subdir, 'gdkpixbuf_list')
return 0
diff --git a/build/introspection-msvc.mak b/build/introspection-msvc.mak
new file mode 100644
index 0000000..beff817
--- /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_TYPELIBDIR = lib\girepository-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_TYPELIBDIR)
+
+# 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 b070b5d..f18e14c 100644
--- a/build/win32/Makefile.am
+++ b/build/win32/Makefile.am
@@ -2,8 +2,4 @@ SUBDIRS = \
vs9 \
vs10
-EXTRA_DIST = \
- gengir_gdkpixbuf.bat \
- gen-file-list-gdkpixbuf.py
-
-include $(top_srcdir)/git.mk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]