Fix release builds with Clang and SCons

The detection for when Clang is used was incorrect, resulting in GCC-only
parameter being passed to Clang.

In addition, at least on my system LTO+Clang caused linking errors even
with that fixed. As an emergency fix, I completely disabled LTO for Clang.
This commit is contained in:
Jyrki Vesterinen 2018-02-11 01:27:22 +02:00
parent 782f68ca65
commit a1e821fb95

View file

@ -525,7 +525,7 @@ for env in [test_env, client_env, env]:
rel_comp_flags = rel_comp_flags + env["arch"]
# PGO and LTO setup
if "gcc" in env["TOOLS"]:
if "gcc" in env["CXX"]:
if env["pgo_data"] == "generate":
rel_comp_flags = rel_comp_flags + " -fprofile-generate=pgo_data/"
rel_link_flags = "-fprofile-generate=pgo_data/"
@ -537,6 +537,9 @@ for env in [test_env, client_env, env]:
if env["enable_lto"] == True:
rel_comp_flags = rel_comp_flags + " -flto=" + str(env["jobs"])
rel_link_flags = rel_comp_flags + " -fuse-ld=gold"
''' Disabled because LTO+Clang causes builds to fail on some systems
and LTO is enabled by default - without this, building with Clang would be impossible
for some users.
elif "clang" in env["CXX"]:
if env["pgo_data"] == "generate":
rel_comp_flags = rel_comp_flags + " -fprofile-instr-generate=pgo_data/wesnoth-%p.profraw"
@ -549,6 +552,7 @@ for env in [test_env, client_env, env]:
if env["enable_lto"] == True:
rel_comp_flags = rel_comp_flags + " -flto=thin"
rel_link_flags = rel_comp_flags + " -fuse-ld=lld"
'''
# #
# End setting options for release build