1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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)
|