diff options
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/SConstruct b/SConstruct index e9a6bc44b6..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"): @@ -387,7 +399,7 @@ if selected_platform in platform_list: # env['MSVS_VERSION']='9.0' # Calls a CMD with /C(lose) and /V(delayed environment variable expansion) options. - # And runs vcvarsall bat for the propper arhitecture and scons for propper configuration + # And runs vcvarsall bat for the proper architecture and scons for proper configuration env['MSVSBUILDCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) ^& call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons platform=windows target=$(Configuration) tools=!tools! -j2' env['MSVSREBUILDCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) & call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons platform=windows target=$(Configuration) tools=!tools! vsproj=yes -j2' env['MSVSCLEANCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) ^& call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons --clean platform=windows target=$(Configuration) tools=!tools! -j2' |