Skip to content

Commit 5190cf8

Browse files
committed
gn build: Add a toggle for building against the commandline tools SDK on macOS
1 parent 2f3e8cb commit 5190cf8

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

llvm/utils/gn/build/mac_sdk.gni

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1+
declare_args() {
2+
# Set to true if you don't have Xcode installed, but do have the commandline
3+
# tools.
4+
mac_use_commandline_tools_sdk = false
5+
}
6+
17
# Location of the mac sdk.
2-
# If that's not fixed, might want to shell out to xcrun at gn time to
3-
# retrieve this, but for now this seems to do the trick.
4-
mac_sdk_path = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
8+
# The correct way to do this is to call xcrun (https://reviews.llvm.org/D70835),
9+
# but that makes `gn gen` take twice as long and almost everyone has Xcode
10+
# installed. So require that people who don't have it installed set a gn arg.
11+
if (mac_use_commandline_tools_sdk) {
12+
mac_sdk_path = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
13+
} else {
14+
mac_sdk_path = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
15+
}

0 commit comments

Comments
 (0)