-
Notifications
You must be signed in to change notification settings - Fork 0
/
tundra.lua
159 lines (148 loc) · 4.56 KB
/
tundra.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
local msvc_common = {
-- Unicode
"/DUNICODE",
"/D_UNICODE", -- _tcslen -> wcslen
-- Defines _DEBUG, _MT, and _DLL and causes the application to use the debug multithread-specific and DLL-specific version of the run-time library.
{
"/MDd",
Config = "*-msvc-debug-*"
}, -- Visual Studio 2019 version 16.9
-- https://docs.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-170
-- https://github.com/google/sanitizers/wiki/AddressSanitizer
-- https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm
-- {"/fsanitize=address", Config = "*-msvc-debug-*"},
"/D_CRT_SECURE_NO_WARNINGS",
"/D_WINSOCK_DEPRECATED_NO_WARNINGS",
"/W4", -- treat as error
"/we4701", -- Potentially uninitialized local variable 'name' used
"/we4715", -- 'function' : not all control paths return a value
"/we4244", -- conversion' conversion from 'type1' to 'type2', possible loss of data
-- disable (really?)
"/wd4100", -- unreferenced formal parameter
"/wd4706", -- assignment within conditional expression
"/wd4324", -- structure was padded due to alignment specifier
--
-- https://twitter.com/niklasfrykholm/status/1302085215313997825
-- You want both 4820 and 4121. 4121 is on with W4.
--
-- windows.h requires Microsoft language extensions?
-- "/Za" -- emits an error for language constructs that are not compatible with ANSI C89 or ISO C++11
-- Disables run-time type information
"/GR-", -- Use SEE (with VEX encoding) but not AVX
"/GS-", -- Disable Buffer Security Check
"/arch:AVX", -- Enable most speed optimizations
-- (this is an absolute must, without this option it's not possible to write fast code)
{
"/Od",
Config = "*-msvc-debug-*"
},
{
"/Ox", -- Maximize Speed
Config = "*-msvc-release-*"
},
-- https://docs.microsoft.com/en-us/cpp/build/reference/fp-specify-floating-point-behavior?view=msvc-170#fast
"/fp:fast"
-- generate auto vectorization reports
-- /Qvec-report:1
-- {"/FAsu", Config = "*-msvc-release-*"} --Creates a listing file containing assembler code
}
local lpp_link_common = {
{
"/FUNCTIONPADMIN",
Config = "*-msvc-debug-*"
},
{
"/OPT:NOREF",
Config = "*-msvc-debug-*"
},
{
"/OPT:NOICF",
Config = "*-msvc-debug-*"
},
{
"/DEBUG:FULL",
Config = "*-msvc-debug-*"
}
}
local clang_common = {
"-march=haswell", -- Haswell should be compatible with the 8th console generation
"-m64",
"-Wthread-safety",
"-g", -- debug info?
"-pthread",
"-fsanitize=address"
}
-- common link options for clang on linux (feed to compiler and linker)
local lld_common = {
"-pthread",
"-fsanitize=address"
}
Build {
Passes = {
CodeGeneration = {
Name = "Generate sources",
BuildOrder = 1
}
},
Configs = {
{
Name = "win64-msvc",
DefaultOnHost = "windows",
Tools = {
{
"msvc-vs2019",
TargetArch = "x64"
}
},
Env = {
CCOPTS = {
msvc_common,
"/std:c11"
},
CXXOPTS = {
msvc_common,
"/std:c++14",
"/EHsc" -- catch C++ exceptions only and tells the compiler to assume that functions declared as extern "C" never throw a C++ exception
},
PROGOPTS = {
lpp_link_common
},
GENERATE_PDB = {
"1",
Config = "*-msvc-debug-*"
}
}
},
{
Name = "linux-clang",
DefaultOnHost = "linux",
Tools = {
{
"clang-llvm",
Version = "14"
}
},
Env = {
-- drop LIBPREFIX prefix?
-- drop SHLIBPREFIX prefix?
CCOPTS = {
clang_common
},
CXXOPTS = {
clang_common
},
PROGOPTS = {
lld_common
-- "-lm", --math
}
}
}
},
Units = {
"units-vendor.lua",
-- "units-conv.lua", -- convention based build utilities
-- "units.lua"
"units-generated.lua",
"units2.lua"
}
}