Browse Source

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.
Rémi Verschelde 7 years ago
parent
commit
db49f35ab8
5 changed files with 9 additions and 7 deletions
  1. 4 2
      SConstruct
  2. 2 2
      platform/osx/detect.py
  3. 1 1
      platform/server/detect.py
  4. 1 1
      platform/windows/detect.py
  5. 1 1
      platform/x11/detect.py

+ 4 - 2
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")
 

+ 2 - 2
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
 

+ 1 - 1
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
 

+ 1 - 1
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']:

+ 1 - 1
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