-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxmake.lua
143 lines (125 loc) · 3.45 KB
/
xmake.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
set_languages("cxx17")
set_arch("x86")
option("HL2SDKPATH")
--Manually compile tier1
target("tier1")
set_kind("static")
add_files("$(HL2SDKPATH)/tier1/*.cpp")
remove_files(
--processor_detect.cpp Auto detection includes.
"$(HL2SDKPATH)/tier1/processor_detect_linux.cpp",
-- There is no place to use these functions, and compilation will result in link errors.
"$(HL2SDKPATH)/tier1/diff.cpp",
"$(HL2SDKPATH)/tier1/undiff.cpp"
)
add_includedirs(
"$(HL2SDKPATH)/public",
"$(HL2SDKPATH)/public/tier0",
"$(HL2SDKPATH)/public/tier1",
"$(HL2SDKPATH)/public/engine",
"$(HL2SDKPATH)/public/mathlib"
)
add_defines("NDEBUG")
if is_plat("windows") then
set_toolchains("msvc")
add_defines(
"_WINDOWS", "WIN32",
'_CRT_SECURE_NO_WARNINGS')
add_cxflags("/W3", "/wd4819", "/wd5033", "/Ox", "/Oy-", "/EHsc", "/MT", "/Z7")
else
set_toolchains("clang")
add_defines(
"_LINUX","POSIX",
"NO_HOOK_MALLOC", "NO_MALLOC_OVERRIDE",
"stricmp=strcasecmp",
"_stricmp=strcasecmp",
"strcmpi=strcasecmp",
"_strnicmp=strncasecmp",
"strnicmp=strncasecmp ",
"_snprintf=snprintf",
"_vsnprintf=vsnprintf",
"_alloca=alloca"
)
add_cxflags(
"-Wall",
"-Wshadow",
"-Wno-parentheses-equality",
"-Wno-undefined-bool-conversion",
"-Wno-implicit-int-float-conversion",
"-Wno-overloaded-virtual",
"-Wno-deprecated-register",
"-Wno-register",
"-Wno-non-virtual-dtor",
"-Wno-expansion-to-defined",
"-fno-strict-aliasing",
"-fno-exceptions",
"-fvisibility=hidden",
"-fvisibility-inlines-hidden",
"-flto", "-fPIC", "-O2", "-g3"
)
end
target("l4dtoolz")
set_kind("shared")
add_deps("tier1")
set_prefixname("")
add_files("src/*.cpp")
add_includedirs(
"src",
"$(HL2SDKPATH)/public",
"$(HL2SDKPATH)/public/tier0",
"$(HL2SDKPATH)/public/tier1",
"$(HL2SDKPATH)/public/engine",
"$(HL2SDKPATH)/public/mathlib"
)
add_defines("NDEBUG")
if is_plat("windows") then
set_toolchains("msvc")
add_defines(
"_WINDOWS", "WIN32",
"strdup=_strdup",
"_CRT_SECURE_NO_WARNINGS")
add_cxflags("/W3", "/wd4819", "/Ox", "/Oy-", "/EHsc", "/MT", "/Z7")
add_shflags("/DEBUG") --Always generate pdb files
add_shflags("/OPT:ICF", "/OPT:REF")
add_linkdirs("$(HL2SDKPATH)/lib/public");
add_links("tier0", "vstdlib", "kernel32", "legacy_stdio_definitions")
else
set_toolchains("clang")
add_defines(
"_LINUX","POSIX",
"NO_HOOK_MALLOC", "NO_MALLOC_OVERRIDE",
"stricmp=strcasecmp",
"_stricmp=strcasecmp",
"strcmpi=strcasecmp",
"_strnicmp=strncasecmp",
"strnicmp=strncasecmp ",
"_snprintf=snprintf",
"_vsnprintf=vsnprintf",
"_alloca=alloca"
)
add_cxflags(
"-Wall",
"-Wshadow",
"-Wno-implicit-int-float-conversion",
"-Wno-overloaded-virtual",
"-Wno-deprecated-register",
"-Wno-register",
"-Wno-non-virtual-dtor",
"-Wno-expansion-to-defined",
"-fno-strict-aliasing",
"-fno-exceptions",
"-fvisibility=hidden",
"-fvisibility-inlines-hidden",
"-flto", "-fPIC", "-O2", "-g3"
)
add_linkdirs("$(HL2SDKPATH)/lib/linux");
add_links("tier0_srv", "vstdlib_srv")
add_shflags("-fuse-ld=lld", "-flto", "-static-libstdc++", "-static-libgcc")
end
after_build(function (target)
os.tryrm("release")
os.mkdir("release/addons/l4dtoolz")
os.cp(path.join(target:targetdir(), target:filename()), "release/addons/l4dtoolz")
os.cp("extra/l4dtoolz.txt", "release/addons/l4dtoolz")
os.cp("extra/l4dtoolz.vdf", "release/addons")
end)