-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpremake5.lua
More file actions
203 lines (159 loc) · 6.52 KB
/
premake5.lua
File metadata and controls
203 lines (159 loc) · 6.52 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
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
202
203
local handle = io.popen("vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath")
local vsc = handle:read("*a")
handle:close()
if vsc then
vsc32 = (vsc:sub(0, -2) .. "\\VC\\Auxiliary\\Build\\vcvars32.bat"):gsub('%W\\:','')
vsc64 = (vsc:sub(0, -2) .. "\\VC\\Auxiliary\\Build\\vcvars64.bat"):gsub('%W\\:','')
else vsc = "" end
function HasIncludedPackage(name)
local _project = project()
_project.packages = _project.packages or {}
return _project.packages[name] == true
end
function IncludePackage(name)
assert(not HasIncludedPackage(name), "a package with the name '" .. name .. "' already exists!")
local _project = project()
local _workspace = _project.workspace
_project.packages[name] = true
if _workspace.packages == nil then
_workspace.packages = {}
end
local refcount = (_workspace.packages[name] or 0) + 1
_workspace.packages[name] = refcount
return refcount
end
include ( "sdk32/premake5.lua" )
workspace "plugin_ljpatch32"
configurations { "Debug", "Release" }
platforms { "x86" }
location "build"
characterset "MBCS"
staticruntime "on"
pic "On"
filter "platforms:x86"
architecture "x86"
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
project "plugin_ljpatch32"
kind "SharedLib"
language "C++"
cppdialect "C++20"
project().serverside = true
targetdir ("bin/%{cfg.platform}/%{cfg.buildcfg}")
objdir ("bin-int/%{cfg.platform}/%{cfg.buildcfg}")
files { "entry_point.cpp", "luajit/src/**.h", "glua/**.h", "sdk32/**.hpp", "sdk32/**.h", "sdk32/**.lib" }
IncludeSDKCommon()
IncludeSDKTier0()
IncludeSDKTier1()
removefiles {
"sdk32/public/tier0/memoverride.cpp",
"sdk32/tier1/processor_detect.cpp",
"sdk32/tier1/processor_detect_linux.cpp",
"sdk32/public/tier0/valve_off.cpp",
"sdk32/public/tier0/valve_on.cpp"
}
filter { "system:linux", "platforms:x86" }
links { "luajit/src/luajit" }
prebuildcommands {
"cd ../luajit/src && make clean && make CC=\"gcc -m32 -fPIC\" BUILDMODE=static LUAJIT_ENABLE_LUA52=0 BUILD_SHARED_LIBS=OFF"
}
filter { "system:windows", "platforms:x86" }
links { "luajit/src/lua51" }
prebuildcommands {
[[cmd /C "call "]] .. vsc32 .. [[" && cd ..\luajit\src && msvcbuild.bat static x86 )"]]
}
filter "system:windows"
systemversion "latest"
defines { "COMPILER_MSVC", "WIN32", "_WINDOWS" }
filter { "system:windows", "platforms:x86" }
defines { "COMPILER_MSVC32" }
targetname ("plugin_ljpatch_win32")
filter "system:linux"
defines { "COMPILER_GCC" }
filter { "system:linux", "platforms:x86" }
pic "On"
includedirs { (os.getenv("HOME") or "") .. "/vcpkg/installed/x86-linux/include" }
libdirs { (os.getenv("HOME") or "") .. "/vcpkg/installed/x86-linux/lib" }
targetname ("plugin_ljpatch_linux")
targetprefix ""
include ( "sdk64/premake5.lua" )
workspace "plugin_ljpatch64"
configurations { "Debug", "Release" }
platforms { "x64" }
location "build"
characterset "MBCS"
staticruntime "on"
pic "On"
filter "platforms:x64"
architecture "x86_64"
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
project "plugin_ljpatch64"
kind "SharedLib"
language "C++"
cppdialect "C++20"
project().serverside = true
targetdir ("bin/%{cfg.platform}/%{cfg.buildcfg}")
objdir ("bin-int/%{cfg.platform}/%{cfg.buildcfg}")
files { "entry_point.cpp", "luajit/src/**.h", "glua/**.h", "sdk64/**.hpp", "sdk64/**.h", "sdk64/**.lib" }
IncludeSDKCommon()
IncludeSDKTier0()
IncludeSDKTier1()
removefiles {
"sdk64/public/tier0/memoverride.cpp",
"sdk64/tier1/processor_detect.cpp",
"sdk64/tier1/processor_detect_linux.cpp",
"sdk64/public/tier0/valve_off.cpp",
"sdk64/public/tier0/valve_on.cpp"
}
filter { "system:linux", "platforms:x64" }
links { "luajit/src/luajit" }
prebuildcommands {
"cd ../luajit/src && make clean && make CC=\"gcc -m64 -fPIC\" XCFLAGS=\"-DLUAJIT_ENABLE_GC64\" BUILDMODE=static LUAJIT_ENABLE_LUA52=0 BUILD_SHARED_LIBS=OFF"
}
filter { "system:windows", "platforms:x64" }
links { "luajit/src/lua51" }
prebuildcommands {
[[cmd /C "call "]] .. vsc64 .. [[" && cd ..\luajit\src && msvcbuild.bat gc64 static x64 )"]]
}
filter "system:windows"
systemversion "latest"
defines { "COMPILER_MSVC", "WIN32", "_WINDOWS" }
filter { "system:windows", "platforms:x64" }
defines { "COMPILER_MSVC64" }
targetname ("plugin_ljpatch_win64")
filter "system:linux"
defines { "COMPILER_GCC" }
filter { "system:linux", "platforms:x64" }
pic "On"
includedirs { (os.getenv("HOME") or "") .. "/vcpkg/installed/x64-linux/include" }
libdirs { (os.getenv("HOME") or "") .. "/vcpkg/installed/x64-linux/lib" }
targetname ("plugin_ljpatch_linux64")
targetprefix ""
require('vstudio')
premake.override(premake.vstudio.vc2010.elements, "project", function(base, prj)
local calls = base(prj)
table.insertafter(calls, premake.vstudio.vc2010.project, function(prj)
premake.w([[<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<VcpkgUseStatic>true</VcpkgUseStatic>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<VcpkgUseStatic>true</VcpkgUseStatic>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<VcpkgUseStatic>true</VcpkgUseStatic>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<VcpkgUseStatic>true</VcpkgUseStatic>
</PropertyGroup>]])
end)
return calls
end)