summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct33
1 files changed, 25 insertions, 8 deletions
diff --git a/SConstruct b/SConstruct
index e943f8dc04..17cf779d4a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -149,7 +149,7 @@ opts.Add(BoolVariable('builtin_libwebsockets', "Use the built-in libwebsockets l
opts.Add(BoolVariable('builtin_mbedtls', "Use the built-in mbedTLS library", True))
opts.Add(BoolVariable('builtin_miniupnpc', "Use the built-in miniupnpc library", True))
opts.Add(BoolVariable('builtin_opus', "Use the built-in Opus library", True))
-opts.Add(BoolVariable('builtin_pcre2', "Use the built-in PCRE2 library)", True))
+opts.Add(BoolVariable('builtin_pcre2', "Use the built-in PCRE2 library", True))
opts.Add(BoolVariable('builtin_recast', "Use the built-in Recast library", True))
opts.Add(BoolVariable('builtin_squish', "Use the built-in squish library", True))
opts.Add(BoolVariable('builtin_xatlas', "Use the built-in xatlas library", True))
@@ -189,7 +189,7 @@ Help(opts.GenerateHelpText(env_base)) # generate help
# add default include paths
-env_base.Append(CPPPATH=['#editor', '#'])
+env_base.Prepend(CPPPATH=['#', '#editor'])
# configure ENV for platform
env_base.platform_exporters = platform_exporters
@@ -226,6 +226,23 @@ if env_base['platform'] != "":
elif env_base['p'] != "":
selected_platform = env_base['p']
env_base["platform"] = selected_platform
+else:
+ # Missing `platform` argument, try to detect platform automatically
+ if sys.platform.startswith('linux'):
+ selected_platform = 'x11'
+ elif sys.platform == 'darwin':
+ selected_platform = 'osx'
+ 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)
+ env_base["platform"] = selected_platform
if selected_platform in platform_list:
tmppath = "./platform/" + selected_platform
@@ -320,7 +337,7 @@ if selected_platform in platform_list:
if (env["warnings"] == 'extra'):
# FIXME: enable -Wclobbered once #26351 is fixed
- # FIXME: enable -Wlogical-op and -Wduplicated-branches once #27594 is merged
+ # FIXME: enable -Wduplicated-branches once #27594 is merged
# Note: enable -Wimplicit-fallthrough for Clang (already part of -Wextra for GCC)
# once we switch to C++11 or later (necessary for our FALLTHROUGH macro).
env.Append(CCFLAGS=['-Wall', '-Wextra', '-Wno-unused-parameter']
@@ -328,7 +345,7 @@ if selected_platform in platform_list:
env.Append(CXXFLAGS=['-Wctor-dtor-privacy', '-Wnon-virtual-dtor'])
if methods.using_gcc(env):
env.Append(CCFLAGS=['-Wno-clobbered', '-Walloc-zero',
- '-Wduplicated-cond', '-Wstringop-overflow=4'])
+ '-Wduplicated-cond', '-Wstringop-overflow=4', '-Wlogical-op'])
env.Append(CXXFLAGS=['-Wnoexcept', '-Wplacement-new=1'])
version = methods.get_compiler_version(env)
if version != None and version[0] >= '9':
@@ -492,13 +509,13 @@ if selected_platform in platform_list:
if (conf.CheckCHeader(header[0])):
env.AppendUnique(CPPDEFINES=[header[1]])
-else:
+elif selected_platform != "":
- print("No valid target platform selected.")
+ print("Invalid target platform: " + selected_platform)
print("The following platforms were detected:")
for x in platform_list:
print("\t" + x)
- print("\nPlease run SCons again with the argument: platform=<string>")
+ print("\nPlease run SCons again and select a valid platform: platform=<string>")
# The following only makes sense when the env is defined, and assumes it is
if 'env' in locals():
@@ -562,7 +579,7 @@ if 'env' in locals():
# (filename, size, weight).
current_time = time.time()
file_stat = [(x[0], x[1][0], (current_time - x[1][1])) for x in file_stat]
- # Sort by the most resently accessed files (most sensible to keep) first
+ # Sort by the most recently accessed files (most sensible to keep) first
file_stat.sort(key=lambda x: x[2])
# Search for the first entry where the storage limit is
# reached