summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorMathew Robinson <chasinglogic@gmail.com>2019-05-22 13:04:39 -0400
committerMathew Robinson <chasinglogic@gmail.com>2019-05-24 12:51:04 -0400
commit202ba6150bcc276f2734479ef853dc38cf8d4d3f (patch)
treea1f1e9c8794b8ee608a948640d6ae4cdc48dc5f5 /etc
parentc15db22ece7eb515f83df5052844dde9b6a0fbac (diff)
downloadmongo-202ba6150bcc276f2734479ef853dc38cf8d4d3f.tar.gz
SERVER-40944 Provide SCons variables files to enable icecream on OSX
Diffstat (limited to 'etc')
-rw-r--r--etc/scons/clang_macosx.vars39
-rw-r--r--etc/scons/icecream_clang_macosx.vars2
-rw-r--r--etc/scons/icecream_macosx_via_linux_cross.vars3
-rw-r--r--etc/scons/icecream_xcode_macosx.vars4
4 files changed, 48 insertions, 0 deletions
diff --git a/etc/scons/clang_macosx.vars b/etc/scons/clang_macosx.vars
new file mode 100644
index 00000000000..c470e1b14e9
--- /dev/null
+++ b/etc/scons/clang_macosx.vars
@@ -0,0 +1,39 @@
+# Configures the build to use Toolchain Clang to build with icecream
+# cross compiling for macOS
+
+import re
+import subprocess
+
+CC = "/opt/mongodbtoolchain/v3/bin/clang"
+CXX = "/opt/mongodbtoolchain/v3/bin/clang++"
+
+sdk_path = subprocess.check_output(["xcrun", "--sdk", "macosx", "--show-sdk-path"]).decode("utf-8").strip()
+toolchain_root = "{}/Toolchains/XcodeDefault.xctoolchain".format(
+ subprocess.check_output(["xcode-select", "-print-path"]).decode("utf-8").strip()
+)
+
+xcode_clang_path = subprocess.check_output(["xcrun", "-f", "--sdk", "macosx", "clang++"]).decode("utf-8")
+xcode_clang_version = re.compile(r"[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}").search(
+ subprocess
+ .check_output([xcode_clang_path, "--version"])
+ .decode("utf-8")
+ .split("\n")[0]
+).group(0)
+
+
+common_flags = [
+ "-mmacosx-version-min=10.12",
+ "-target darwin16.0.0",
+ "-arch x86_64",
+]
+
+CCFLAGS = " ".join([
+ f"-isysroot {sdk_path}",
+ f"-I{toolchain_root}/usr/lib/{xcode_clang_version}",
+ f"-I{toolchain_root}/usr/include/c++/v1",
+ f"-I{toolchain_root}/usr/include",
+] + common_flags)
+
+LINKFLAGS = " ".join([
+ f"-Wl,-syslibroot,{sdk_path}",
+] + common_flags)
diff --git a/etc/scons/icecream_clang_macosx.vars b/etc/scons/icecream_clang_macosx.vars
new file mode 100644
index 00000000000..9b59a96a11e
--- /dev/null
+++ b/etc/scons/icecream_clang_macosx.vars
@@ -0,0 +1,2 @@
+exec(open('etc/scons/clang_macosx.vars', "rb").read())
+exec(open('etc/scons/icecream_macosx_via_linux_cross.vars', "rb").read())
diff --git a/etc/scons/icecream_macosx_via_linux_cross.vars b/etc/scons/icecream_macosx_via_linux_cross.vars
new file mode 100644
index 00000000000..b8f3e75f979
--- /dev/null
+++ b/etc/scons/icecream_macosx_via_linux_cross.vars
@@ -0,0 +1,3 @@
+ICECC = "icecc"
+ICECC_VERSION = "http://mongodbtoolchain.build.10gen.cc/icecream/ubuntu1604/x86_64/latest"
+ICECC_VERSION_ARCH = "x86_64"
diff --git a/etc/scons/icecream_xcode_macosx.vars b/etc/scons/icecream_xcode_macosx.vars
new file mode 100644
index 00000000000..1d0060a01f3
--- /dev/null
+++ b/etc/scons/icecream_xcode_macosx.vars
@@ -0,0 +1,4 @@
+# Configures the build to use Toolchain Clang to build with icecream
+# cross compiling for macOS
+exec(open('etc/scons/xcode_macosx.vars', "rb").read())
+exec(open('etc/scons/icecream_macosx_via_linux_cross.vars', "rb").read())