Skip to content

Commit de49025

Browse files
committed
Merge pull request godotengine#92124 from Repiteo/scons/platform-flags-dict
SCons: Convert platform `get_flags` to dictionary
2 parents f2f6727 + 896b003 commit de49025

File tree

7 files changed

+38
-36
lines changed

7 files changed

+38
-36
lines changed

SConstruct

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ for x in sorted(glob.glob("platform/*")):
122122
platform_list += [x]
123123
platform_opts[x] = detect.get_opts()
124124
platform_flags[x] = detect.get_flags()
125+
if isinstance(platform_flags[x], list): # backwards compatibility
126+
platform_flags[x] = {flag[0]: flag[1] for flag in platform_flags[x]}
125127
sys.path.remove(tmppath)
126128
sys.modules.pop("detect")
127129

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

576578
# 'dev_mode' and 'production' are aliases to set default options if they haven't been
577579
# set manually by the user.

platform/android/detect.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ def get_min_target_api():
6767

6868

6969
def get_flags():
70-
return [
71-
("arch", "arm64"), # Default for convenience.
72-
("target", "template_debug"),
73-
("supported", ["mono"]),
74-
]
70+
return {
71+
"arch": "arm64", # Default for convenience.
72+
"target": "template_debug",
73+
"supported": ["mono"],
74+
}
7575

7676

7777
# Check if Android NDK version is installed

platform/ios/detect.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ def get_doc_path():
4747

4848

4949
def get_flags():
50-
return [
51-
("arch", "arm64"), # Default for convenience.
52-
("target", "template_debug"),
53-
("use_volk", False),
54-
("supported", ["mono"]),
55-
("builtin_pcre2_with_jit", False),
56-
]
50+
return {
51+
"arch": "arm64", # Default for convenience.
52+
"target": "template_debug",
53+
"use_volk": False,
54+
"supported": ["mono"],
55+
"builtin_pcre2_with_jit": False,
56+
}
5757

5858

5959
def configure(env: "SConsEnvironment"):

platform/linuxbsd/detect.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ def get_doc_path():
6565

6666

6767
def get_flags():
68-
return [
69-
("arch", detect_arch()),
70-
("supported", ["mono"]),
71-
]
68+
return {
69+
"arch": detect_arch(),
70+
"supported": ["mono"],
71+
}
7272

7373

7474
def configure(env: "SConsEnvironment"):

platform/macos/detect.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ def get_doc_path():
5353

5454

5555
def get_flags():
56-
return [
57-
("arch", detect_arch()),
58-
("use_volk", False),
59-
("supported", ["mono"]),
60-
]
56+
return {
57+
"arch": detect_arch(),
58+
"use_volk": False,
59+
"supported": ["mono"],
60+
}
6161

6262

6363
def configure(env: "SConsEnvironment"):

platform/web/detect.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,21 @@ def get_doc_path():
6565

6666

6767
def get_flags():
68-
return [
69-
("arch", "wasm32"),
70-
("target", "template_debug"),
71-
("builtin_pcre2_with_jit", False),
72-
("vulkan", False),
68+
return {
69+
"arch": "wasm32",
70+
"target": "template_debug",
71+
"builtin_pcre2_with_jit": False,
72+
"vulkan": False,
7373
# Embree is heavy and requires too much memory (GH-70621).
74-
("module_raycast_enabled", False),
74+
"module_raycast_enabled": False,
7575
# Use -Os to prioritize optimizing for reduced file size. This is
7676
# particularly valuable for the web platform because it directly
7777
# decreases download time.
7878
# -Os reduces file size by around 5 MiB over -O3. -Oz only saves about
7979
# 100 KiB over -Os, which does not justify the negative impact on
8080
# run-time performance.
81-
("optimize", "size"),
82-
]
81+
"optimize": "size",
82+
}
8383

8484

8585
def configure(env: "SConsEnvironment"):

platform/windows/detect.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,10 @@ def get_doc_path():
248248
def get_flags():
249249
arch = detect_build_env_arch() or detect_arch()
250250

251-
return [
252-
("arch", arch),
253-
("supported", ["mono"]),
254-
]
251+
return {
252+
"arch": arch,
253+
"supported": ["mono"],
254+
}
255255

256256

257257
def build_res_file(target, source, env: "SConsEnvironment"):

0 commit comments

Comments
 (0)