SCons: Fix usage of LD when we meant LINK

Also made LINK and CXXFLAGS configurable as command line options.
Note that LINK currently expects the *compiler* that will be used
for linking and will call its configured linker behind the scenes
(so g++, clang++, etc., not ld.gold). See #15364 for details.
This commit is contained in:
Rémi Verschelde 2018-01-05 20:37:18 +01:00
parent 380ee87e80
commit db49f35ab8
5 changed files with 9 additions and 7 deletions

View File

@ -189,10 +189,12 @@ opts.Add(BoolVariable('builtin_zlib', "Use the builtin zlib library", True))
opts.Add(BoolVariable('builtin_zstd', "Use the builtin zstd library", True)) opts.Add(BoolVariable('builtin_zstd', "Use the builtin zstd library", True))
opts.Add(BoolVariable('no_editor_splash', "Don't use the custom splash screen for the editor", False)) opts.Add(BoolVariable('no_editor_splash', "Don't use the custom splash screen for the editor", False))
# Environment setup # Compilation environment setup
opts.Add("CXX", "C++ compiler") opts.Add("CXX", "C++ compiler")
opts.Add("CC", "C compiler") opts.Add("CC", "C compiler")
opts.Add("CCFLAGS", "Custom flags for the C and C++ compilers") opts.Add("LINK", "Linker")
opts.Add("CCFLAGS", "Custom flags for both the C and C++ compilers")
opts.Add("CXXFLAGS", "Custom flags for the C++ compiler")
opts.Add("CFLAGS", "Custom flags for the C compiler") opts.Add("CFLAGS", "Custom flags for the C compiler")
opts.Add("LINKFLAGS", "Custom flags for the linker") opts.Add("LINKFLAGS", "Custom flags for the linker")

View File

@ -76,7 +76,7 @@ def configure(env):
mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local") mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local")
mpclangver = env["macports_clang"] mpclangver = env["macports_clang"]
env["CC"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang" env["CC"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang"
env["LD"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++" env["LINK"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++"
env["CXX"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++" env["CXX"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++"
env['AR'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ar" env['AR'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ar"
env['RANLIB'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ranlib" env['RANLIB'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ranlib"
@ -110,7 +110,7 @@ def configure(env):
if (env["CXX"] == "clang++"): if (env["CXX"] == "clang++"):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env["CC"] = "clang" env["CC"] = "clang"
env["LD"] = "clang++" env["LINK"] = "clang++"
## Dependencies ## Dependencies

View File

@ -59,7 +59,7 @@ def configure(env):
if ('clang++' not in env['CXX']): if ('clang++' not in env['CXX']):
env["CC"] = "clang" env["CC"] = "clang"
env["CXX"] = "clang++" env["CXX"] = "clang++"
env["LD"] = "clang++" env["LINK"] = "clang++"
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env.extra_suffix = ".llvm" + env.extra_suffix env.extra_suffix = ".llvm" + env.extra_suffix

View File

@ -265,7 +265,7 @@ def configure(env):
env['CXX'] = mingw_prefix + "g++" env['CXX'] = mingw_prefix + "g++"
env['AR'] = mingw_prefix + "gcc-ar" env['AR'] = mingw_prefix + "gcc-ar"
env['RANLIB'] = mingw_prefix + "gcc-ranlib" env['RANLIB'] = mingw_prefix + "gcc-ranlib"
env['LD'] = mingw_prefix + "g++" env['LINK'] = mingw_prefix + "g++"
env["x86_libtheora_opt_gcc"] = True env["x86_libtheora_opt_gcc"] = True
if env['use_lto']: if env['use_lto']:

View File

@ -109,7 +109,7 @@ def configure(env):
if ('clang++' not in env['CXX']): if ('clang++' not in env['CXX']):
env["CC"] = "clang" env["CC"] = "clang"
env["CXX"] = "clang++" env["CXX"] = "clang++"
env["LD"] = "clang++" env["LINK"] = "clang++"
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env.extra_suffix = ".llvm" + env.extra_suffix env.extra_suffix = ".llvm" + env.extra_suffix