-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpremake5.lua
193 lines (176 loc) · 4.52 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
newoption {
trigger = "enable-WSL",
description = "enable Windows Subsytem For linux building",
category = "Build Options"
}
newoption {
trigger = "no-sandbox",
description = "disable sandbox project",
category = "Build Options"
}
newoption {
trigger = "project-include",
description = "disable seperate project workspace",
category = "Build Options"
}
newoption {
trigger = "lib-type",
value = "LIB-TYPE",
description = "Choose a library type Shared or static",
default = "SharedLib",
category = "project Options",
allowed = {
{ "SharedLib","Shared"},
{ "StaticLib","Static"}
}
}
newoption {
trigger = "api-type",
value = "API-TYPE",
description = "Choose an api type (C-API is needed for bindings) enables extern c or dllexport",
default = "CPP",
category = "project Options",
allowed = {
{ "C","C-API"},
{ "CPP","CPP-API" },
{ "COMBINED"},
{ "NONE","none"}
}
}
flags
{
"MultiProcessorCompile"
}
if not _OPTIONS["project-include"] then
startproject "sandbox"
workspace "Athena"
architecture "x64"
configurations
{
"debug",
"release",
"distribution"
}
end
outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
IncludeDir = {}
IncludeDir["Athena"] = "%{prj.location}/src"
IncludeDir["LZ4"] = "%{prj.location}/src/thirdparty/LZ4"
group"core"
project "Athena"
location "Athena"
kind(_OPTIONS["lib-type"])
language "c++"
targetdir("%{wks.location}/bin/" .. outputdir .. "/x64/%{prj.name}")
objdir("%{wks.location}/bin-int/" .. outputdir .. "/x64/%{prj.name}")
files
{
"%{prj.location}/src/**.c",
"%{prj.location}/src/**.h",
"%{prj.location}/src/**.hpp",
"%{prj.location}/src/**.cpp",
}
includedirs
{
"%{IncludeDir.Athena}"
}
if _OPTIONS["lib-type"] == "Shared" or _OPTIONS["lib-type"] == "SharedLib" then
defines
{
"AT_BUILD_DLL"
}
end
if _OPTIONS["api-type"] == "C" or _OPTIONS["api-type"] == "C-API" or _OPTIONS["api-type"] == "COMBINED" then
defines
{
"AT_C_API"
}
end
if _OPTIONS["api-type"] == "CPP" or _OPTIONS["api-type"] == "CPP-API" or _OPTIONS["api-type"] == "COMBINED" then
defines
{
"AT_CPP_API"
}
end
if _OPTIONS["api-type"] == "NONE" or _OPTIONS["api-type"] == "none" then
defines
{
"AT_NO_API"
}
end
filter "system:windows"
cppdialect "c++20"
systemversion "latest"
links
{
}
filter "configurations:debug"
symbols "On"
filter "configurations:release"
symbols "On"
optimize "On"
filter "configurations:distribution"
symbols "Off"
optimize "On"
filter "system:linux"
filter "configurations:debug"
symbols "On"
filter "configurations:release"
symbols "On"
optimize "On"
filter "configurations:distribution"
symbols "Off"
optimize "On"
if _OPTIONS["enable-WSL"] then
toolchainversion "wsl2"
end
if not _OPTIONS["no-sandbox"] then
group"SANDBOX"
project "sandbox"
location "sandbox"
kind "ConsoleApp"
language "c++"
targetdir("%{wks.location}/bin/" .. outputdir .. "/x64/%{prj.name}")
objdir("%{wks.location}/bin-int/" .. outputdir .. "/x64/%{prj.name}")
includedirs
{
"../Athena/Athena/src"
}
links
{
"Athena"
}
files
{
"%{prj.location}/src/**.c",
"%{prj.location}/src/**.h",
"%{prj.location}/src/**.hpp",
"%{prj.location}/src/**.cpp",
}
filter "system:windows"
cppdialect "c++20"
systemversion "latest"
links
{
}
filter "configurations:debug"
symbols "On"
filter "configurations:release"
symbols "On"
optimize "On"
filter "configurations:distribution"
symbols "Off"
optimize "On"
filter "system:linux"
filter "configurations:debug"
symbols "On"
filter "configurations:release"
symbols "On"
optimize "On"
filter "configurations:distribution"
symbols "Off"
optimize "On"
if _OPTIONS["enable-WSL"] then
toolchainversion "wsl2"
end
end