[atk] build: Add NMake Makefiles for the Tests



commit 5312b59d8949415d45eb0d73321089c8b33c1ea8
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Dec 16 11:38:45 2013 +0800

    build: Add NMake Makefiles for the Tests
    
    This adds a set of NMake Makefiles that is used to build the test programs,
    so that one would be able to build the test programs against a Visual C++
    build of ATK quickly and easily.  As with the Project files, the listing of
    test programs is also done with the Python script, which can also be done
    under Windows or called by "make dist" or so quite easily.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690145

 build/Makefile.am         |    3 +-
 build/testsrules_msvc.mak |   72 +++++++++++++++++++++++++++++++++++++++++++++
 tests/Makefile.am         |    7 ++++
 tests/testatk_vc.makin    |   48 ++++++++++++++++++++++++++++++
 4 files changed, 129 insertions(+), 1 deletions(-)
---
diff --git a/build/Makefile.am b/build/Makefile.am
index 5699d6f..3bbca43 100644
--- a/build/Makefile.am
+++ b/build/Makefile.am
@@ -3,5 +3,6 @@ SUBDIRS = \
 
 EXTRA_DIST =   \
        atk_msvc_files.py       \
-       msvcfiles.py
+       msvcfiles.py    \
+       testsrules_msvc.mak
 
diff --git a/build/testsrules_msvc.mak b/build/testsrules_msvc.mak
new file mode 100644
index 0000000..06c908e
--- /dev/null
+++ b/build/testsrules_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/tests/Makefile.am b/tests/Makefile.am
index 935fca3..806a360 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -23,3 +23,10 @@ testdocument_SOURCES = testdocument.c
 testrole_SOURCES = testrole.c
 testrelation_SOURCES = testrelation.c
 teststateset_SOURCES = teststateset.c
+
+testatk_vc.mak: testatk_vc.makin $(top_srcdir)/build/atk_msvc_files.py $(top_srcdir)/build/msvcfiles.py
+       $(PYTHON) $(top_srcdir)/build/atk_msvc_files.py -t nmake-exe
+
+EXTRA_DIST = testatk_vc.makin testatk_vc.mak
+
+DISTCLEANFILES = testatk_vc.mak
diff --git a/tests/testatk_vc.makin b/tests/testatk_vc.makin
new file mode 100644
index 0000000..44bc0c9
--- /dev/null
+++ b/tests/testatk_vc.makin
@@ -0,0 +1,48 @@
+!include ..\build\testsrules_msvc.mak
+
+BUILD_PATH = ..\build\win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin
+LDFLAGS_PATH = /libpath:$(BUILD_PATH) /libpath:..\..\vs$(VSVER)\$(PLAT)\lib
+
+TEST_ATK_LIBS = atk-$(ATK_API_VERSION).lib $(GLIB_LIBS)
+
+LDFLAGS =      \
+       $(LDFLAGS_PATH) \
+       $(LDFLAGS_ARCH)
+
+CFLAGS =       \
+       $(CFLAGS_ADD) /DSRCDIR=\".\" /I..       \
+       /I..\..\vs$(VSVER)\$(PLAT)\include\glib-2.0     \
+       /I..\..\vs$(VSVER)\$(PLAT)\lib\glib-2.0\include \
+       /I..\..\vs$(VSVER)\$(PLAT)\include\glib-2.0
+
+EMPTY_ITEM =
+
+test_programs = \
+#include "test_progs"
+       $(EMPTY_ITEM)
+
+!if "$(VALID_CFGSET)" == "FALSE"
+all:
+       ! -echo You need to run "nmake -f testpango_vc.mak CFG=release" or
+       ! -echo "nmake -f testglib_vc.mak CFG=debug" to use this Makefile to
+       ! -echo build the test programs.
+
+clean:
+       @-del /q/f *$(EXEEXT).manifest
+       @-del /q/f *$(EXEEXT)
+       @-del /q/f *.idb
+       @-del /q/f *.obj
+       @-del /q/f *.pdb
+!else
+all: $(test_programs)
+
+.c$(EXEEXT):
+       $(CC) $(CFLAGS) $< $(LD_CFLAGS) $(LDFLAGS) $(TEST_ATK_LIBS)
+
+clean:
+       @-del /q/f *$(EXEEXT).manifest
+       @-del /q/f *$(EXEEXT)
+       @-del /q/f *.idb
+       @-del /q/f *.obj
+       @-del /q/f *.pdb
+!endif


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