From db49f35ab8d2bbcf5b97a58b8a2eff064b942881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 5 Jan 2018 20:37:18 +0100 Subject: [PATCH] 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. --- SConstruct | 6 ++++-- platform/osx/detect.py | 4 ++-- platform/server/detect.py | 2 +- platform/windows/detect.py | 2 +- platform/x11/detect.py | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/SConstruct b/SConstruct index 88b29695cba..9fced81f9cf 100644 --- a/SConstruct +++ b/SConstruct @@ -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('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("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("LINKFLAGS", "Custom flags for the linker") diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 2e686fbee43..bb601abd40c 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -76,7 +76,7 @@ def configure(env): mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local") mpclangver = env["macports_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['AR'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ar" env['RANLIB'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ranlib" @@ -110,7 +110,7 @@ def configure(env): if (env["CXX"] == "clang++"): env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) env["CC"] = "clang" - env["LD"] = "clang++" + env["LINK"] = "clang++" ## Dependencies diff --git a/platform/server/detect.py b/platform/server/detect.py index ffec2af9337..72c9c770e3d 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -59,7 +59,7 @@ def configure(env): if ('clang++' not in env['CXX']): env["CC"] = "clang" env["CXX"] = "clang++" - env["LD"] = "clang++" + env["LINK"] = "clang++" env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) env.extra_suffix = ".llvm" + env.extra_suffix diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 489bac50f5f..bd05d5605de 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -265,7 +265,7 @@ def configure(env): env['CXX'] = mingw_prefix + "g++" env['AR'] = mingw_prefix + "gcc-ar" env['RANLIB'] = mingw_prefix + "gcc-ranlib" - env['LD'] = mingw_prefix + "g++" + env['LINK'] = mingw_prefix + "g++" env["x86_libtheora_opt_gcc"] = True if env['use_lto']: diff --git a/platform/x11/detect.py b/platform/x11/detect.py index cb45fed1be8..478b42f9f71 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -109,7 +109,7 @@ def configure(env): if ('clang++' not in env['CXX']): env["CC"] = "clang" env["CXX"] = "clang++" - env["LD"] = "clang++" + env["LINK"] = "clang++" env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) env.extra_suffix = ".llvm" + env.extra_suffix