summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2014-02-25 15:36:18 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2014-02-25 15:36:18 +0800
commit74b1145b1f271fd3593caf9ab776aaf78d5060cc (patch)
tree5dfc312325ed94281a387e532f0a58db79b87069
parent08a7de1a9eac54955dc2bb878314e7b251296783 (diff)
downloadgdk-pixbuf-74b1145b1f271fd3593caf9ab776aaf78d5060cc.tar.gz
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.
-rw-r--r--build/Makefile.am6
-rw-r--r--build/detectenv-msvc.mak72
-rw-r--r--build/gdk-pixbuf-introspection-msvc.mak61
-rw-r--r--build/gen-file-list-gdkpixbuf.py (renamed from build/win32/gen-file-list-gdkpixbuf.py)2
-rw-r--r--build/introspection-msvc.mak79
-rw-r--r--build/win32/Makefile.am4
-rw-r--r--build/win32/gengir_gdkpixbuf.bat135
7 files changed, 219 insertions, 140 deletions
diff --git a/build/Makefile.am b/build/Makefile.am
index afa76bc92..f24715bd7 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 000000000..06c908e83
--- /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 000000000..43d7d7ac9
--- /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
index c3ddfa6b2..b282313bc 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 000000000..beff817d0
--- /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 b070b5ded..f18e14c6a 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
diff --git a/build/win32/gengir_gdkpixbuf.bat b/build/win32/gengir_gdkpixbuf.bat
deleted file mode 100644
index d579e0609..000000000
--- a/build/win32/gengir_gdkpixbuf.bat
+++ /dev/null
@@ -1,135 +0,0 @@
-@echo off
-
-setlocal EnableDelayedExpansion
-
-rem Needed environmental variables:
-rem PLAT: Windows platform-Win32 (i.e. x86) or x64 (i.e. x86-64)
-rem CONF: Configuration Type, Release or Debug
-rem VSVER: Visual C++ version used [9, 10 or 11]
-rem BASEDIR: Where the dependent libraries/headers are located
-rem PKG_CONFIG_PATH: Where the GLib and its dependent pkg-config .pc files can be found
-rem MINGWDIR: Installation path of MINGW GCC, so gcc.exe can be found in %MINGWDIR%\bin.
-
-rem Note that the Python executable/installation and all the runtime dependencies of the
-rem library/libraries need to be in your PATH or %BASEBIN%\bin.
-
-rem Check the environemental variables...
-if /i "%PLAT%" == "Win32" goto PLAT_OK
-if /i "%PLAT%" == "x64" goto PLAT_OK
-if /i "%PLAT%" == "x86" (
- set PLAT=Win32
- goto PLAT_OK
-)
-if /i "%PLAT%" == "x86-64" (
- set PLAT=x64
- goto PLAT_OK
-)
-goto ERR_PLAT
-
-:PLAT_OK
-if "%VSVER%" == "9" goto VSVER_OK
-if "%VSVER%" == "10" goto VSVER_OK
-if "%VSVER%" == "11" goto VSVER_OK
-goto ERR_VSVER
-:VSVER_OK
-if /i "%CONF%" == "Release" goto CONF_OK
-if /i "%CONF%" == "Debug" goto CONF_OK
-goto ERR_CONF
-:CONF_OK
-if "%BASEDIR%" == "" goto ERR_BASEDIR
-if not exist %BASEDIR% goto ERR_BASEDIR
-
-if "%PKG_CONFIG_PATH%" == "" goto ERR_PKGCONFIG
-if not exist %PKG_CONFIG_PATH%\gobject-2.0.pc goto ERR_PKGCONFIG
-
-if "%MINGWDIR%" == "" goto ERR_MINGWDIR
-if not exist %MINGWDIR%\bin\gcc.exe goto ERR_MINGWDIR
-
-set CC=cl
-set BINDIR=%CD%\vs%VSVER%\%CONF%\%PLAT%\bin
-set INCLUDE=%BASEDIR%\include\glib-2.0;%BASEDIR%\lib\glib-2.0\include;%INCLUDE%
-set LIB=%BINDIR%;%BASEDIR%\lib;%LIB%
-set PATH=%BINDIR%;%BASEDIR%\bin;%PATH%;%MINGWDIR%\bin
-set PYTHONPATH=%BASEDIR%\lib\gobject-introspection;%BINDIR%
-
-echo Setup filelist for generating GdkPixbuf .gir's...
-
-call python gen-file-list-gdkpixbuf.py
-
-echo Setup .bat for generating GdkPixbuf .gir's...
-
-rem ===============================================================================
-rem Begin setup of gdkpixbuf_gir.bat to create GdkPixbuf-2.0.gir
-rem (The ^^ is necessary to span the command to multiple lines on Windows cmd.exe!)
-rem ===============================================================================
-
-echo echo Generating GdkPixbuf-2.0.gir...> gdkpixbuf_gir.bat
-echo @echo off>> gdkpixbuf_gir.bat
-echo.>> gdkpixbuf_gir.bat
-echo copy /b %BINDIR%\gdk_pixbuf-2.0.lib %BINDIR%\gdkpixbuf-2.0.lib>> gdkpixbuf_gir.bat
-echo.>> gdkpixbuf_gir.bat
-rem =====================================================================
-rem Setup the command line flags to g-ir-scanner for GdkPixbuf-2.0.gir...
-rem =====================================================================
-echo python %BASEDIR%\bin\g-ir-scanner --verbose -I..\.. -I..\..\gdk-pixbuf ^^>> gdkpixbuf_gir.bat
-echo -I%BASEDIR%\include\glib-2.0 -I%BASEDIR%\lib\glib-2.0\include ^^>> gdkpixbuf_gir.bat
-echo --namespace=GdkPixbuf --nsversion=2.0 ^^>> gdkpixbuf_gir.bat
-echo --include=GModule-2.0 --include=Gio-2.0 ^^>> gdkpixbuf_gir.bat
-echo --no-libtool --library=gdk_pixbuf-2-vs%VSVER% ^^>> gdkpixbuf_gir.bat
-echo --reparse-validate --add-include-path=%BASEDIR%\share\gir-1.0 --add-include-path=. ^^>> gdkpixbuf_gir.bat
-echo --pkg-export gdk-pixbuf-2.0 --warn-all --strip-prefix=Gdk --c-include="gdk-pixbuf/gdk-pixbuf.h" ^^>> gdkpixbuf_gir.bat
-echo -I..\.. -DGDK_PIXBUF_COMPILATION ^^>> gdkpixbuf_gir.bat
-echo --filelist=gdkpixbuf_list ^^>> gdkpixbuf_gir.bat
-echo -o GdkPixbuf-2.0.gir>> gdkpixbuf_gir.bat
-echo.>> gdkpixbuf_gir.bat
-
-echo del %BINDIR%\gdkpixbuf-2.0.lib>> gdkpixbuf_gir.bat
-echo.>> gdkpixbuf_gir.bat
-echo Completed setup of .bat for generating GdkPixbuf-2.0.gir.
-echo.>> gdkpixbuf_gir.bat
-
-rem =============================================================
-rem Finish setup of gdkpixbuf_gir.bat to create GdkPixbuf-2.0.gir
-rem =============================================================
-
-rem =======================
-rem Now generate the .gir's
-rem =======================
-CALL gdkpixbuf_gir.bat
-
-rem Clean up the .bat and the filelist for generating the .gir files...
-del gdkpixbuf_gir.bat
-del gdkpixbuf_list
-
-rem Now compile the generated .gir files
-%BASEDIR%\bin\g-ir-compiler --includedir=. --debug --verbose GdkPixbuf-2.0.gir -o GdkPixbuf-2.0.typelib
-rem Copy the generated .girs and .typelibs to their appropriate places
-
-mkdir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\share\gir-1.0
-move /y *.gir %BASEDIR%\share\gir-1.0\
-
-mkdir ..\..\build\win32\vs%VSVER%\%CONF%\%PLAT%\lib\girepository-1.0
-move /y *.typelib %BASEDIR%\lib\girepository-1.0\
-
-goto DONE
-
-:ERR_PLAT
-echo You need to specify a valid Platform [set PLAT=Win32 or PLAT=x64]
-goto DONE
-:ERR_VSVER
-echo You need to specify your Visual Studio version [set VSVER=9 or VSVER=10 or VSVER=11]
-goto DONE
-:ERR_CONF
-echo You need to specify a valid Configuration [set CONF=Release or CONF=Debug]
-goto DONE
-:ERR_BASEDIR
-echo You need to specify a valid BASEDIR.
-goto DONE
-:ERR_PKGCONFIG
-echo You need to specify a valid PKG_CONFIG_PATH
-goto DONE
-:ERR_MINGWDIR
-echo You need to specify a valid MINGWDIR, where a valid gcc installation can be found.
-goto DONE
-:DONE
-