summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-09-24 13:32:00 +0200
committerGitHub <noreply@github.com>2017-09-24 13:32:00 +0200
commit4ac7f5acf98ad08fb826979a0baa3d5e731a73a3 (patch)
tree47b66af3e4dd7580ca5a4bbf1ff54c24454bf238 /platform
parentf04821669edad07190c86497ca59b20c71e87eea (diff)
parent43757fcc85ac8e1c4657b30968b9bf2381aec329 (diff)
Merge pull request #11519 from hpvb/fix-gcc-lto
Fix gcc lto [ci skip]
Diffstat (limited to 'platform')
-rw-r--r--platform/windows/detect.py9
-rw-r--r--platform/x11/detect.py3
2 files changed, 10 insertions, 2 deletions
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 65eb51a2f3..053ea466f3 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -64,6 +64,7 @@ def get_opts():
return [
('mingw_prefix_32', 'MinGW prefix (Win32)', mingw32),
('mingw_prefix_64', 'MinGW prefix (Win64)', mingw64),
+ ('use_lto', 'Use link time optimization (when using MingW)', 'no'),
('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes')
]
@@ -256,11 +257,15 @@ def configure(env):
env["CC"] = mingw_prefix + "gcc"
env['AS'] = mingw_prefix + "as"
env['CXX'] = mingw_prefix + "g++"
- env['AR'] = mingw_prefix + "ar"
- env['RANLIB'] = mingw_prefix + "ranlib"
+ env['AR'] = mingw_prefix + "gcc-ar"
+ env['RANLIB'] = mingw_prefix + "gcc-ranlib"
env['LD'] = mingw_prefix + "g++"
env["x86_libtheora_opt_gcc"] = True
+ if (env["use_lto"] == "yes"):
+ env.Append(CCFLAGS=['-flto'])
+ env.Append(LINKFLAGS=['-flto'])
+
## Compile flags
env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 591398dd6d..b9b4ad8201 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -120,6 +120,9 @@ def configure(env):
if (env["use_lto"] == "yes"):
env.Append(CCFLAGS=['-flto'])
env.Append(LINKFLAGS=['-flto'])
+ if (env["use_llvm"] == "no"):
+ env['RANLIB'] = 'gcc-ranlib'
+ env['AR'] = 'gcc-ar'
env.Append(CCFLAGS=['-pipe'])
env.Append(LINKFLAGS=['-pipe'])