summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct14
1 files changed, 13 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct
index 35401194ef..85075c6c79 100644
--- a/SConstruct
+++ b/SConstruct
@@ -145,6 +145,7 @@ opts.Add('extra_suffix', "Custom extra suffix added to the base filename of all
opts.Add('unix_global_settings_path', "UNIX-specific path to system-wide settings. Currently only used for templates", '')
opts.Add('verbose', "Enable verbose output for the compilation (yes/no)", 'yes')
opts.Add('vsproj', "Generate Visual Studio Project. (yes/no)", 'no')
+opts.Add('warnings', "Enable showing warnings during the compilation (yes/no)", 'yes')
# Thirdparty libraries
opts.Add('builtin_enet', "Use the builtin enet library (yes/no)", 'yes')
@@ -271,6 +272,18 @@ 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)
+ # TODO: Add support to specify different levels of warning, e.g. only critical/significant, instead of on/off
+ if (env["warnings"] == "yes"):
+ if (os.name == "nt" and os.getenv("VSINSTALLDIR")): # MSVC, needs to stand out of course
+ env.Append(CCFLAGS=['/W4'])
+ else: # Rest of the world
+ env.Append(CCFLAGS=['-Wall'])
+ else:
+ if (os.name == "nt" and os.getenv("VSINSTALLDIR")): # MSVC
+ env.Append(CCFLAGS=['/w'])
+ else: # Rest of the world
+ env.Append(CCFLAGS=['-w'])
+
#env['platform_libsuffix'] = env['LIBSUFFIX']
suffix = "." + selected_platform
@@ -280,7 +293,6 @@ if selected_platform in platform_list:
print("Tools can only be built with targets 'debug' and 'release_debug'.")
sys.exit(255)
suffix += ".opt"
-
env.Append(CCFLAGS=['-DNDEBUG'])
elif (env["target"] == "release_debug"):