summaryrefslogtreecommitdiff
path: root/build/detectenv-msvc.mak
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2015-09-04 18:08:46 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2015-09-04 18:08:46 +0800
commitc0e56e5af9e00137de1eb603ac1625332176f407 (patch)
tree9ab79194fa7d3440fec59c697c15188faac83474 /build/detectenv-msvc.mak
parent7402dfe837bde0cfc2bdb1ab30f1ce7e9822a8f7 (diff)
downloadpango-c0e56e5af9e00137de1eb603ac1625332176f407.tar.gz
MSVC Builds: Rename testsrules_msvc.mak
Rename this to detectenv-msvc.mak to be consistent with the other GNOME projects that support MSVC builds, and clean that file up a bit.
Diffstat (limited to 'build/detectenv-msvc.mak')
-rw-r--r--build/detectenv-msvc.mak65
1 files changed, 65 insertions, 0 deletions
diff --git a/build/detectenv-msvc.mak b/build/detectenv-msvc.mak
new file mode 100644
index 00000000..020548af
--- /dev/null
+++ b/build/detectenv-msvc.mak
@@ -0,0 +1,65 @@
+# 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