]> git.tdb.fi Git - ext/sigc++-2.0.git/blob - MSVC_NMake/detectenv-msvc.mak
Adjust the name of the library to match upstream
[ext/sigc++-2.0.git] / MSVC_NMake / detectenv-msvc.mak
1 # Change this (or specify PREFIX= when invoking this NMake Makefile) if
2 # necessary, so that the libs and headers of the dependent third-party
3 # libraries can be located.  For instance, if building from GLib's
4 # included Visual Studio projects, this should be able to locate the GLib
5 # build out-of-the-box if they were not moved.  GLib's headers will be
6 # found in $(GLIB_PREFIX)\include\glib-2.0 and
7 # $(GLIB_PREFIX)\lib\glib-2.0\include and its import library will be found
8 # in $(GLIB_PREFIX)\lib.
9
10 !if "$(PREFIX)" == ""
11 PREFIX = ..\..\vs$(VSVER)\$(PLAT)
12 !endif
13
14 # Location of the PERL interpreter, for running glib-mkenums.  glib-mkenums
15 # needs to be found in $(PREFIX)\bin.  Using either a 32-bit or x64 PERL
16 # interpreter are supported for either a 32-bit or x64 build.
17
18 !if "$(PERL)" == ""
19 PERL = perl
20 !endif
21
22 # Location of the Python interpreter, for building introspection.  The complete set
23 # of Python Modules for introspection (the giscanner Python scripts and the _giscanner.pyd
24 # compiled module) needs to be found in $(PREFIX)\lib\gobject-introspection\giscanner, and
25 # the g-ir-scanner Python script and g-ir-compiler utility program needs to be found
26 # in $(PREFIX)\bin, together with any DLLs they will depend on, if those DLLs are not already
27 # in your PATH.
28 # Note that the Python interpreter and the introspection modules and utility progam must
29 # correspond to the build type (i.e. 32-bit Release for 32-bit Release builds, and so on).
30 #
31 # For introspection, currently only Python 2.7.x is supported.  This may change when Python 3.x
32 # support is added upstream in gobject-introspection--when this happens, the _giscanner.pyd must
33 # be the one that is built against the release series of Python that is used here.
34
35 !if "$(PYTHON)" == ""
36 PYTHON = python
37 !endif
38
39 # Location of the pkg-config utility program, for building introspection.  It needs to be able
40 # to find the pkg-config (.pc) files so that the correct libraries and headers for the needed libraries
41 # can be located, using PKG_CONFIG_PATH.  Using either a 32-bit or x64 pkg-config are supported for
42 # either a 32-bit or x64 build.
43
44 !if "$(PKG_CONFIG)" == ""
45 PKG_CONFIG = pkg-config
46 !endif
47
48 # The items below this line should not be changed, unless one is maintaining
49 # the NMake Makefiles.  The exception is for the CFLAGS_ADD line(s) where one
50 # could use his/her desired compiler optimization flags, if he/she knows what is
51 # being done.
52
53 # Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
54 # VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
55 !if !defined(VCINSTALLDIR) && !defined(WINDOWSSDKDIR)
56 MSG = ^
57 This Makefile is only for Visual Studio 2008 and later.^
58 You need to ensure that the Visual Studio Environment is properly set up^
59 before running this Makefile.
60 !error $(MSG)
61 !endif
62
63 ERRNUL  = 2>NUL
64 _HASH=^#
65
66 !if ![echo VCVERSION=_MSC_VER > vercl.x] \
67     && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
68     && ![echo PLAT=Win32 >> vercl.x] \
69     && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
70     && ![echo PLAT=x64 >> vercl.x] \
71     && ![echo $(_HASH)elif defined(_M_ARM64) >> vercl.x] \
72     && ![echo PLAT=arm64 >> vercl.x] \
73     && ![echo $(_HASH)endif >> vercl.x] \
74     && ![cl -nologo -TC -P vercl.x $(ERRNUL)]
75 !include vercl.i
76 !if ![echo VCVER= ^\> vercl.vc] \
77     && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
78 !include vercl.vc
79 !endif
80 !endif
81 !if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
82 !endif
83
84 !if $(VCVERSION) > 1499 && $(VCVERSION) < 1600
85 VSVER = 9
86 !elseif $(VCVERSION) > 1599 && $(VCVERSION) < 1700
87 VSVER = 10
88 !elseif $(VCVERSION) > 1699 && $(VCVERSION) < 1800
89 VSVER = 11
90 !elseif $(VCVERSION) > 1799 && $(VCVERSION) < 1900
91 VSVER = 12
92 !elseif $(VCVERSION) > 1899 && $(VCVERSION) < 1910
93 VSVER = 14
94 !elseif $(VCVERSION) > 1909 && $(VCVERSION) < 1920
95 VSVER = 15
96 !elseif $(VCVERSION) > 1919 && $(VCVERSION) < 1930
97 VSVER = 16
98 !elseif $(VCVERSION) > 1929 && $(VCVERSION) < 2000
99 VSVER = 17
100 !else
101 VSVER = 0
102 !endif
103
104 !if "$(VSVER)" == "0"
105 MSG = ^
106 This NMake Makefile set supports Visual Studio^
107 9 (2008) through 16 (2019).  Your Visual Studio^
108 version is not supported.
109 !error $(MSG)
110 !else
111 !if $(VSVER) < 15
112 PDBVER = $(VSVER)
113 !else
114 PDBVER = 14
115 !endif
116 !endif
117
118 VALID_CFGSET = FALSE
119 !if "$(CFG)" == "release" || "$(CFG)" == "Release" || "$(CFG)" == "debug" || "$(CFG)" == "Debug"
120 VALID_CFGSET = TRUE
121 !endif
122
123 # One may change these items, but be sure to test
124 # the resulting binaries
125 !if "$(CFG)" == "release" || "$(CFG)" == "Release"
126 CFLAGS_ADD = /MD /O2 /GL /MP
127 !if "$(VSVER)" != "9"
128 CFLAGS_ADD = $(CFLAGS_ADD) /d2Zi+
129 !endif
130 !else
131 CFLAGS_ADD = /MDd /Od
132 !endif
133
134 !if "$(PLAT)" == "x64"
135 LDFLAGS_ARCH = /machine:x64
136 !elseif "$(PLAT)" == "arm64"
137 LDFLAGS_ARCH = /machine:arm64
138 !else
139 LDFLAGS_ARCH = /machine:x86
140 !endif
141
142 !if "$(VALID_CFGSET)" == "TRUE"
143 CFLAGS = $(CFLAGS_ADD) /W3 /Zi
144
145 LDFLAGS_BASE = $(LDFLAGS_ARCH) /libpath:$(PREFIX)\lib /DEBUG
146
147 !if "$(CFG)" == "debug" || "$(CFG)" == "Debug"
148 ARFLAGS = $(LDFLAGS_ARCH)
149 LDFLAGS = $(LDFLAGS_BASE)
150 !else
151 ARFLAGS = $(LDFLAGS_ARCH) /LTCG
152 LDFLAGS = $(LDFLAGS_BASE) /LTCG /opt:ref
153 !endif
154 !endif