-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathpremake5.lua
More file actions
126 lines (104 loc) · 2.85 KB
/
Copy pathpremake5.lua
File metadata and controls
126 lines (104 loc) · 2.85 KB
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
include("premake/utils")
SDK_PATH = os.getenv("HL2SDKCS2")
MM_PATH = os.getenv("MMSOURCE_DEV")
if(SDK_PATH == nil) then
error("INVALID HL2SDK PATH")
end
if(MM_PATH == nil) then
error("INVALID METAMOD PATH")
end
newaction {
trigger = "package",
description = "Package StripperCS2",
execute = function()
local package_path = path.join(_MAIN_SCRIPT_DIR, "build", "package", "StripperCS2")
local package_bin_path = path.join(package_path, "addons", "StripperCS2", "bin")
local package_metamod_path = path.join(package_path, "addons", "metamod")
local package_example_path = path.join(package_path, "addons", "StripperCS2", "maps", "de_example")
local bin_path = path.join(_MAIN_SCRIPT_DIR, "bin", "Release")
local binaries = os.target() == "windows"
and { "StripperCS2.dll", "StripperCS2.pdb" }
or { "StripperCS2.so" }
local function copy_file(source, destination)
if not os.isfile(source) then
error("MISSING PACKAGE FILE: " .. source)
end
local ok, err = os.copyfile(source, destination)
if not ok then
error(err)
end
end
os.mkdir(package_bin_path)
os.mkdir(package_metamod_path)
os.mkdir(package_example_path)
for _, binary in ipairs(binaries) do
copy_file(path.join(bin_path, binary), path.join(package_bin_path, binary))
end
copy_file(
path.join(_MAIN_SCRIPT_DIR, "package", "StripperCS2.vdf"),
path.join(package_metamod_path, "StripperCS2.vdf")
)
copy_file(
path.join(_MAIN_SCRIPT_DIR, "package", "default_ents.jsonc"),
path.join(package_example_path, "default_ents.jsonc")
)
end
}
workspace "StripperCS2"
configurations { "Debug", "Release" }
platforms {
"x64"
}
location "build"
filter "system:windows"
buildoptions { "/utf-8" }
filter "system:linux"
toolset "clang"
filter {}
project "StripperCS2"
kind "SharedLib"
language "C++"
targetdir "bin/%{cfg.buildcfg}"
location "build/StripperCS2"
visibility "Hidden"
targetprefix ""
files { "src/**.h", "src/**.cpp" }
vpaths {
["Headers/*"] = "src/**.h",
["Sources/*"] = "src/**.cpp"
}
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter "configurations:Release"
defines { "NDEBUG" }
symbols "On"
optimize "On"
filter "system:windows"
cppdialect "c++20"
include("premake/mm-windows.lua")
links { "psapi" }
staticruntime "On"
filter "system:linux"
defines { "stricmp=strcasecmp" }
cppdialect "c++2a"
include("premake/mm-linux.lua")
links { "pthread", "z"}
linkoptions { '-static-libstdc++', '-static-libgcc' }
disablewarnings { "register" }
filter {}
defines { "META_IS_SOURCE2", "PCRE2_CODE_UNIT_WIDTH=8", "PCRE2_STATIC" }
multiprocessorcompile "On"
pic "On"
links {
"pcre",
"spdlog"
}
includedirs {
path.join("vendor", "nlohmann"),
path.join("vendor", "spdlog", "include"),
path.join("vendor"),
path.join("src"),
}
include "vendor/pcre"
include "premake/spdlog"