-
Notifications
You must be signed in to change notification settings - Fork 0
/
SCompilerConfig
60 lines (47 loc) · 1.87 KB
/
SCompilerConfig
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
##############################################################################
# SCONS SCRIPT TO CHOOSE THE CORRECT COMPILER FLAGS #
##############################################################################
Import("main_env")
Import("colors")
# distinction between the debug/release variant
if main_env["target"] == "debug":
print(colors["yellow"]+"---DEBUG BUILD---"+colors["end"])
if main_env["sel_platform"] == "windows":
# MSVC
main_env.Append(CCFLAGS="/W3")
main_env.Append(CCFLAGS="/MDd")
main_env.Append(CCFLAGS="/Zi")
main_env.Append(CCFLAGS="/EHsc")
main_env.Append(CCFLAGS="/D_EBUG")
main_env.Append(CCFLAGS="/FS")
main_env.Append(CCFLAGS="/std:c++latest")
main_env.Append(LINKFLAGS="/DEBUG")
else:
env.Append(CCFLAGS="-O1")
env.Append(CCFLAGS="-g3")
env.Append(LINKFLAGS="-O1")
env.Append(LINKFLAGS="-g")
main_env.Append(CPPDEFINES=["DEBUG_ENABLED"])
main_env["variant_dir"] = "build_cache/debug/"
else:
print(colors["cyan"]+"---RELEASE BUILD---"+colors["end"])
if main_env["sel_platform"] == "windows":
# MSVC
main_env.Append(CCFLAGS="/W1")
main_env.Append(CCFLAGS="/MD")
main_env.Append(CCFLAGS="/Zi")
main_env.Append(CCFLAGS="/O2")
main_env.Append(CCFLAGS="/EHsc")
main_env.Append(CCFLAGS="/DNDEBUG")
main_env.Append(CCFLAGS="/FS")
main_env.Append(CCFLAGS="/std:c++latest")
main_env.Append(LINKFLAGS="/OPT:REF")
# LTO
main_env.AppendUnique(CCFLAGS="/GL")
main_env.AppendUnique(ARFLAGS="/LTCG")
else:
main_env.Append(CCFLAGS="-O3")
# LTO
main_env.Append(CCFLAGS="-flto")
main_env.Append(LINKFLAGS="-flto")
main_env["variant_dir"] = "build_cache/release/"