[PATCH] D84908: [darwin][compiler-rt] build libclang_rt.<os>sim.a Apple Silicon slice, if SDK supports it

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 30 09:42:17 PDT 2020


arphaman updated this revision to Diff 281963.
arphaman added a comment.

don't check if the SDK isn't present.


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

https://reviews.llvm.org/D84908

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


Index: compiler-rt/cmake/builtin-config-ix.cmake
===================================================================
--- compiler-rt/cmake/builtin-config-ix.cmake
+++ compiler-rt/cmake/builtin-config-ix.cmake
@@ -93,6 +93,21 @@
     endif()
   endforeach(arch)
 
+  function(set_simulator_arches all_possible_archs os sdkname)
+    set(simulator_arches ${X86} ${X86_64})
+    # Add additional slices for Apple Silicon simulator targets, if they're
+    # supported by the SDK.
+    if(NOT "${DARWIN_${os}sim_SYSROOT}" STREQUAL "")
+      foreach(arch ${ARM64})
+        sdk_has_arch_support(${DARWIN_${os}sim_SYSROOT} ${sdkname} ${arch} SIM_ARM_SUPPORT)
+        if (SIM_ARM_SUPPORT)
+          list(APPEND simulator_arches ${arch})
+        endif()
+      endforeach()
+    endif()
+    set("${all_possible_archs}" ${simulator_arches} PARENT_SCOPE)
+  endfunction()
+
   if(COMPILER_RT_ENABLE_IOS)
     list(APPEND DARWIN_EMBEDDED_PLATFORMS ios)
     set(DARWIN_ios_MIN_VER_FLAG -miphoneos-version-min)
@@ -100,7 +115,7 @@
     set(DARWIN_ios_BUILTIN_MIN_VER_FLAG
       ${DARWIN_ios_MIN_VER_FLAG}=${DARWIN_ios_BUILTIN_MIN_VER})
     set(DARWIN_ios_BUILTIN_ALL_POSSIBLE_ARCHS ${ARM64} ${ARM32})
-    set(DARWIN_iossim_BUILTIN_ALL_POSSIBLE_ARCHS ${X86} ${X86_64})
+    set_simulator_arches(DARWIN_iossim_BUILTIN_ALL_POSSIBLE_ARCHS ios iphonesimulator)
   endif()
   if(COMPILER_RT_ENABLE_WATCHOS)
     list(APPEND DARWIN_EMBEDDED_PLATFORMS watchos)
@@ -109,7 +124,7 @@
     set(DARWIN_watchos_BUILTIN_MIN_VER_FLAG
       ${DARWIN_watchos_MIN_VER_FLAG}=${DARWIN_watchos_BUILTIN_MIN_VER})
     set(DARWIN_watchos_BUILTIN_ALL_POSSIBLE_ARCHS armv7 armv7k)
-    set(DARWIN_watchossim_BUILTIN_ALL_POSSIBLE_ARCHS ${X86})
+    set_simulator_arches(DARWIN_watchossim_BUILTIN_ALL_POSSIBLE_ARCHS watchos watchsimulator)
   endif()
   if(COMPILER_RT_ENABLE_TVOS)
     list(APPEND DARWIN_EMBEDDED_PLATFORMS tvos)
@@ -118,7 +133,7 @@
     set(DARWIN_tvos_BUILTIN_MIN_VER_FLAG
       ${DARWIN_tvos_MIN_VER_FLAG}=${DARWIN_tvos_BUILTIN_MIN_VER})
     set(DARWIN_tvos_BUILTIN_ALL_POSSIBLE_ARCHS armv7 arm64)
-    set(DARWIN_tvossim_BUILTIN_ALL_POSSIBLE_ARCHS ${X86} ${X86_64})
+    set_simulator_arches(DARWIN_tvossim_BUILTIN_ALL_POSSIBLE_ARCHS tvos appletvsimulator)
   endif()
 
   set(BUILTIN_SUPPORTED_OS osx)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84908.281963.patch
Type: text/x-patch
Size: 2296 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200730/22a440f7/attachment.bin>


More information about the cfe-commits mailing list