forked from jpcy/xatlas
-
Notifications
You must be signed in to change notification settings - Fork 4
/
premake5.lua
99 lines (90 loc) · 1.99 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
newoption
{
trigger = "asan",
description = "Enable Clang AddressSanitizer"
}
newoption
{
trigger = "msan",
description = "Enable Clang MemorySanitizer"
}
newoption
{
trigger = "ubsan",
description = "Enable Clang UndefinedBehaviorSanitizer"
}
dofile("extra/shaders.lua")
if _ACTION == nil then
return
end
local asanEnabled = false
local msanEnabled = false
local ubsanEnabled = false
if _ACTION == "gmake" and _OPTIONS["cc"] == "clang" then
if _OPTIONS["asan"] then
asanEnabled = true
sanitizerEnabled = true
end
if _OPTIONS["msan"] then
msanEnabled = true
sanitizerEnabled = true
end
if _OPTIONS["ubsan"] then
ubsanEnabled = true
sanitizerEnabled = true
end
end
local sanitizerEnabled = asanEnabled or msanEnabled or ubsanEnabled
function sanitizer()
if asanEnabled then
buildoptions { "-fsanitize=address" }
linkoptions { "-fsanitize=address" }
end
if msanEnabled then
buildoptions { "-fsanitize=memory" }
linkoptions { "-fsanitize=memory" }
end
if ubsanEnabled then
buildoptions { "-fsanitize=undefined" }
linkoptions { "-fsanitize=undefined" }
end
if sanitizerEnabled then
buildoptions { "-fno-omit-frame-pointer" }
end
end
solution "xatlas"
configurations { "Release", "Debug" }
if _OPTIONS["cc"] ~= nil then
location(path.join("build", _ACTION) .. "_" .. _OPTIONS["cc"])
else
location(path.join("build", _ACTION))
end
platforms { "x86_64", "x86" }
startproject "viewer"
filter "platforms:x86"
architecture "x86"
filter "platforms:x86_64"
architecture "x86_64"
filter "configurations:Debug*"
defines { "_DEBUG" }
optimize "Debug"
symbols "On"
filter "configurations:Release"
defines "NDEBUG"
optimize "Full"
filter {}
if sanitizerEnabled then
optimize "Off"
symbols "On"
end
sanitizer()
project "xatlas"
kind "StaticLib"
language "C++"
cppdialect "C++11"
exceptionhandling "Off"
rtti "Off"
warnings "Extra"
files { "xatlas.cpp", "xatlas.h" }
sanitizer()
dofile("extra/projects.lua")