From a6281bf9a5ad1a83df64ee29e023135cc4873ed9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 14 Aug 2020 10:24:38 +0200 Subject: Only set CFLAGS and CXXFLAGS if they are unset in the environment This provides reasonable conservative optimization defaults, but allows users or packagers total control over the flags if necessary. --- extras/autowaf.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/extras/autowaf.py b/extras/autowaf.py index 3d4c09a..af9cf29 100644 --- a/extras/autowaf.py +++ b/extras/autowaf.py @@ -539,10 +539,17 @@ def configure(conf): conf.env['CFLAGS'] = ['-O0', '-g'] conf.env['CXXFLAGS'] = ['-O0', '-g'] else: - if conf.env['MSVC_COMPILER']: - append_cxx_flags(['/MD', '/FS', '/DNDEBUG']) - else: - append_cxx_flags(['-DNDEBUG']) + if 'CFLAGS' not in os.environ: + if conf.env['MSVC_COMPILER']: + conf.env.append_unique('CFLAGS', ['/O2', '/DNDEBUG']) + else: + conf.env.append_unique('CFLAGS', ['-O2', '-DNDEBUG']) + + if 'CXXFLAGS' not in os.environ: + if conf.env['MSVC_COMPILER']: + conf.env.append_unique('CXXFLAGS', ['/O2', '/DNDEBUG']) + else: + conf.env.append_unique('CXXFLAGS', ['-O2', '-DNDEBUG']) if Options.options.ultra_strict: Options.options.strict = True -- cgit v1.2.1