-
Notifications
You must be signed in to change notification settings - Fork 1
/
premake5.lua
201 lines (170 loc) · 5.65 KB
/
premake5.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
--
-- premake5 file to build NavBot extension.
-- http://premake.github.io/
--
local action = _ACTION or ""
local todir = "build/" .. action
newoption {
trigger = "hl2sdk-root",
value = "absolute path",
description = "Absolute path to the root folter that contains the HL2-SDKs",
category = "Paths"
}
newoption {
trigger = "mms-path",
value = "absolute path",
description = "Absolute path to the root metamod-source folder",
category = "Paths"
}
newoption {
trigger = "sm-path",
value = "absolute path",
description = "Absolute path to the root sourcemod folder",
category = "Paths"
}
Path_HL2SDKROOT = ""
Path_SM = ""
Path_MMS = ""
g_Compiler = ""
-- when "premake5 --help" is ran, _ACTION is NULL (nil)
if (_ACTION ~= nil) then
if (_OPTIONS["hl2sdk-root"] == nil) then
error("Failed to get path to HL2SDKs. Set path with --hl2sdk-root=path")
end
if (_OPTIONS["mms-path"] == nil) then
error("Failed to get path to Metamod Source. Set path with --mms-path=path")
end
if (_OPTIONS["sm-path"] == nil) then
error("Failed to get path to SourceMod. Set path with --sm-path=path")
end
if (not os.isdir(_OPTIONS["hl2sdk-root"])) then
error("Failed to get path to HL2SDKs. Set path with --hl2sdk-root=path")
end
if (not os.isdir(_OPTIONS["mms-path"])) then
error("Failed to get path to Metamod Source. Set path with --mms-path=path")
end
if (not os.isdir(_OPTIONS["sm-path"])) then
error("Failed to get path to SourceMod. Set path with --sm-path=path")
end
Path_HL2SDKROOT = path.normalize(_OPTIONS["hl2sdk-root"])
Path_SM = path.normalize(_OPTIONS["sm-path"])
Path_MMS = path.normalize(_OPTIONS["mms-path"])
end
-- check compiler
if os.host() == "windows" then
g_Compiler = "MSVC"
print("Microsoft C++ compiler selected.")
elseif os.host() == "linux" then
local cxx = os.getenv("CXX")
if cxx == nil then
g_Compiler = "CLANG"
print("CXX env not set. Using clang.")
else
if string.startswith(cxx, "clang") then
g_Compiler = "CLANG"
print("Clang selected.")
else
g_Compiler = "GCC"
print("GCC selected.")
end
end
end
-- run versioning script
if os.host() == "windows" then
if os.execute("python versioning.py") ~= true then
error("Failed to run python script versioning.py!")
end
elseif os.host() == "linux" then
if os.execute("python3 versioning.py") ~= true then
error("Failed to run python script versioning.py! Is Python 3 installed on your system?")
end
end
workspace "navbot"
configurations {
"Debug",
"Release"
}
platforms {
"Win32",
"Win64",
"Linux32",
"Linux64"
}
location (todir)
symbols "On"
exceptionhandling "On"
rtti "On"
stringpooling "On"
omitframepointer "Off"
vectorextensions "SSE2"
pic "On"
include("premake/common_sdk.lua")
if g_Compiler == "MSVC" then
toolset "msc"
elseif g_Compiler == "CLANG" then
toolset "clang"
else
toolset "gcc"
end
filter { "system:Windows" }
defines { "_CRT_SECURE_NO_DEPRECATE", "_CRT_SECURE_NO_WARNINGS", "_CRT_NONSTDC_NO_DEPRECATE", "_WINDOWS", "_ITERATOR_DEBUG_LEVEL=0" }
flags { "MultiProcessorCompile" }
characterset "MBCS"
staticruntime "on"
runtime "Release"
editandcontinue "off"
-- Disable macro redefinition warnings
disablewarnings { "4005"}
links {
"kernel32.lib",
"user32.lib",
"legacy_stdio_definitions.lib",
}
-- Linux options shared for both GCC/Clang
filter { "system:Linux" }
defines { "LINUX", "_LINUX", "POSIX", "_FILE_OFFSET_BITS=64", "COMPILER_GCC" }
defines { "stricmp=strcasecmp", "_stricmp=strcasecmp", "_snprintf=snprintf", "_vsnprintf=vsnprintf", "HAVE_STDINT_H", "GNUC" }
buildoptions {
"-Wno-non-virtual-dtor", "-Wno-overloaded-virtual", "-Wno-register", "-Wno-varargs", "-Wno-array-bounds", "-Wno-unused",
"-Wno-null-dereference", "-Wno-delete-non-virtual-dtor", "-Wno-switch", "-Wno-expansion-to-defined",
}
-- disable prefixes for Linux
targetprefix ""
-- Linux options for Clang only
filter { "system:linux", "toolset:clang" }
buildoptions {
"-Wno-implicit-exception-spec-mismatch", "-Wno-sometimes-uninitialized", "-Wno-inconsistent-missing-override", "-Wno-tautological-overlap-compare",
"-Wno-implicit-float-conversion",
}
filter { "configurations:Debug" }
defines { "EXT_DEBUG" }
targetdir "build/bin/%{cfg.architecture}/debug"
optimize "Off"
filter { "configurations:Release" }
defines { "NDEBUG" }
targetdir "build/bin/%{cfg.architecture}/release"
optimize "Full"
flags { "LinkTimeOptimization" }
visibility "Hidden"
filter { "platforms:Win32" }
system "Windows"
architecture "x86"
defines { "WIN32", "COMPILER_MSVC", "COMPILER_MSVC32" }
filter { "platforms:Win64" }
system "Windows"
architecture "x86_64"
defines { "WIN64", "COMPILER_MSVC", "COMPILER_MSVC64", "X64BITS", "PLATFORM_64BITS" }
filter { "platforms:Linux32" }
system "Linux"
architecture "x86"
filter { "platforms:Linux64" }
system "Linux"
architecture "x86_64"
defines { "X64BITS", "PLATFORM_64BITS" }
include("premake/tf2.lua")
include("premake/dods.lua")
include("premake/css.lua")
include("premake/bms.lua")
include("premake/sdk2013.lua")
include("premake/hl2dm.lua")
include("premake/orangebox.lua")