b b but muh unit tests. the current braindead rust twats maintaining premake5 cant even target their own compiler backend. AuroraPipeline/Build#4 https://github.com/premake/premake-core/pull/1852

This commit is contained in:
Reece Wilson 2022-12-17 23:00:57 +00:00
parent b084bea561
commit da9ae8d0f7

128
src/tools/gcc.lua Normal file → Executable file
View File

@ -47,6 +47,29 @@
-- Returns list of C compiler flags for a configuration.
--
gcc.shared = {
}
gcc.cflags = {
cdialect = {
["C89"] = "-std=c89",
["C90"] = "-std=c90",
["C99"] = "-std=c99",
["C11"] = "-std=c11",
["C17"] = "-std=c17",
["gnu89"] = "-std=gnu89",
["gnu90"] = "-std=gnu90",
["gnu99"] = "-std=gnu99",
["gnu11"] = "-std=gnu11",
["gnu17"] = "-std=gnu17"
},
visibility = {
Default = "-fvisibility=default",
Hidden = "-fvisibility=hidden",
Internal = "-fvisibility=internal",
Protected = "-fvisibility=protected",
},
architecture = {
x86 = "-m32",
x86_64 = "-m64",
@ -139,21 +162,6 @@
}
}
gcc.cflags = {
cdialect = {
["C89"] = "-std=c89",
["C90"] = "-std=c90",
["C99"] = "-std=c99",
["C11"] = "-std=c11",
["C17"] = "-std=c17",
["gnu89"] = "-std=gnu89",
["gnu90"] = "-std=gnu90",
["gnu99"] = "-std=gnu99",
["gnu11"] = "-std=gnu11",
["gnu17"] = "-std=gnu17"
}
}
function gcc.getcflags(cfg)
local shared_flags = config.mapFlags(cfg, gcc.shared)
local cflags = config.mapFlags(cfg, gcc.cflags)
@ -240,6 +248,96 @@
},
inlinesvisibility = {
Hidden = "-fvisibility-inlines-hidden"
},
architecture = {
x86 = "-m32",
x86_64 = "-m64",
},
flags = {
FatalCompileWarnings = "-Werror",
LinkTimeOptimization = "-flto",
ShadowedVariables = "-Wshadow",
UndefinedIdentifiers = "-Wundef",
},
floatingpoint = {
Fast = "-ffast-math",
Strict = "-ffloat-store",
},
strictaliasing = {
Off = "-fno-strict-aliasing",
Level1 = { "-fstrict-aliasing", "-Wstrict-aliasing=1" },
Level2 = { "-fstrict-aliasing", "-Wstrict-aliasing=2" },
Level3 = { "-fstrict-aliasing", "-Wstrict-aliasing=3" },
},
openmp = {
On = "-fopenmp"
},
optimize = {
Off = "-O0",
On = "-O2",
Debug = "-Og",
Full = "-O3",
Size = "-Os",
Speed = "-O3",
},
pic = {
On = "-fPIC",
},
vectorextensions = {
AVX = "-mavx",
AVX2 = "-mavx2",
SSE = "-msse",
SSE2 = "-msse2",
SSE3 = "-msse3",
SSSE3 = "-mssse3",
["SSE4.1"] = "-msse4.1",
["SSE4.2"] = "-msse4.2",
},
isaextensions = {
MOVBE = "-mmovbe",
POPCNT = "-mpopcnt",
PCLMUL = "-mpclmul",
LZCNT = "-mlzcnt",
BMI = "-mbmi",
BMI2 = "-mbmi2",
F16C = "-mf16c",
AES = "-maes",
FMA = "-mfma",
FMA4 = "-mfma4",
RDRND = "-mrdrnd",
},
warnings = {
Off = "-w",
High = "-Wall",
Extra = {"-Wall", "-Wextra"},
Everything = "-Weverything",
},
externalwarnings = {
Default = "-Wsystem-headers",
High = "-Wsystem-headers",
Extra = "-Wsystem-headers",
Everything = "-Wsystem-headers",
},
symbols = function(cfg, mappings)
local values = gcc.getdebugformat(cfg)
local debugformat = values[cfg.debugformat] or ""
return {
On = "-g" .. debugformat,
FastLink = "-g" .. debugformat,
Full = "-g" .. debugformat,
}
end,
unsignedchar = {
On = "-funsigned-char",
Off = "-fno-unsigned-char"
},
omitframepointer = {
On = "-fomit-frame-pointer",
Off = "-fno-omit-frame-pointer"
},
compileas = {
["Objective-C"] = "-x objective-c",
["Objective-C++"] = "-x objective-c++",
}
}