diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-03-25 08:36:00 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2017-03-26 21:58:37 +0200 |
commit | d8f32637be9f9eae9fddfe4d664e369cbf3b65c3 (patch) | |
tree | d467f8bab2c09af03c16ec28de02974f868e7079 /SConstruct | |
parent | a0b0dff6fdbdc4be78087aa572f3da5dbb8daa01 (diff) |
SCons: Add option to toggle warnings (on by default)
All the warnings are factored out of the platform-specific files and moved to
SConstruct. Will have to check that it does not introduce regressions on some
platforms/compilers.
(cherry picked from commit 31107daa1a41fe9ab3c7c1868479e78e16848333)
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 14 |
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"): |