From d8f32637be9f9eae9fddfe4d664e369cbf3b65c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 25 Mar 2017 08:36:00 +0100 Subject: 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) --- SConstruct | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'SConstruct') 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"): -- cgit v1.2.3