summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct50
1 files changed, 31 insertions, 19 deletions
diff --git a/SConstruct b/SConstruct
index a056a0c3ae..8b7b95a600 100644
--- a/SConstruct
+++ b/SConstruct
@@ -159,15 +159,16 @@ opts.Add(BoolVariable('minizip', "Enable ZIP archive support using minizip", Tru
opts.Add(BoolVariable('xaudio2', "Enable the XAudio2 audio driver", False))
# Advanced options
-opts.Add(BoolVariable('disable_3d', "Disable 3D nodes for a smaller executable", False))
-opts.Add(BoolVariable('disable_advanced_gui', "Disable advanced 3D GUI nodes and behaviors", False))
-opts.Add('extra_suffix', "Custom extra suffix added to the base filename of all generated binary files", '')
opts.Add(BoolVariable('verbose', "Enable verbose output for the compilation", False))
-opts.Add(BoolVariable('vsproj', "Generate a Visual Studio solution", False))
-opts.Add(EnumVariable('warnings', "Set the level of warnings emitted during compilation", 'no', ('extra', 'all', 'moderate', 'no')))
opts.Add(BoolVariable('progress', "Show a progress indicator during compilation", True))
+opts.Add(EnumVariable('warnings', "Set the level of warnings emitted during compilation", 'all', ('extra', 'all', 'moderate', 'no')))
+opts.Add(BoolVariable('werror', "Treat compiler warnings as errors. Depends on the level of warnings set with 'warnings'", False))
opts.Add(BoolVariable('dev', "If yes, alias for verbose=yes warnings=all", False))
+opts.Add('extra_suffix', "Custom extra suffix added to the base filename of all generated binary files", '')
+opts.Add(BoolVariable('vsproj', "Generate a Visual Studio solution", False))
opts.Add(EnumVariable('macports_clang', "Build using Clang from MacPorts", 'no', ('no', '5.0', 'devel')))
+opts.Add(BoolVariable('disable_3d', "Disable 3D nodes for a smaller executable", False))
+opts.Add(BoolVariable('disable_advanced_gui', "Disable advanced 3D GUI nodes and behaviors", False))
opts.Add(BoolVariable('no_editor_splash', "Don't use the custom splash screen for the editor", False))
opts.Add('system_certs_path', "Use this path as SSL certificates default for editor (for package maintainers)", '')
@@ -234,7 +235,7 @@ env_base.platform_exporters = platform_exporters
env_base.platform_apis = platform_apis
if (env_base['target'] == 'debug'):
- env_base.Append(CPPDEFINES=['DEBUG_MEMORY_ALLOC'])
+ env_base.Append(CPPDEFINES=['DEBUG_MEMORY_ALLOC','DISABLE_FORCED_INLINE'])
if (env_base['no_editor_splash']):
env_base.Append(CPPDEFINES=['NO_EDITOR_SPLASH'])
@@ -317,35 +318,41 @@ if selected_platform in platform_list:
# must happen after the flags, so when flags are used by configure, stuff happens (ie, ssl on x11)
detect.configure(env)
- if (env["warnings"] == 'yes'):
- print("WARNING: warnings=yes is deprecated; assuming warnings=all")
-
+ # Configure compiler warnings
if env.msvc:
- disable_nonessential_warnings = ['/wd4267', '/wd4244', '/wd4305', '/wd4800'] # Truncations, narrowing conversions...
+ # Truncations, narrowing conversions, signed/unsigned comparisons...
+ disable_nonessential_warnings = ['/wd4267', '/wd4244', '/wd4305', '/wd4018', '/wd4800']
if (env["warnings"] == 'extra'):
env.Append(CCFLAGS=['/Wall']) # Implies /W4
- elif (env["warnings"] == 'all' or env["warnings"] == 'yes'):
+ elif (env["warnings"] == 'all'):
env.Append(CCFLAGS=['/W3'] + disable_nonessential_warnings)
elif (env["warnings"] == 'moderate'):
- # C4244 shouldn't be needed here being a level-3 warning, but it is
env.Append(CCFLAGS=['/W2'] + disable_nonessential_warnings)
else: # 'no'
env.Append(CCFLAGS=['/w'])
# Set exception handling model to avoid warnings caused by Windows system headers.
env.Append(CCFLAGS=['/EHsc'])
+ if (env["werror"]):
+ env.Append(CCFLAGS=['/WX'])
else: # Rest of the world
disable_nonessential_warnings = ['-Wno-sign-compare']
if (env["warnings"] == 'extra'):
env.Append(CCFLAGS=['-Wall', '-Wextra'])
- elif (env["warnings"] == 'all' or env["warnings"] == 'yes'):
+ elif (env["warnings"] == 'all'):
env.Append(CCFLAGS=['-Wall'] + disable_nonessential_warnings)
elif (env["warnings"] == 'moderate'):
env.Append(CCFLAGS=['-Wall', '-Wno-unused'] + disable_nonessential_warnings)
else: # 'no'
env.Append(CCFLAGS=['-w'])
- env.Append(CCFLAGS=['-Werror=return-type'])
+ if (env["werror"]):
+ env.Append(CCFLAGS=['-Werror'])
+ else: # always enable those errors
+ env.Append(CCFLAGS=['-Werror=return-type'])
- suffix = "." + selected_platform
+ if (hasattr(detect, 'get_program_suffix')):
+ suffix = "." + detect.get_program_suffix()
+ else:
+ suffix = "." + selected_platform
if (env["target"] == "release"):
if env["tools"]:
@@ -418,8 +425,13 @@ if selected_platform in platform_list:
# (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, .dll, etc.).
- env["LIBSUFFIXES"] += [env["LIBSUFFIX"], env["SHLIBSUFFIX"]]
+ # 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:
+ env["LIBSUFFIXES"] += [env["LIBSUFFIX"], env["SHLIBSUFFIX"]]
env["LIBSUFFIX"] = suffix + env["LIBSUFFIX"]
env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"]
@@ -540,7 +552,7 @@ if 'env' in locals():
[os.remove(f) for f in files]
def file_list(self):
- if self.path == None:
+ if self.path is None:
# Nothing to do
return []
# Gather a list of (filename, (size, atime)) within the
@@ -565,7 +577,7 @@ if 'env' in locals():
if sum > self.limit:
mark = i
break
- if mark == None:
+ if mark is None:
return []
else:
return [x[0] for x in file_stat[mark:]]