SCons: Misc improvements
* Delete old gcc 7 check * Use f-strings where it is easy * Use AddVariables instead of Add for collections of options Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
This commit is contained in:
18
SConstruct
18
SConstruct
@ -383,8 +383,7 @@ if env["platform"] not in platform_list:
|
|||||||
|
|
||||||
# Add platform-specific options.
|
# Add platform-specific options.
|
||||||
if env["platform"] in platform_opts:
|
if env["platform"] in platform_opts:
|
||||||
for opt in platform_opts[env["platform"]]:
|
opts.AddVariables(*platform_opts[env["platform"]])
|
||||||
opts.Add(opt)
|
|
||||||
|
|
||||||
# Platform-specific flags.
|
# Platform-specific flags.
|
||||||
# These can sometimes override default options, so they need to be processed
|
# These can sometimes override default options, so they need to be processed
|
||||||
@ -440,12 +439,11 @@ for name, path in modules_detected.items():
|
|||||||
else:
|
else:
|
||||||
enabled = False
|
enabled = False
|
||||||
|
|
||||||
opts.Add(BoolVariable("module_" + name + "_enabled", "Enable module '%s'" % (name,), enabled))
|
opts.Add(BoolVariable(f"module_{name}_enabled", f"Enable module '{name}'", enabled))
|
||||||
|
|
||||||
# Add module-specific options.
|
# Add module-specific options.
|
||||||
try:
|
try:
|
||||||
for opt in config.get_opts(env["platform"]):
|
opts.AddVariables(*config.get_opts(env["platform"]))
|
||||||
opts.Add(opt)
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -580,7 +578,7 @@ env.Append(RCFLAGS=env.get("rcflags", "").split())
|
|||||||
# Feature build profile
|
# Feature build profile
|
||||||
env.disabled_classes = []
|
env.disabled_classes = []
|
||||||
if env["build_profile"] != "":
|
if env["build_profile"] != "":
|
||||||
print('Using feature build profile: "{}"'.format(env["build_profile"]))
|
print(f'Using feature build profile: "{env["build_profile"]}"')
|
||||||
import json
|
import json
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -592,7 +590,7 @@ if env["build_profile"] != "":
|
|||||||
for c in dbo:
|
for c in dbo:
|
||||||
env[c] = dbo[c]
|
env[c] = dbo[c]
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
print_error('Failed to open feature build profile: "{}"'.format(env["build_profile"]))
|
print_error(f'Failed to open feature build profile: "{env["build_profile"]}"')
|
||||||
Exit(255)
|
Exit(255)
|
||||||
|
|
||||||
# 'dev_mode' and 'production' are aliases to set default options if they haven't been
|
# 'dev_mode' and 'production' are aliases to set default options if they haven't been
|
||||||
@ -854,8 +852,6 @@ else: # GCC, Clang
|
|||||||
|
|
||||||
if methods.using_gcc(env):
|
if methods.using_gcc(env):
|
||||||
common_warnings += ["-Wshadow", "-Wno-misleading-indentation"]
|
common_warnings += ["-Wshadow", "-Wno-misleading-indentation"]
|
||||||
if cc_version_major == 7: # Bogus warning fixed in 8+.
|
|
||||||
common_warnings += ["-Wno-strict-overflow"]
|
|
||||||
if cc_version_major < 11:
|
if cc_version_major < 11:
|
||||||
# Regression in GCC 9/10, spams so much in our variadic templates
|
# Regression in GCC 9/10, spams so much in our variadic templates
|
||||||
# that we need to outright disable it.
|
# that we need to outright disable it.
|
||||||
@ -931,7 +927,7 @@ env.module_icons_paths = []
|
|||||||
env.doc_class_path = platform_doc_class_path
|
env.doc_class_path = platform_doc_class_path
|
||||||
|
|
||||||
for name, path in modules_detected.items():
|
for name, path in modules_detected.items():
|
||||||
if not env["module_" + name + "_enabled"]:
|
if not env[f"module_{name}_enabled"]:
|
||||||
continue
|
continue
|
||||||
sys.path.insert(0, path)
|
sys.path.insert(0, path)
|
||||||
env.current_module = name
|
env.current_module = name
|
||||||
@ -1044,7 +1040,7 @@ if env["compiledb"]:
|
|||||||
|
|
||||||
if env["ninja"]:
|
if env["ninja"]:
|
||||||
if env.scons_version < (4, 2, 0):
|
if env.scons_version < (4, 2, 0):
|
||||||
print_error("The `ninja=yes` option requires SCons 4.2 or later, but your version is %s." % scons_raw_version)
|
print_error(f"The `ninja=yes` option requires SCons 4.2 or later, but your version is {scons_raw_version}.")
|
||||||
Exit(255)
|
Exit(255)
|
||||||
|
|
||||||
SetOption("experimental", "ninja")
|
SetOption("experimental", "ninja")
|
||||||
|
|||||||
Reference in New Issue
Block a user