[PATCH] D86313: [runtimes] Allow LLVM_BUILTIN_TARGETS to include Darwin

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 14:11:32 PDT 2020


smeenai updated this revision to Diff 286899.
smeenai added a comment.

Add explicit error and flag


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86313

Files:
  llvm/runtimes/CMakeLists.txt


Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -233,6 +233,33 @@
     set(EXTRA_ARGS EXCLUDE_FROM_ALL)
   endif()
 
+  function(check_apple_target triple)
+    set(error "\
+compiler-rt for Darwin builds for all platforms and architectures using a \
+single configuration. Specify only a single darwin triple (e.g. x86_64-apple-darwin) \
+in your targets list (and not a triple for a specific platform such as macos). \
+You can use variables such as COMPILER_RT_ENABLE_IOS and DARWIN_ios_ARCHS to \
+control the specific platforms and architectures to build.")
+
+    string(REPLACE "-" ";" triple_components ${triple})
+    foreach(component ${triple_components})
+      string(TOLOWER "${component}" component_lower)
+      if(component_lower MATCHES "^darwin")
+        get_property(darwin_triple_seen GLOBAL PROPERTY runtimes_darwin_triple_seen)
+        if(darwin_triple_seen)
+          message(FATAL_ERROR "${error}")
+        endif()
+        set_property(GLOBAL PROPERTY runtimes_darwin_triple_seen YES)
+        if(NOT RUNTIMES_BUILD_ALLOW_DARWIN)
+          message(FATAL_ERROR "\
+${error} Set RUNTIMES_BUILD_ALLOW_DARWIN to allow a single darwin triple.")
+        endif()
+      elseif(component_lower MATCHES "^ios|^macos|^tvos|^watchos")
+        message(FATAL_ERROR "${error}")
+      endif()
+    endforeach()
+  endfunction()
+
   function(builtin_default_target compiler_rt_path)
     cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN})
 
@@ -256,13 +283,7 @@
   function(builtin_register_target compiler_rt_path target)
     cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN})
 
-    string(REPLACE "-" ";" builtin_target_list ${target})
-    foreach(item ${builtin_target_list})
-      string(TOLOWER "${item}" item_lower)
-      if(item_lower MATCHES "darwin")
-        message(FATAL_ERROR "LLVM_BUILTIN_TARGETS isn't implemented for Darwin platform!")
-      endif()
-    endforeach()
+    check_apple_target(${target})
 
     get_cmake_property(variableNames VARIABLES)
     foreach(variableName ${variableNames})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86313.286899.patch
Type: text/x-patch
Size: 2164 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200820/5b5b659b/attachment.bin>


More information about the llvm-commits mailing list