-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpremake5.lua
131 lines (103 loc) · 3.27 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
-- Phanes build configuration
VERSION = "1.0.0"
-- Override with specific platform if necessary
PLATFORM = os.target()
-- architecture.
ARCH = "x86_64"
-- SSE options:
-- SSE4: SSE
-- AVX: AVX
-- AVX2: AVX2
-- No SSE: FPU
-- None: Automatically detect SSE during build
SSE = "None"
phanesRoot = path.getabsolute(".")
phanesBin = path.join(phanesRoot, "bin")
phanesInt = path.join(phanesRoot, ".int")
phanesBuildFiles = path.join(phanesRoot, "build")
PhanesEngine = path.join(phanesRoot, "Engine")
PhanesRuntime = path.join(PhanesEngine, "Source/Runtime")
PhanesThirdParty = path.join(PhanesEngine, "Source/ThirdParty")
workspace "PhanesEngine"
cppdialect "C++20"
architecture (ARCH)
toolset "gcc"
flags { "MultiProcessorCompile" }
clangtidy "On"
debugger "gdb"
startproject "MathTestFPU"
configurations { "Debug", "Release" }
function linux_sse()
if SSE == "SSE" then
defines {"P_SSE__"}
buildoptions {"-msse4", "-msse2", "-msse3"}
elseif SSE == "AVX" then
defines { "P_AVX__" }
buildoptions {"-mavx", "-msse4", "-msse2", "-msse3"}
elseif SSE == "AVX2" then
defines { "P_AVX2__" }
buildoptions {"-mavx2", "-mavx", "-msse4", "-msse2", "-msse3"}
elseif SSE == "FPU" then
defines { "P_FORCE_FPU" }
end
end
function boilerplate()
language "C++"
location (phanesBuildFiles .. "/%{prj.name}")
targetdir (phanesBin .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
objdir (phanesInt .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
if PLATFORM == "linux" then
defines { "P_LINUX_BUILD" }
buildoptions {"-Wall", "-Wextra", "-Werror"}
linux_sse()
buildoptions { "-Wno-unused-parameter" , "-fms-extensions" }
end
filter "configurations:Debug"
defines { "DEBUG", "TRACE", "P_DEBUG"}
symbols "On"
buildmessage("Building %{prj.name} in debug mode")
filter "configurations:Release"
defines { "NDEBUG", "P_RELEASE" }
linktimeoptimization "On"
optimize "On"
intrinsics "On"
buildmessage("Building %{prj.name} in release mode")
filter{}
end
function third_party_boilerplate()
language "C++"
location (phanesBuildFiles .. "/%{prj.name}")
targetdir (phanesBin .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
objdir (phanesInt .. "/" .. VERSION .. "/%{cfg.buildcfg}/%{prj.name}")
if PLATFORM == "linux" then
buildoptions {"-Wall", "-Wextra", "-Werror"}
linux_sse()
end
filter "configurations:Debug"
defines { "DEBUG", "TRACE", "P_DEBUG"}
symbols "On"
buildmessage("Building %{prj.name} in debug mode")
filter "configurations:Release"
defines { "NDEBUG", "P_RELEASE" }
linktimeoptimization "On"
optimize "On"
intrinsics "On"
buildmessage("Building %{prj.name} in release mode")
filter{}
end
-- actions
function action_clean()
os.rmdir(phanesBin)
os.rmdir(phanesInt)
os.rmdir(phanesBuildFiles)
os.remove(phanesRoot .. "/Makefile")
end
newaction {
trigger = "clean",
description = "Clean the build",
execute = action_clean,
}
-- includeProjects here
include (phanesRoot .. "/Engine/Source/Runtime/Core/premake5.lua")
include (phanesRoot .. "/DevPlayground/premake5.lua")
include (PhanesRuntime .. "/Core/Tests/Math/MathTestFPU/premake5.lua")