mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 19:42:43 +00:00
SCons: Refactor selected_platform
conditional
This commit is contained in:
parent
f6a78f83aa
commit
c6995be6e4
319
SConstruct
319
SConstruct
@ -303,11 +303,6 @@ else:
|
||||
selected_platform = "macos"
|
||||
elif sys.platform == "win32":
|
||||
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 != "":
|
||||
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".')
|
||||
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.
|
||||
# It should always be re-set after calling `opts.Update()` otherwise it uses the original input value.
|
||||
env_base["platform"] = selected_platform
|
||||
@ -480,20 +485,19 @@ if not env_base["deprecated"]:
|
||||
if env_base["precision"] == "double":
|
||||
env_base.Append(CPPDEFINES=["REAL_T_IS_DOUBLE"])
|
||||
|
||||
if selected_platform in platform_list:
|
||||
tmppath = "./platform/" + selected_platform
|
||||
sys.path.insert(0, tmppath)
|
||||
import detect
|
||||
tmppath = "./platform/" + selected_platform
|
||||
sys.path.insert(0, tmppath)
|
||||
import detect
|
||||
|
||||
env = env_base.Clone()
|
||||
env = env_base.Clone()
|
||||
|
||||
# Default num_jobs to local cpu count if not user specified.
|
||||
# SCons has a peculiarity where user-specified options won't be overridden
|
||||
# by SetOption, so we can rely on this to know if we should use our default.
|
||||
initial_num_jobs = env.GetOption("num_jobs")
|
||||
altered_num_jobs = initial_num_jobs + 1
|
||||
env.SetOption("num_jobs", altered_num_jobs)
|
||||
if env.GetOption("num_jobs") == altered_num_jobs:
|
||||
# Default num_jobs to local cpu count if not user specified.
|
||||
# SCons has a peculiarity where user-specified options won't be overridden
|
||||
# by SetOption, so we can rely on this to know if we should use our default.
|
||||
initial_num_jobs = env.GetOption("num_jobs")
|
||||
altered_num_jobs = initial_num_jobs + 1
|
||||
env.SetOption("num_jobs", altered_num_jobs)
|
||||
if env.GetOption("num_jobs") == altered_num_jobs:
|
||||
cpu_count = os.cpu_count()
|
||||
if cpu_count is None:
|
||||
print("Couldn't auto-detect CPU count to configure build parallelism. Specify it with the -j argument.")
|
||||
@ -505,21 +509,21 @@ if selected_platform in platform_list:
|
||||
)
|
||||
env.SetOption("num_jobs", safer_cpu_count)
|
||||
|
||||
env.extra_suffix = ""
|
||||
env.extra_suffix = ""
|
||||
|
||||
if env["extra_suffix"] != "":
|
||||
if env["extra_suffix"] != "":
|
||||
env.extra_suffix += "." + env["extra_suffix"]
|
||||
|
||||
# Environment flags
|
||||
env.Append(CPPDEFINES=env.get("cppdefines", "").split())
|
||||
env.Append(CCFLAGS=env.get("ccflags", "").split())
|
||||
env.Append(CXXFLAGS=env.get("cxxflags", "").split())
|
||||
env.Append(CFLAGS=env.get("cflags", "").split())
|
||||
env.Append(LINKFLAGS=env.get("linkflags", "").split())
|
||||
# Environment flags
|
||||
env.Append(CPPDEFINES=env.get("cppdefines", "").split())
|
||||
env.Append(CCFLAGS=env.get("ccflags", "").split())
|
||||
env.Append(CXXFLAGS=env.get("cxxflags", "").split())
|
||||
env.Append(CFLAGS=env.get("cflags", "").split())
|
||||
env.Append(LINKFLAGS=env.get("linkflags", "").split())
|
||||
|
||||
# Feature build profile
|
||||
disabled_classes = []
|
||||
if env["build_profile"] != "":
|
||||
# Feature build profile
|
||||
disabled_classes = []
|
||||
if env["build_profile"] != "":
|
||||
print("Using feature build profile: " + env["build_profile"])
|
||||
import json
|
||||
|
||||
@ -534,32 +538,32 @@ if selected_platform in platform_list:
|
||||
except:
|
||||
print("Error opening feature build profile: " + env["build_profile"])
|
||||
Exit(255)
|
||||
methods.write_disabled_classes(disabled_classes)
|
||||
methods.write_disabled_classes(disabled_classes)
|
||||
|
||||
# Platform specific flags.
|
||||
# These can sometimes override default options.
|
||||
flag_list = platform_flags[selected_platform]
|
||||
for f in flag_list:
|
||||
# Platform specific flags.
|
||||
# These can sometimes override default options.
|
||||
flag_list = platform_flags[selected_platform]
|
||||
for f in flag_list:
|
||||
if not (f[0] in ARGUMENTS) or ARGUMENTS[f[0]] == "auto": # Allow command line to override platform flags
|
||||
env[f[0]] = f[1]
|
||||
|
||||
# 'dev_mode' and 'production' are aliases to set default options if they haven't been
|
||||
# set manually by the user.
|
||||
# These need to be checked *after* platform specific flags so that different
|
||||
# default values can be set (e.g. to keep LTO off for `production` on some platforms).
|
||||
if env["dev_mode"]:
|
||||
# 'dev_mode' and 'production' are aliases to set default options if they haven't been
|
||||
# set manually by the user.
|
||||
# These need to be checked *after* platform specific flags so that different
|
||||
# default values can be set (e.g. to keep LTO off for `production` on some platforms).
|
||||
if env["dev_mode"]:
|
||||
env["verbose"] = methods.get_cmdline_bool("verbose", True)
|
||||
env["warnings"] = ARGUMENTS.get("warnings", "extra")
|
||||
env["werror"] = methods.get_cmdline_bool("werror", True)
|
||||
env["tests"] = methods.get_cmdline_bool("tests", True)
|
||||
if env["production"]:
|
||||
if env["production"]:
|
||||
env["use_static_cpp"] = methods.get_cmdline_bool("use_static_cpp", True)
|
||||
env["debug_symbols"] = methods.get_cmdline_bool("debug_symbols", False)
|
||||
# LTO "auto" means we handle the preferred option in each platform detect.py.
|
||||
env["lto"] = ARGUMENTS.get("lto", "auto")
|
||||
|
||||
# Run SCU file generation script if in a SCU build.
|
||||
if env["scu_build"]:
|
||||
# Run SCU file generation script if in a SCU build.
|
||||
if env["scu_build"]:
|
||||
max_includes_per_scu = 8
|
||||
if env_base.dev_build == True:
|
||||
max_includes_per_scu = 1024
|
||||
@ -571,18 +575,18 @@ if selected_platform in platform_list:
|
||||
|
||||
methods.set_scu_folders(scu_builders.generate_scu_files(max_includes_per_scu))
|
||||
|
||||
# Must happen after the flags' definition, as configure is when most flags
|
||||
# are actually handled to change compile options, etc.
|
||||
detect.configure(env)
|
||||
# Must happen after the flags' definition, as configure is when most flags
|
||||
# are actually handled to change compile options, etc.
|
||||
detect.configure(env)
|
||||
|
||||
print(f'Building for platform "{selected_platform}", architecture "{env["arch"]}", target "{env["target"]}".')
|
||||
if env.dev_build:
|
||||
print(f'Building for platform "{selected_platform}", architecture "{env["arch"]}", target "{env["target"]}".')
|
||||
if env.dev_build:
|
||||
print("NOTE: Developer build, with debug optimization level and debug symbols (unless overridden).")
|
||||
|
||||
# Set optimize and debug_symbols flags.
|
||||
# "custom" means do nothing and let users set their own optimization flags.
|
||||
# Needs to happen after configure to have `env.msvc` defined.
|
||||
if env.msvc:
|
||||
# Set optimize and debug_symbols flags.
|
||||
# "custom" means do nothing and let users set their own optimization flags.
|
||||
# Needs to happen after configure to have `env.msvc` defined.
|
||||
if env.msvc:
|
||||
if env["debug_symbols"]:
|
||||
env.Append(CCFLAGS=["/Zi", "/FS"])
|
||||
env.Append(LINKFLAGS=["/DEBUG:FULL"])
|
||||
@ -600,7 +604,7 @@ if selected_platform in platform_list:
|
||||
env.Append(LINKFLAGS=["/OPT:REF"])
|
||||
elif env["optimize"] == "debug" or env["optimize"] == "none":
|
||||
env.Append(CCFLAGS=["/Od"])
|
||||
else:
|
||||
else:
|
||||
if env["debug_symbols"]:
|
||||
# Adding dwarf-4 explicitly makes stacktraces work with clang builds,
|
||||
# otherwise addr2line doesn't understand them
|
||||
@ -628,38 +632,38 @@ if selected_platform in platform_list:
|
||||
elif env["optimize"] == "none":
|
||||
env.Append(CCFLAGS=["-O0"])
|
||||
|
||||
# Needs to happen after configure to handle "auto".
|
||||
if env["lto"] != "none":
|
||||
# Needs to happen after configure to handle "auto".
|
||||
if env["lto"] != "none":
|
||||
print("Using LTO: " + env["lto"])
|
||||
|
||||
# Set our C and C++ standard requirements.
|
||||
# C++17 is required as we need guaranteed copy elision as per GH-36436.
|
||||
# Prepending to make it possible to override.
|
||||
# This needs to come after `configure`, otherwise we don't have env.msvc.
|
||||
if not env.msvc:
|
||||
# Set our C and C++ standard requirements.
|
||||
# C++17 is required as we need guaranteed copy elision as per GH-36436.
|
||||
# Prepending to make it possible to override.
|
||||
# This needs to come after `configure`, otherwise we don't have env.msvc.
|
||||
if not env.msvc:
|
||||
# Specifying GNU extensions support explicitly, which are supported by
|
||||
# both GCC and Clang. Both currently default to gnu11 and gnu++14.
|
||||
env.Prepend(CFLAGS=["-std=gnu11"])
|
||||
env.Prepend(CXXFLAGS=["-std=gnu++17"])
|
||||
else:
|
||||
else:
|
||||
# MSVC doesn't have clear C standard support, /std only covers C++.
|
||||
# We apply it to CCFLAGS (both C and C++ code) in case it impacts C features.
|
||||
env.Prepend(CCFLAGS=["/std:c++17"])
|
||||
|
||||
# Enforce our minimal compiler version requirements
|
||||
cc_version = methods.get_compiler_version(env) or {
|
||||
# Enforce our minimal compiler version requirements
|
||||
cc_version = methods.get_compiler_version(env) or {
|
||||
"major": None,
|
||||
"minor": None,
|
||||
"patch": None,
|
||||
"metadata1": None,
|
||||
"metadata2": None,
|
||||
"date": None,
|
||||
}
|
||||
cc_version_major = int(cc_version["major"] or -1)
|
||||
cc_version_minor = int(cc_version["minor"] or -1)
|
||||
cc_version_metadata1 = cc_version["metadata1"] or ""
|
||||
}
|
||||
cc_version_major = int(cc_version["major"] or -1)
|
||||
cc_version_minor = int(cc_version["minor"] or -1)
|
||||
cc_version_metadata1 = cc_version["metadata1"] or ""
|
||||
|
||||
if methods.using_gcc(env):
|
||||
if methods.using_gcc(env):
|
||||
if cc_version_major == -1:
|
||||
print(
|
||||
"Couldn't detect compiler version, skipping version checks. "
|
||||
@ -691,7 +695,7 @@ if selected_platform in platform_list:
|
||||
"to switch to posix threads."
|
||||
)
|
||||
Exit(255)
|
||||
elif methods.using_clang(env):
|
||||
elif methods.using_clang(env):
|
||||
if cc_version_major == -1:
|
||||
print(
|
||||
"Couldn't detect compiler version, skipping version checks. "
|
||||
@ -720,18 +724,18 @@ if selected_platform in platform_list:
|
||||
)
|
||||
Exit(255)
|
||||
|
||||
# Disable exception handling. Godot doesn't use exceptions anywhere, and this
|
||||
# saves around 20% of binary size and very significant build time (GH-80513).
|
||||
if env["disable_exceptions"]:
|
||||
# Disable exception handling. Godot doesn't use exceptions anywhere, and this
|
||||
# saves around 20% of binary size and very significant build time (GH-80513).
|
||||
if env["disable_exceptions"]:
|
||||
if env.msvc:
|
||||
env.Append(CPPDEFINES=[("_HAS_EXCEPTIONS", 0)])
|
||||
else:
|
||||
env.Append(CXXFLAGS=["-fno-exceptions"])
|
||||
elif env.msvc:
|
||||
elif env.msvc:
|
||||
env.Append(CXXFLAGS=["/EHsc"])
|
||||
|
||||
# Configure compiler warnings
|
||||
if env.msvc: # MSVC
|
||||
# Configure compiler warnings
|
||||
if env.msvc: # MSVC
|
||||
if env["warnings"] == "no":
|
||||
env.Append(CCFLAGS=["/w"])
|
||||
else:
|
||||
@ -762,7 +766,7 @@ if selected_platform in platform_list:
|
||||
if env["werror"]:
|
||||
env.Append(CCFLAGS=["/WX"])
|
||||
env.Append(LINKFLAGS=["/WX"])
|
||||
else: # GCC, Clang
|
||||
else: # GCC, Clang
|
||||
common_warnings = []
|
||||
|
||||
if methods.using_gcc(env):
|
||||
@ -813,34 +817,34 @@ if selected_platform in platform_list:
|
||||
if env["werror"]:
|
||||
env.Append(CCFLAGS=["-Werror"])
|
||||
|
||||
if hasattr(detect, "get_program_suffix"):
|
||||
if hasattr(detect, "get_program_suffix"):
|
||||
suffix = "." + detect.get_program_suffix()
|
||||
else:
|
||||
else:
|
||||
suffix = "." + selected_platform
|
||||
|
||||
suffix += "." + env["target"]
|
||||
if env.dev_build:
|
||||
suffix += "." + env["target"]
|
||||
if env.dev_build:
|
||||
suffix += ".dev"
|
||||
|
||||
if env_base["precision"] == "double":
|
||||
if env_base["precision"] == "double":
|
||||
suffix += ".double"
|
||||
|
||||
suffix += "." + env["arch"]
|
||||
suffix += "." + env["arch"]
|
||||
|
||||
if not env["threads"]:
|
||||
if not env["threads"]:
|
||||
suffix += ".nothreads"
|
||||
|
||||
suffix += env.extra_suffix
|
||||
suffix += env.extra_suffix
|
||||
|
||||
sys.path.remove(tmppath)
|
||||
sys.modules.pop("detect")
|
||||
sys.path.remove(tmppath)
|
||||
sys.modules.pop("detect")
|
||||
|
||||
modules_enabled = OrderedDict()
|
||||
env.module_dependencies = {}
|
||||
env.module_icons_paths = []
|
||||
env.doc_class_path = platform_doc_class_path
|
||||
modules_enabled = OrderedDict()
|
||||
env.module_dependencies = {}
|
||||
env.module_icons_paths = []
|
||||
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"]:
|
||||
continue
|
||||
sys.path.insert(0, path)
|
||||
@ -873,10 +877,10 @@ if selected_platform in platform_list:
|
||||
sys.path.remove(path)
|
||||
sys.modules.pop("config")
|
||||
|
||||
env.module_list = modules_enabled
|
||||
methods.sort_module_list(env)
|
||||
env.module_list = modules_enabled
|
||||
methods.sort_module_list(env)
|
||||
|
||||
if env.editor_build:
|
||||
if env.editor_build:
|
||||
# Add editor-specific dependencies to the dependency graph.
|
||||
env.module_add_dependencies("editor", ["freetype", "svg"])
|
||||
|
||||
@ -885,34 +889,34 @@ if selected_platform in platform_list:
|
||||
print("Not all modules required by editor builds are enabled.")
|
||||
Exit(255)
|
||||
|
||||
methods.generate_version_header(env.module_version_string)
|
||||
methods.generate_version_header(env.module_version_string)
|
||||
|
||||
env["PROGSUFFIX_WRAP"] = suffix + env.module_version_string + ".console" + env["PROGSUFFIX"]
|
||||
env["PROGSUFFIX"] = suffix + env.module_version_string + env["PROGSUFFIX"]
|
||||
env["OBJSUFFIX"] = suffix + env["OBJSUFFIX"]
|
||||
# (SH)LIBSUFFIX will be used for our own built libraries
|
||||
# LIBSUFFIXES contains LIBSUFFIX and SHLIBSUFFIX by default,
|
||||
# so we need to append the default suffixes to keep the ability
|
||||
# to link against thirdparty libraries (.a, .so, .lib, etc.).
|
||||
if os.name == "nt":
|
||||
env["PROGSUFFIX_WRAP"] = suffix + env.module_version_string + ".console" + env["PROGSUFFIX"]
|
||||
env["PROGSUFFIX"] = suffix + env.module_version_string + env["PROGSUFFIX"]
|
||||
env["OBJSUFFIX"] = suffix + env["OBJSUFFIX"]
|
||||
# (SH)LIBSUFFIX will be used for our own built libraries
|
||||
# LIBSUFFIXES contains LIBSUFFIX and SHLIBSUFFIX by default,
|
||||
# so we need to append the default suffixes to keep the ability
|
||||
# to link against thirdparty libraries (.a, .so, .lib, etc.).
|
||||
if os.name == "nt":
|
||||
# On Windows, only static libraries and import libraries can be
|
||||
# statically linked - both using .lib extension
|
||||
env["LIBSUFFIXES"] += [env["LIBSUFFIX"]]
|
||||
else:
|
||||
else:
|
||||
env["LIBSUFFIXES"] += [env["LIBSUFFIX"], env["SHLIBSUFFIX"]]
|
||||
env["LIBSUFFIX"] = suffix + env["LIBSUFFIX"]
|
||||
env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"]
|
||||
env["LIBSUFFIX"] = suffix + env["LIBSUFFIX"]
|
||||
env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"]
|
||||
|
||||
env["OBJPREFIX"] = env["object_prefix"]
|
||||
env["SHOBJPREFIX"] = env["object_prefix"]
|
||||
env["OBJPREFIX"] = env["object_prefix"]
|
||||
env["SHOBJPREFIX"] = env["object_prefix"]
|
||||
|
||||
if env["disable_3d"]:
|
||||
if env["disable_3d"]:
|
||||
if env.editor_build:
|
||||
print("Build option 'disable_3d=yes' cannot be used for editor builds, only for export template builds.")
|
||||
Exit(255)
|
||||
else:
|
||||
env.Append(CPPDEFINES=["_3D_DISABLED"])
|
||||
if env["disable_advanced_gui"]:
|
||||
if env["disable_advanced_gui"]:
|
||||
if env.editor_build:
|
||||
print(
|
||||
"Build option 'disable_advanced_gui=yes' cannot be used for editor builds, "
|
||||
@ -921,15 +925,15 @@ if selected_platform in platform_list:
|
||||
Exit(255)
|
||||
else:
|
||||
env.Append(CPPDEFINES=["ADVANCED_GUI_DISABLED"])
|
||||
if env["minizip"]:
|
||||
if env["minizip"]:
|
||||
env.Append(CPPDEFINES=["MINIZIP_ENABLED"])
|
||||
if env["brotli"]:
|
||||
if env["brotli"]:
|
||||
env.Append(CPPDEFINES=["BROTLI_ENABLED"])
|
||||
|
||||
if not env["verbose"]:
|
||||
if not env["verbose"]:
|
||||
methods.no_verbose(sys, env)
|
||||
|
||||
GLSL_BUILDERS = {
|
||||
GLSL_BUILDERS = {
|
||||
"RD_GLSL": env.Builder(
|
||||
action=env.Run(glsl_builders.build_rd_headers),
|
||||
suffix="glsl.gen.h",
|
||||
@ -945,32 +949,32 @@ if selected_platform in platform_list:
|
||||
suffix="glsl.gen.h",
|
||||
src_suffix=".glsl",
|
||||
),
|
||||
}
|
||||
env.Append(BUILDERS=GLSL_BUILDERS)
|
||||
}
|
||||
env.Append(BUILDERS=GLSL_BUILDERS)
|
||||
|
||||
scons_cache_path = os.environ.get("SCONS_CACHE")
|
||||
if scons_cache_path != None:
|
||||
scons_cache_path = os.environ.get("SCONS_CACHE")
|
||||
if scons_cache_path != None:
|
||||
CacheDir(scons_cache_path)
|
||||
print("Scons cache enabled... (path: '" + scons_cache_path + "')")
|
||||
|
||||
if env["vsproj"]:
|
||||
if env["vsproj"]:
|
||||
env.vs_incs = []
|
||||
env.vs_srcs = []
|
||||
|
||||
# CompileDB and Ninja are only available with certain SCons versions which
|
||||
# not everybody might have yet, so we have to check.
|
||||
from SCons import __version__ as scons_raw_version
|
||||
# CompileDB and Ninja are only available with certain SCons versions which
|
||||
# not everybody might have yet, so we have to check.
|
||||
from SCons import __version__ as scons_raw_version
|
||||
|
||||
scons_ver = env._get_major_minor_revision(scons_raw_version)
|
||||
if env["compiledb"] and scons_ver < (4, 0, 0):
|
||||
scons_ver = env._get_major_minor_revision(scons_raw_version)
|
||||
if env["compiledb"] and scons_ver < (4, 0, 0):
|
||||
# Generating the compilation DB (`compile_commands.json`) requires SCons 4.0.0 or later.
|
||||
print("The `compiledb=yes` option requires SCons 4.0 or later, but your version is %s." % scons_raw_version)
|
||||
Exit(255)
|
||||
if scons_ver >= (4, 0, 0):
|
||||
if scons_ver >= (4, 0, 0):
|
||||
env.Tool("compilation_db")
|
||||
env.Alias("compiledb", env.CompilationDatabase())
|
||||
|
||||
if env["ninja"]:
|
||||
if env["ninja"]:
|
||||
if scons_ver < (4, 2, 0):
|
||||
print("The `ninja=yes` option requires SCons 4.2 or later, but your version is %s." % scons_raw_version)
|
||||
Exit(255)
|
||||
@ -984,67 +988,48 @@ if selected_platform in platform_list:
|
||||
|
||||
env.Tool("ninja")
|
||||
|
||||
# Threads
|
||||
if env["threads"]:
|
||||
# Threads
|
||||
if env["threads"]:
|
||||
env.Append(CPPDEFINES=["THREADS_ENABLED"])
|
||||
|
||||
# Build subdirs, the build order is dependent on link order.
|
||||
Export("env")
|
||||
# Build subdirs, the build order is dependent on link order.
|
||||
Export("env")
|
||||
|
||||
SConscript("core/SCsub")
|
||||
SConscript("servers/SCsub")
|
||||
SConscript("scene/SCsub")
|
||||
if env.editor_build:
|
||||
SConscript("core/SCsub")
|
||||
SConscript("servers/SCsub")
|
||||
SConscript("scene/SCsub")
|
||||
if env.editor_build:
|
||||
SConscript("editor/SCsub")
|
||||
SConscript("drivers/SCsub")
|
||||
SConscript("drivers/SCsub")
|
||||
|
||||
SConscript("platform/SCsub")
|
||||
SConscript("modules/SCsub")
|
||||
if env["tests"]:
|
||||
SConscript("platform/SCsub")
|
||||
SConscript("modules/SCsub")
|
||||
if env["tests"]:
|
||||
SConscript("tests/SCsub")
|
||||
SConscript("main/SCsub")
|
||||
SConscript("main/SCsub")
|
||||
|
||||
SConscript("platform/" + selected_platform + "/SCsub") # Build selected platform.
|
||||
SConscript("platform/" + selected_platform + "/SCsub") # Build selected platform.
|
||||
|
||||
# Microsoft Visual Studio Project Generation
|
||||
if env["vsproj"]:
|
||||
# Microsoft Visual Studio Project Generation
|
||||
if env["vsproj"]:
|
||||
env["CPPPATH"] = [Dir(path) for path in env["CPPPATH"]]
|
||||
methods.generate_vs_project(env, ARGUMENTS, env["vsproj_name"])
|
||||
methods.generate_cpp_hint_file("cpp.hint")
|
||||
|
||||
# Check for the existence of headers
|
||||
conf = Configure(env)
|
||||
if "check_c_headers" in env:
|
||||
# Check for the existence of headers
|
||||
conf = Configure(env)
|
||||
if "check_c_headers" in env:
|
||||
headers = env["check_c_headers"]
|
||||
for header in headers:
|
||||
if conf.CheckCHeader(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...
|
||||
methods.show_progress(env)
|
||||
# TODO: replace this with `env.Dump(format="json")`
|
||||
# once we start requiring SCons 4.0 as min version.
|
||||
methods.dump(env)
|
||||
# FIXME: This method mixes both cosmetic progress stuff and cache handling...
|
||||
methods.show_progress(env)
|
||||
# TODO: replace this with `env.Dump(format="json")`
|
||||
# once we start requiring SCons 4.0 as min version.
|
||||
methods.dump(env)
|
||||
|
||||
|
||||
def print_elapsed_time():
|
||||
|
Loading…
Reference in New Issue
Block a user