SCons: Convert platform get_flags to dictionary

This commit is contained in:
Thaddeus Crews 2024-05-19 09:41:03 -05:00
parent 8e2141eac5
commit 896b003cc8
No known key found for this signature in database
GPG Key ID: 62181B86FE9E5D84
7 changed files with 38 additions and 36 deletions

View File

@ -122,6 +122,8 @@ for x in sorted(glob.glob("platform/*")):
platform_list += [x] platform_list += [x]
platform_opts[x] = detect.get_opts() platform_opts[x] = detect.get_opts()
platform_flags[x] = detect.get_flags() platform_flags[x] = detect.get_flags()
if isinstance(platform_flags[x], list): # backwards compatibility
platform_flags[x] = {flag[0]: flag[1] for flag in platform_flags[x]}
sys.path.remove(tmppath) sys.path.remove(tmppath)
sys.modules.pop("detect") sys.modules.pop("detect")
@ -569,9 +571,9 @@ if env["build_profile"] != "":
# Platform specific flags. # Platform specific flags.
# These can sometimes override default options. # These can sometimes override default options.
flag_list = platform_flags[env["platform"]] flag_list = platform_flags[env["platform"]]
for f in flag_list: for key, value in flag_list.items():
if f[0] not in ARGUMENTS or ARGUMENTS[f[0]] == "auto": # Allow command line to override platform flags if key not in ARGUMENTS or ARGUMENTS[key] == "auto": # Allow command line to override platform flags
env[f[0]] = f[1] env[key] = value
# '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
# set manually by the user. # set manually by the user.

View File

@ -67,11 +67,11 @@ def get_min_target_api():
def get_flags(): def get_flags():
return [ return {
("arch", "arm64"), # Default for convenience. "arch": "arm64", # Default for convenience.
("target", "template_debug"), "target": "template_debug",
("supported", ["mono"]), "supported": ["mono"],
] }
# Check if Android NDK version is installed # Check if Android NDK version is installed

View File

@ -47,13 +47,13 @@ def get_doc_path():
def get_flags(): def get_flags():
return [ return {
("arch", "arm64"), # Default for convenience. "arch": "arm64", # Default for convenience.
("target", "template_debug"), "target": "template_debug",
("use_volk", False), "use_volk": False,
("supported", ["mono"]), "supported": ["mono"],
("builtin_pcre2_with_jit", False), "builtin_pcre2_with_jit": False,
] }
def configure(env: "SConsEnvironment"): def configure(env: "SConsEnvironment"):

View File

@ -65,10 +65,10 @@ def get_doc_path():
def get_flags(): def get_flags():
return [ return {
("arch", detect_arch()), "arch": detect_arch(),
("supported", ["mono"]), "supported": ["mono"],
] }
def configure(env: "SConsEnvironment"): def configure(env: "SConsEnvironment"):

View File

@ -53,11 +53,11 @@ def get_doc_path():
def get_flags(): def get_flags():
return [ return {
("arch", detect_arch()), "arch": detect_arch(),
("use_volk", False), "use_volk": False,
("supported", ["mono"]), "supported": ["mono"],
] }
def configure(env: "SConsEnvironment"): def configure(env: "SConsEnvironment"):

View File

@ -65,21 +65,21 @@ def get_doc_path():
def get_flags(): def get_flags():
return [ return {
("arch", "wasm32"), "arch": "wasm32",
("target", "template_debug"), "target": "template_debug",
("builtin_pcre2_with_jit", False), "builtin_pcre2_with_jit": False,
("vulkan", False), "vulkan": False,
# Embree is heavy and requires too much memory (GH-70621). # Embree is heavy and requires too much memory (GH-70621).
("module_raycast_enabled", False), "module_raycast_enabled": False,
# Use -Os to prioritize optimizing for reduced file size. This is # Use -Os to prioritize optimizing for reduced file size. This is
# particularly valuable for the web platform because it directly # particularly valuable for the web platform because it directly
# decreases download time. # decreases download time.
# -Os reduces file size by around 5 MiB over -O3. -Oz only saves about # -Os reduces file size by around 5 MiB over -O3. -Oz only saves about
# 100 KiB over -Os, which does not justify the negative impact on # 100 KiB over -Os, which does not justify the negative impact on
# run-time performance. # run-time performance.
("optimize", "size"), "optimize": "size",
] }
def configure(env: "SConsEnvironment"): def configure(env: "SConsEnvironment"):

View File

@ -248,10 +248,10 @@ def get_doc_path():
def get_flags(): def get_flags():
arch = detect_build_env_arch() or detect_arch() arch = detect_build_env_arch() or detect_arch()
return [ return {
("arch", arch), "arch": arch,
("supported", ["mono"]), "supported": ["mono"],
] }
def build_res_file(target, source, env: "SConsEnvironment"): def build_res_file(target, source, env: "SConsEnvironment"):