summaryrefslogtreecommitdiff
path: root/etc/scons
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2017-02-26 18:06:46 -0500
committerAndrew Morrow <acm@mongodb.com>2017-02-28 07:09:23 -0500
commit4052dc6ee87489d8f9d0b785680ea6e1568db496 (patch)
tree34544f47eaf772a8cbb4c8dc033a6543d96049d2 /etc/scons
parentc780b434f538f72dab32a120a7950c1480a95d49 (diff)
downloadmongo-4052dc6ee87489d8f9d0b785680ea6e1568db496.tar.gz
SERVER-27682 Use variables files to configure toolchains
Diffstat (limited to 'etc/scons')
-rw-r--r--etc/scons/mongodbtoolchain_clang.vars22
-rw-r--r--etc/scons/mongodbtoolchain_gcc.vars22
-rw-r--r--etc/scons/xcode_ios.vars15
-rw-r--r--etc/scons/xcode_ios_sim.vars13
-rw-r--r--etc/scons/xcode_macosx.vars11
-rw-r--r--etc/scons/xcode_tvos.vars14
-rw-r--r--etc/scons/xcode_tvos_sim.vars13
7 files changed, 110 insertions, 0 deletions
diff --git a/etc/scons/mongodbtoolchain_clang.vars b/etc/scons/mongodbtoolchain_clang.vars
new file mode 100644
index 00000000000..791a44745ca
--- /dev/null
+++ b/etc/scons/mongodbtoolchain_clang.vars
@@ -0,0 +1,22 @@
+# Configures the build to use the Clang toolchain in /opt/mongodbtoolchain/v2
+
+import os
+import SCons.Defaults
+
+# 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(['/opt/mongodbtoolchain/v2/bin'] + 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 = '/opt/mongodbtoolchain/v2/bin/clang'
+CXX = '/opt/mongodbtoolchain/v2/bin/clang++'
+OBJCOPY = '/opt/mongodbtoolchain/v2/bin/objcopy'
diff --git a/etc/scons/mongodbtoolchain_gcc.vars b/etc/scons/mongodbtoolchain_gcc.vars
new file mode 100644
index 00000000000..061665d7d69
--- /dev/null
+++ b/etc/scons/mongodbtoolchain_gcc.vars
@@ -0,0 +1,22 @@
+# Configures the build to use the GCC toolchain in /opt/mongodbtoolchain/v2
+
+import os
+import SCons.Defaults
+
+# 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(['/opt/mongodbtoolchain/v2/bin'] + 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 = '/opt/mongodbtoolchain/v2/bin/gcc'
+CXX = '/opt/mongodbtoolchain/v2/bin/g++'
+OBJCOPY = '/opt/mongodbtoolchain/v2/bin/objcopy'
diff --git a/etc/scons/xcode_ios.vars b/etc/scons/xcode_ios.vars
new file mode 100644
index 00000000000..0f9986ccb97
--- /dev/null
+++ b/etc/scons/xcode_ios.vars
@@ -0,0 +1,15 @@
+# Configures the build to use XCode targeting iOS
+
+import subprocess
+
+CC = subprocess.check_output(['xcrun', '-f', '--sdk', 'iphoneos', 'clang']).strip()
+CXX = subprocess.check_output(['xcrun', '-f', '--sdk', 'iphoneos', 'clang++']).strip()
+
+sdk_path = subprocess.check_output(['xcrun', '--sdk', 'iphoneos', '--show-sdk-path']).strip()
+
+CCFLAGS = "-isysroot {} -miphoneos-version-min=10.2 -arch arm64".format(sdk_path)
+LINKFLAGS = "-Wl,-syslibroot,{} -miphoneos-version-min=10.2 -arch arm64".format(sdk_path)
+
+TARGET_OS = "iOS"
+TARGET_ARCH = "aarch64"
+
diff --git a/etc/scons/xcode_ios_sim.vars b/etc/scons/xcode_ios_sim.vars
new file mode 100644
index 00000000000..bcc46547069
--- /dev/null
+++ b/etc/scons/xcode_ios_sim.vars
@@ -0,0 +1,13 @@
+# Configures the build to use XCode targeting iOS simulator
+
+import subprocess
+
+CC = subprocess.check_output(['xcrun', '-f', '--sdk', 'iphonesimulator', 'clang']).strip()
+CXX = subprocess.check_output(['xcrun', '-f', '--sdk', 'iphonesimulator', 'clang++']).strip()
+
+sdk_path = subprocess.check_output(['xcrun', '--sdk', 'iphonesimulator', '--show-sdk-path']).strip()
+
+CCFLAGS = "-isysroot {} -miphoneos-version-min=10.2".format(sdk_path)
+LINKFLAGS = "-Wl,-syslibroot,{} -miphoneos-version-min=10.2".format(sdk_path)
+
+TARGET_OS = "iOS-sim"
diff --git a/etc/scons/xcode_macosx.vars b/etc/scons/xcode_macosx.vars
new file mode 100644
index 00000000000..865a4f1184c
--- /dev/null
+++ b/etc/scons/xcode_macosx.vars
@@ -0,0 +1,11 @@
+# Configures the build to use XCode targeting macOS
+
+import subprocess
+
+CC = subprocess.check_output(['xcrun', '-f', '--sdk', 'macosx', 'clang']).strip()
+CXX = subprocess.check_output(['xcrun', '-f', '--sdk', 'macosx', 'clang++']).strip()
+
+sdk_path = subprocess.check_output(['xcrun', '--sdk', 'macosx', '--show-sdk-path']).strip()
+
+CCFLAGS = "-isysroot {} -mmacosx-version-min=10.10".format(sdk_path)
+LINKFLAGS = "-Wl,-syslibroot,{} -mmacosx-version-min=10.10".format(sdk_path)
diff --git a/etc/scons/xcode_tvos.vars b/etc/scons/xcode_tvos.vars
new file mode 100644
index 00000000000..e8ea05e926b
--- /dev/null
+++ b/etc/scons/xcode_tvos.vars
@@ -0,0 +1,14 @@
+# Configures the build to use XCode targeting tvOS
+
+import subprocess
+
+CC = subprocess.check_output(['xcrun', '-f', '--sdk', 'appletvos', 'clang']).strip()
+CXX = subprocess.check_output(['xcrun', '-f', '--sdk', 'appletvos', 'clang++']).strip()
+
+sdk_path = subprocess.check_output(['xcrun', '--sdk', 'appletvos', '--show-sdk-path']).strip()
+
+CCFLAGS = "-isysroot {} -mtvos-version-min=10.1 -arch arm64".format(sdk_path)
+LINKFLAGS = "-Wl,-syslibroot,{} -mtvos-version-min=10.1 -arch arm64".format(sdk_path)
+
+TARGET_OS = "tvOS"
+TARGET_ARCH = "aarch64"
diff --git a/etc/scons/xcode_tvos_sim.vars b/etc/scons/xcode_tvos_sim.vars
new file mode 100644
index 00000000000..e66c63da547
--- /dev/null
+++ b/etc/scons/xcode_tvos_sim.vars
@@ -0,0 +1,13 @@
+# Configures the build to use XCode targeting tvOS simulator
+
+import subprocess
+
+CC = subprocess.check_output(['xcrun', '-f', '--sdk', 'appletvsimulator', 'clang']).strip()
+CXX = subprocess.check_output(['xcrun', '-f', '--sdk', 'appletvsimulator', 'clang++']).strip()
+
+sdk_path = subprocess.check_output(['xcrun', '--sdk', 'appletvsimulator', '--show-sdk-path']).strip()
+
+CCFLAGS = "-isysroot {} -mtvos-version-min=10.1".format(sdk_path)
+LINKFLAGS = "-Wl,-syslibroot,{} -mtvos-version-min=10.1".format(sdk_path)
+
+TARGET_OS = "tvOS-sim"