[llvm] 5190cf8 - gn build: Add a toggle for building against the commandline tools SDK on macOS

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 28 16:30:46 PST 2019


Author: Nico Weber
Date: 2019-11-28T19:30:34-05:00
New Revision: 5190cf8ffd9a7878d79fd92a5e682891f0693377

URL: https://github.com/llvm/llvm-project/commit/5190cf8ffd9a7878d79fd92a5e682891f0693377
DIFF: https://github.com/llvm/llvm-project/commit/5190cf8ffd9a7878d79fd92a5e682891f0693377.diff

LOG: gn build: Add a toggle for building against the commandline tools SDK on macOS

Added: 
    

Modified: 
    llvm/utils/gn/build/mac_sdk.gni

Removed: 
    


################################################################################
diff  --git a/llvm/utils/gn/build/mac_sdk.gni b/llvm/utils/gn/build/mac_sdk.gni
index 7999042a7ab5..8fa75647afd1 100644
--- a/llvm/utils/gn/build/mac_sdk.gni
+++ b/llvm/utils/gn/build/mac_sdk.gni
@@ -1,4 +1,15 @@
+declare_args() {
+  # Set to true if you don't have Xcode installed, but do have the commandline
+  # tools.
+  mac_use_commandline_tools_sdk = false
+}
+
 # Location of the mac sdk.
-# If that's not fixed, might want to shell out to xcrun at gn time to
-# retrieve this, but for now this seems to do the trick.
-mac_sdk_path = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
+# The correct way to do this is to call xcrun (https://reviews.llvm.org/D70835),
+# but that makes `gn gen` take twice as long and almost everyone has Xcode
+# installed.  So require that people who don't have it installed set a gn arg.
+if (mac_use_commandline_tools_sdk) {
+  mac_sdk_path = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
+} else {
+  mac_sdk_path = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
+}


        


More information about the llvm-commits mailing list