diff options
author | Andrew Morrow <acm@mongodb.com> | 2018-11-08 09:02:31 -0500 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2018-11-08 17:57:33 -0500 |
commit | a955b238b22c81c3cc4ec840aaf8e25d280ac9c8 (patch) | |
tree | 2cbc7a47c0f4bbac9dd4a7ae1f4d7252399a7204 /etc/scons | |
parent | b0d400815c3159b4cb30b6818138fc55036f8ed4 (diff) | |
download | mongo-a955b238b22c81c3cc4ec840aaf8e25d280ac9c8.tar.gz |
SERVER-38023 Add v3 toolchain variables files
Diffstat (limited to 'etc/scons')
-rw-r--r-- | etc/scons/android_toolchain.vars | 34 | ||||
-rw-r--r-- | etc/scons/mongodbtoolchain_v3_clang.vars | 40 | ||||
-rw-r--r-- | etc/scons/mongodbtoolchain_v3_gcc.vars | 40 |
3 files changed, 106 insertions, 8 deletions
diff --git a/etc/scons/android_toolchain.vars b/etc/scons/android_toolchain.vars index c689e8c5df0..73f3c012e69 100644 --- a/etc/scons/android_toolchain.vars +++ b/etc/scons/android_toolchain.vars @@ -9,17 +9,35 @@ compiler_suffix = "" if platform.system() == "Windows": compiler_suffix = ".cmd" -toolchain_path = SCons.Script.Main.GetOption('android-toolchain-path') +toolchain_root = SCons.Script.Main.GetOption('toolchain-root') -if not toolchain_path: - print("Path to Android standalone toolchain must be set with --android-toolchain-path when using android_toolchain.vars") +if not toolchain_root: + print("Path to Android standalone toolchain must be set with --toolchain-root when using android_toolchain.vars") SCons.Script.Exit(1) - -CC=os.path.join(toolchain_path, "bin", "clang" + compiler_suffix) -CXX=os.path.join(toolchain_path, "bin", "clang++" + compiler_suffix) -AR=subprocess.check_output([CXX, '-print-prog-name=ar']).strip() -OBJCOPY=subprocess.check_output([CXX, '-print-prog-name=objcopy']).strip() +toolchain_bindir = os.path.join(toolchain_root, 'bin') + +# Get the default SCons path as a list +default_path = SCons.Defaults.DefaultEnvironment()['ENV']['PATH'].split(os.pathsep) + +# Put the toolchain path first so we prefer all tools from there in subprocs +ENV = { + 'PATH' : os.pathsep.join([toolchain_bindir] + default_path) +} + +CC=os.path.join(toolchain_bindir, "clang" + compiler_suffix) +CXX=os.path.join(toolchain_bindir, "clang++" + compiler_suffix) + +try: + AR = subprocess.check_output([CXX, '-print-prog-name=ar']).strip() + AS = subprocess.check_output([CXX, '-print-prog-name=as']).strip() + OBJCOPY = subprocess.check_output([CXX, '-print-prog-name=objcopy']).strip() +except subprocess.CalledProcessError as e: + print("Failed while invoking toolchain binary " + CXX + ": " + e.output) + SCons.Script.Exit(-1) +except OSError as e: + print("Failed to invoke toolchain binary " + CXX + ": " + str(e)) + SCons.Script.Exit(-1) LINKFLAGS='-static-libstdc++ -fuse-ld=gold' CPPDEFINES='__ANDROID_API__=21 _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR' diff --git a/etc/scons/mongodbtoolchain_v3_clang.vars b/etc/scons/mongodbtoolchain_v3_clang.vars new file mode 100644 index 00000000000..a347beb7bca --- /dev/null +++ b/etc/scons/mongodbtoolchain_v3_clang.vars @@ -0,0 +1,40 @@ +# Configures the build to use the GCC toolchain in /opt/mongodbtoolchain/v3 + +import os +import subprocess +import SCons.Defaults + +toolchain_root = SCons.Script.Main.GetOption('toolchain-root') +if not toolchain_root: + toolchain_root = '/opt/mongodbtoolchain/v3' + +toolchain_bindir = os.path.join(toolchain_root, 'bin') + +# Get the default SCons path as a list +default_path = SCons.Defaults.DefaultEnvironment()['ENV']['PATH'].split(os.pathsep) + +# Put the toolchain path first so we prefer all tools from there in subprocs +ENV = { + 'PATH' : os.pathsep.join([toolchain_bindir] + default_path) +} + +# Set any Variables for Tools from the toolchain here. Technically, we +# shouldn't need the full paths since SCons will find the toolchain +# ones first, but we don't want to accidentally get the system version +# if, say, the toolchain is missing. Also, it is clearer that we are +# getting the right toolchain in build log output when the path is +# printed for each compiler invocation. + +CC = os.path.join(toolchain_bindir, 'clang') +CXX = os.path.join(toolchain_bindir, 'clang++') + +try: + AR = subprocess.check_output([CXX, '-print-prog-name=ar']).strip() + AS = subprocess.check_output([CXX, '-print-prog-name=as']).strip() + OBJCOPY = subprocess.check_output([CXX, '-print-prog-name=objcopy']).strip() +except subprocess.CalledProcessError as e: + print("Failed while invoking toolchain binary " + CXX + ": " + e.output) + SCons.Script.Exit(-1) +except OSError as e: + print("Failed to invoke toolchain binary " + CXX + ": " + str(e)) + SCons.Script.Exit(-1) diff --git a/etc/scons/mongodbtoolchain_v3_gcc.vars b/etc/scons/mongodbtoolchain_v3_gcc.vars new file mode 100644 index 00000000000..9d3803cb412 --- /dev/null +++ b/etc/scons/mongodbtoolchain_v3_gcc.vars @@ -0,0 +1,40 @@ +# Configures the build to use the GCC toolchain in /opt/mongodbtoolchain/v3 + +import os +import subprocess +import SCons.Defaults + +toolchain_root = SCons.Script.Main.GetOption('toolchain-root') +if not toolchain_root: + toolchain_root = '/opt/mongodbtoolchain/v3' + +toolchain_bindir = os.path.join(toolchain_root, 'bin') + +# Get the default SCons path as a list +default_path = SCons.Defaults.DefaultEnvironment()['ENV']['PATH'].split(os.pathsep) + +# Put the toolchain path first so we prefer all tools from there in subprocs +ENV = { + 'PATH' : os.pathsep.join([toolchain_bindir] + default_path) +} + +# Set any Variables for Tools from the toolchain here. Technically, we +# shouldn't need the full paths since SCons will find the toolchain +# ones first, but we don't want to accidentally get the system version +# if, say, the toolchain is missing. Also, it is clearer that we are +# getting the right toolchain in build log output when the path is +# printed for each compiler invocation. + +CC = os.path.join(toolchain_bindir, 'gcc') +CXX = os.path.join(toolchain_bindir, 'g++') + +try: + AR = subprocess.check_output([CXX, '-print-prog-name=ar']).strip() + AS = subprocess.check_output([CXX, '-print-prog-name=as']).strip() + OBJCOPY = subprocess.check_output([CXX, '-print-prog-name=objcopy']).strip() +except subprocess.CalledProcessError as e: + print("Failed while invoking toolchain binary " + CXX + ": " + e.output) + SCons.Script.Exit(-1) +except OSError as e: + print("Failed to invoke toolchain binary " + CXX + ": " + str(e)) + SCons.Script.Exit(-1) |