diff options
author | Ferenc Arn <tagcup@yahoo.com> | 2017-01-25 12:40:54 -0600 |
---|---|---|
committer | Ferenc Arn <tagcup@yahoo.com> | 2017-01-26 19:32:27 -0600 |
commit | 7a85d25218971506058a992d21821b47e153ec78 (patch) | |
tree | 4de8a8f5c8f5c3441882b43ccd6c62df52287c5f /platform/x11 | |
parent | 1005a56e5a27fb7f491d280d5aff6fe88691365c (diff) |
Use -Ofast on x11. Also introduced use_lto option.
debug_release doesn't turn off optimizations for release target now. Ensure that sanitizer options apply to both C and C++ files.
Built-in optimization/debug flags are prepended such that user-specified flags can override them.
Based on and around the discussion in PR #5194.
Diffstat (limited to 'platform/x11')
-rw-r--r-- | platform/x11/detect.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/platform/x11/detect.py b/platform/x11/detect.py index b5f6359d21..89cf639114 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -61,6 +61,7 @@ def get_opts(): ('use_static_cpp', 'link stdc++ statically', 'no'), ('use_sanitizer', 'Use llvm compiler sanitize address', 'no'), ('use_leak_sanitizer', 'Use llvm compiler sanitize memory leaks', 'no'), + ('use_lto', 'Use link time optimization', 'no'), ('pulseaudio', 'Detect & Use pulseaudio', 'yes'), ('udev', 'Use udev for gamepad connection callbacks', 'no'), ('debug_release', 'Add debug symbols to release version', 'no'), @@ -97,12 +98,12 @@ def configure(env): env.extra_suffix = ".llvm" if (env["use_sanitizer"] == "yes"): - env.Append(CXXFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer']) + env.Append(CCFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer']) env.Append(LINKFLAGS=['-fsanitize=address']) env.extra_suffix += "s" if (env["use_leak_sanitizer"] == "yes"): - env.Append(CXXFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer']) + env.Append(CCFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer']) env.Append(LINKFLAGS=['-fsanitize=address']) env.extra_suffix += "s" @@ -111,22 +112,28 @@ def configure(env): # env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX'] # env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX'] - if (env["target"] == "release"): + if (env["use_lto"] == "yes"): + env.Append(CCFLAGS=['-flto']) + env.Append(LINKFLAGS=['-flto']) + + + env.Append(CCFLAGS=['-pipe']) + env.Append(LINKFLAGS=['-pipe']) + if (env["target"] == "release"): + env.Prepend(CCFLAGS=['-Ofast']) if (env["debug_release"] == "yes"): - env.Append(CCFLAGS=['-g2']) - else: - env.Append(CCFLAGS=['-O3', '-ffast-math']) + env.Prepend(CCFLAGS=['-g2']) elif (env["target"] == "release_debug"): - env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED']) + env.Prepend(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED']) if (env["debug_release"] == "yes"): - env.Append(CCFLAGS=['-g2']) + env.Prepend(CCFLAGS=['-g2']) elif (env["target"] == "debug"): - env.Append(CCFLAGS=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED']) + env.Prepend(CCFLAGS=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED']) env.ParseConfig('pkg-config x11 --cflags --libs') env.ParseConfig('pkg-config xinerama --cflags --libs') |