SCons: Refactor selected_platform
conditional
This commit is contained in:
parent
f6a78f83aa
commit
c6995be6e4
35
SConstruct
35
SConstruct
@ -303,11 +303,6 @@ else:
|
|||||||
selected_platform = "macos"
|
selected_platform = "macos"
|
||||||
elif sys.platform == "win32":
|
elif sys.platform == "win32":
|
||||||
selected_platform = "windows"
|
selected_platform = "windows"
|
||||||
else:
|
|
||||||
print("Could not detect platform automatically. Supported platforms:")
|
|
||||||
for x in platform_list:
|
|
||||||
print("\t" + x)
|
|
||||||
print("\nPlease run SCons again and select a valid platform: platform=<string>")
|
|
||||||
|
|
||||||
if selected_platform != "":
|
if selected_platform != "":
|
||||||
print("Automatically detected platform: " + selected_platform)
|
print("Automatically detected platform: " + selected_platform)
|
||||||
@ -334,6 +329,16 @@ if selected_platform == "javascript":
|
|||||||
print('Platform "javascript" has been renamed to "web" in Godot 4. Building for platform "web".')
|
print('Platform "javascript" has been renamed to "web" in Godot 4. Building for platform "web".')
|
||||||
selected_platform = "web"
|
selected_platform = "web"
|
||||||
|
|
||||||
|
if selected_platform not in platform_list:
|
||||||
|
if selected_platform == "":
|
||||||
|
print("Could not detect platform automatically.")
|
||||||
|
elif selected_platform != "list":
|
||||||
|
print(f'Invalid target platform "{selected_platform}".')
|
||||||
|
|
||||||
|
print(f"The following platforms are available:\n\t{'\n\t'.join(platform_list)}\n")
|
||||||
|
print("Please run SCons again and select a valid platform: platform=<string>.")
|
||||||
|
Exit(0 if selected_platform == "list" else 255)
|
||||||
|
|
||||||
# Make sure to update this to the found, valid platform as it's used through the buildsystem as the reference.
|
# Make sure to update this to the found, valid platform as it's used through the buildsystem as the reference.
|
||||||
# It should always be re-set after calling `opts.Update()` otherwise it uses the original input value.
|
# It should always be re-set after calling `opts.Update()` otherwise it uses the original input value.
|
||||||
env_base["platform"] = selected_platform
|
env_base["platform"] = selected_platform
|
||||||
@ -480,7 +485,6 @@ if not env_base["deprecated"]:
|
|||||||
if env_base["precision"] == "double":
|
if env_base["precision"] == "double":
|
||||||
env_base.Append(CPPDEFINES=["REAL_T_IS_DOUBLE"])
|
env_base.Append(CPPDEFINES=["REAL_T_IS_DOUBLE"])
|
||||||
|
|
||||||
if selected_platform in platform_list:
|
|
||||||
tmppath = "./platform/" + selected_platform
|
tmppath = "./platform/" + selected_platform
|
||||||
sys.path.insert(0, tmppath)
|
sys.path.insert(0, tmppath)
|
||||||
import detect
|
import detect
|
||||||
@ -1020,26 +1024,7 @@ if selected_platform in platform_list:
|
|||||||
if conf.CheckCHeader(header):
|
if conf.CheckCHeader(header):
|
||||||
env.AppendUnique(CPPDEFINES=[headers[header]])
|
env.AppendUnique(CPPDEFINES=[headers[header]])
|
||||||
|
|
||||||
elif selected_platform != "":
|
|
||||||
if selected_platform == "list":
|
|
||||||
print("The following platforms are available:\n")
|
|
||||||
else:
|
|
||||||
print('Invalid target platform "' + selected_platform + '".')
|
|
||||||
print("The following platforms were detected:\n")
|
|
||||||
|
|
||||||
for x in platform_list:
|
|
||||||
print("\t" + x)
|
|
||||||
|
|
||||||
print("\nPlease run SCons again and select a valid platform: platform=<string>")
|
|
||||||
|
|
||||||
if selected_platform == "list":
|
|
||||||
# Exit early to suppress the rest of the built-in SCons messages
|
|
||||||
Exit()
|
|
||||||
else:
|
|
||||||
Exit(255)
|
|
||||||
|
|
||||||
# The following only makes sense when the 'env' is defined, and assumes it is.
|
|
||||||
if "env" in locals():
|
|
||||||
# FIXME: This method mixes both cosmetic progress stuff and cache handling...
|
# FIXME: This method mixes both cosmetic progress stuff and cache handling...
|
||||||
methods.show_progress(env)
|
methods.show_progress(env)
|
||||||
# TODO: replace this with `env.Dump(format="json")`
|
# TODO: replace this with `env.Dump(format="json")`
|
||||||
|
Loading…
Reference in New Issue
Block a user