[PATCH] D133273: [compiler-rt][macOS]: Fix building compiler-rt without iOS related SDKs

Tobias Hieta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 13:04:14 PST 2023


thieta updated this revision to Diff 495626.
thieta added a comment.

Added warning when the iOS sdk is not found.
Reworded the commit message to reflect the current state of the patch


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133273/new/

https://reviews.llvm.org/D133273

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


Index: compiler-rt/cmake/base-config-ix.cmake
===================================================================
--- compiler-rt/cmake/base-config-ix.cmake
+++ compiler-rt/cmake/base-config-ix.cmake
@@ -8,6 +8,7 @@
 include(CheckCXXSourceCompiles)
 include(GNUInstallDirs)
 include(ExtendPath)
+include(CompilerRTDarwinUtils)
 
 check_include_file(unwind.h HAVE_UNWIND_H)
 
@@ -145,7 +146,18 @@
                    "-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)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133273.495626.patch
Type: text/x-patch
Size: 1407 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230207/09010ac8/attachment.bin>


More information about the llvm-commits mailing list