[compiler-rt] 78fb021 - [compiler-rt][macOS]: Disable iOS support if iOS SDK is not found

Tobias Hieta via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 23:12:41 PST 2023


Author: Tobias Hieta
Date: 2023-02-08T08:12:34+01:00
New Revision: 78fb02107ae5819501af2600b0bebd48c1900a9b

URL: https://github.com/llvm/llvm-project/commit/78fb02107ae5819501af2600b0bebd48c1900a9b
DIFF: https://github.com/llvm/llvm-project/commit/78fb02107ae5819501af2600b0bebd48c1900a9b.diff

LOG: [compiler-rt][macOS]: Disable iOS support if iOS SDK is not found

If you are missing the iOS SDK on your macOS (for example you don't have
full Xcode but just CommandLineTools) then CMake currently errors
out without a helpful message. This patch disables iOS support in
compiler-rt if the iOS SDK is not found. This can be overriden by
passing -DCOMPILER_RT_ENABLE_IOS=ON.

Reviewed By: delcypher, thetruestblue

Differential Revision: https://reviews.llvm.org/D133273

Added: 
    

Modified: 
    compiler-rt/cmake/base-config-ix.cmake

Removed: 
    


################################################################################
diff  --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
index 0ad95d57fa74c..c6e95055b0028 100644
--- a/compiler-rt/cmake/base-config-ix.cmake
+++ b/compiler-rt/cmake/base-config-ix.cmake
@@ -8,6 +8,7 @@ include(CheckIncludeFile)
 include(CheckCXXSourceCompiles)
 include(GNUInstallDirs)
 include(ExtendPath)
+include(CompilerRTDarwinUtils)
 
 check_include_file(unwind.h HAVE_UNWIND_H)
 
@@ -145,7 +146,18 @@ if(APPLE)
                    "-darwin-target-variant" "x86_64-apple-ios13.1-macabi"
                    "-Werror")
   option(COMPILER_RT_ENABLE_MACCATALYST "Enable building for Mac Catalyst" ${COMPILER_RT_HAS_DARWIN_TARGET_VARIANT_FLAG})
-  option(COMPILER_RT_ENABLE_IOS "Enable building for iOS" On)
+
+  # Don't enable COMPILER_RT_ENABLE_IOS if we can't find the sdk dir.
+  # This can happen when you only have the commandline tools installed
+  # which doesn't come with the iOS SDK.
+  find_darwin_sdk_dir(HAS_IOS_SDK "iphoneos")
+  set(COMPILER_RT_ENABLE_IOS_DEFAULT On)
+  if("${HAS_IOS_SDK}" STREQUAL "")
+    message(WARNING "iOS SDK not found! Building compiler-rt without iOS support.")
+    set(COMPILER_RT_ENABLE_IOS_DEFAULT Off)
+  endif()
+  option(COMPILER_RT_ENABLE_IOS "Enable building for iOS" ${COMPILER_RT_ENABLE_IOS_DEFAULT})
+
   option(COMPILER_RT_ENABLE_WATCHOS "Enable building for watchOS - Experimental" Off)
   option(COMPILER_RT_ENABLE_TVOS "Enable building for tvOS - Experimental" Off)
 


        


More information about the llvm-commits mailing list