SCons: Fix `CCFLAGS`, `LINKFLAGS`, etc. command line overrides
Also adds `CPPDEFINES` which allows passing new pre-processor defines, letting SCons handle passing `-D` or `/D` based on the compiler.
This commit is contained in:
parent
25a52c624e
commit
0d1894736e
37
SConstruct
37
SConstruct
|
@ -259,13 +259,16 @@ opts.Add(BoolVariable("builtin_zlib", "Use the built-in zlib library", True))
|
|||
opts.Add(BoolVariable("builtin_zstd", "Use the built-in Zstd library", True))
|
||||
|
||||
# Compilation environment setup
|
||||
opts.Add("CXX", "C++ compiler")
|
||||
opts.Add("CC", "C compiler")
|
||||
opts.Add("LINK", "Linker")
|
||||
opts.Add("CCFLAGS", "Custom flags for both the C and C++ compilers")
|
||||
opts.Add("CFLAGS", "Custom flags for the C compiler")
|
||||
opts.Add("CXXFLAGS", "Custom flags for the C++ compiler")
|
||||
opts.Add("LINKFLAGS", "Custom flags for the linker")
|
||||
# CXX, CC, and LINK directly set the equivalent `env` values (which may still
|
||||
# be overridden for a specific platform), the lowercase ones are appended.
|
||||
opts.Add("CXX", "C++ compiler binary")
|
||||
opts.Add("CC", "C compiler binary")
|
||||
opts.Add("LINK", "Linker binary")
|
||||
opts.Add("cppdefines", "Custom defines for the pre-processor")
|
||||
opts.Add("ccflags", "Custom flags for both the C and C++ compilers")
|
||||
opts.Add("cxxflags", "Custom flags for the C++ compiler")
|
||||
opts.Add("cflags", "Custom flags for the C compiler")
|
||||
opts.Add("linkflags", "Custom flags for the linker")
|
||||
|
||||
# Update the environment to have all above options defined
|
||||
# in following code (especially platform and custom_modules).
|
||||
|
@ -507,21 +510,11 @@ if selected_platform in platform_list:
|
|||
env.extra_suffix += "." + env["extra_suffix"]
|
||||
|
||||
# Environment flags
|
||||
CCFLAGS = env.get("CCFLAGS", "")
|
||||
env["CCFLAGS"] = ""
|
||||
env.Append(CCFLAGS=str(CCFLAGS).split())
|
||||
|
||||
CFLAGS = env.get("CFLAGS", "")
|
||||
env["CFLAGS"] = ""
|
||||
env.Append(CFLAGS=str(CFLAGS).split())
|
||||
|
||||
CXXFLAGS = env.get("CXXFLAGS", "")
|
||||
env["CXXFLAGS"] = ""
|
||||
env.Append(CXXFLAGS=str(CXXFLAGS).split())
|
||||
|
||||
LINKFLAGS = env.get("LINKFLAGS", "")
|
||||
env["LINKFLAGS"] = ""
|
||||
env.Append(LINKFLAGS=str(LINKFLAGS).split())
|
||||
env.Append(CPPDEFINES=env.get("cppdefines", "").split())
|
||||
env.Append(CCFLAGS=env.get("ccflags", "").split())
|
||||
env.Append(CXXFLAGS=env.get("cxxflags", "").split())
|
||||
env.Append(CFLAGS=env.get("cflags", "").split())
|
||||
env.Append(LINKFLAGS=env.get("linkflags", "").split())
|
||||
|
||||
# Feature build profile
|
||||
disabled_classes = []
|
||||
|
|
Loading…
Reference in New Issue