Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCons: Convert platform get_flags to dictionary #92124

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ for x in sorted(glob.glob("platform/*")):
platform_list += [x]
platform_opts[x] = detect.get_opts()
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.modules.pop("detect")

Expand Down Expand Up @@ -569,9 +571,9 @@ if env["build_profile"] != "":
# Platform specific flags.
# These can sometimes override default options.
flag_list = platform_flags[env["platform"]]
for f in flag_list:
if f[0] not in ARGUMENTS or ARGUMENTS[f[0]] == "auto": # Allow command line to override platform flags
env[f[0]] = f[1]
for key, value in flag_list.items():
if key not in ARGUMENTS or ARGUMENTS[key] == "auto": # Allow command line to override platform flags
env[key] = value

# 'dev_mode' and 'production' are aliases to set default options if they haven't been
# set manually by the user.
Expand Down
10 changes: 5 additions & 5 deletions platform/android/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ def get_min_target_api():


def get_flags():
return [
("arch", "arm64"), # Default for convenience.
("target", "template_debug"),
("supported", ["mono"]),
]
return {
"arch": "arm64", # Default for convenience.
"target": "template_debug",
"supported": ["mono"],
}


# Check if Android NDK version is installed
Expand Down
14 changes: 7 additions & 7 deletions platform/ios/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ def get_doc_path():


def get_flags():
return [
("arch", "arm64"), # Default for convenience.
("target", "template_debug"),
("use_volk", False),
("supported", ["mono"]),
("builtin_pcre2_with_jit", False),
]
return {
"arch": "arm64", # Default for convenience.
"target": "template_debug",
"use_volk": False,
"supported": ["mono"],
"builtin_pcre2_with_jit": False,
}


def configure(env: "SConsEnvironment"):
Expand Down
8 changes: 4 additions & 4 deletions platform/linuxbsd/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ def get_doc_path():


def get_flags():
return [
("arch", detect_arch()),
("supported", ["mono"]),
]
return {
"arch": detect_arch(),
"supported": ["mono"],
}


def configure(env: "SConsEnvironment"):
Expand Down
10 changes: 5 additions & 5 deletions platform/macos/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def get_doc_path():


def get_flags():
return [
("arch", detect_arch()),
("use_volk", False),
("supported", ["mono"]),
]
return {
"arch": detect_arch(),
"use_volk": False,
"supported": ["mono"],
}


def configure(env: "SConsEnvironment"):
Expand Down
16 changes: 8 additions & 8 deletions platform/web/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,21 @@ def get_doc_path():


def get_flags():
return [
("arch", "wasm32"),
("target", "template_debug"),
("builtin_pcre2_with_jit", False),
("vulkan", False),
return {
"arch": "wasm32",
"target": "template_debug",
"builtin_pcre2_with_jit": False,
"vulkan": False,
# 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
# particularly valuable for the web platform because it directly
# decreases download time.
# -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
# run-time performance.
("optimize", "size"),
]
"optimize": "size",
}


def configure(env: "SConsEnvironment"):
Expand Down
8 changes: 4 additions & 4 deletions platform/windows/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ def get_doc_path():
def get_flags():
arch = detect_build_env_arch() or detect_arch()

return [
("arch", arch),
("supported", ["mono"]),
]
return {
"arch": arch,
"supported": ["mono"],
}


def build_res_file(target, source, env: "SConsEnvironment"):
Expand Down
Loading