[PATCH] D58471: [CMake][runtimes] Set clang-header dependency for builtins

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 20 12:43:03 PST 2019


phosek created this revision.
phosek added reviewers: beanz, smeenai.
Herald added subscribers: llvm-commits, jdoerfert, mgorny.
Herald added a project: LLVM.

compiler-rt builtins depend on clang headers, but that dependency
wasn't explicitly stated in the build system and we were relying
on the transitive depenendecy via clang. However, when we're
cross-compiling clang, we'll be using host compiler instead and
that depenendecy is missing, breaking the build.


Repository:
  rL LLVM

https://reviews.llvm.org/D58471

Files:
  llvm/runtimes/CMakeLists.txt


Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -211,8 +211,11 @@
   endif()
 
   function(builtin_default_target compiler_rt_path)
+    cmake_parse_arguments(ARG "" "" "DEPS" ${ARGN})
+
     llvm_ExternalProject_Add(builtins
                              ${compiler_rt_path}/lib/builtins
+                             DEPENDS ${ARG_DEPS}
                              CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
                                         -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
                                         -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
@@ -227,6 +230,8 @@
   endfunction()
 
   function(builtin_register_target compiler_rt_path target)
+    cmake_parse_arguments(ARG "" "" "DEPS" ${ARGN})
+
     string(REPLACE "-" ";" builtin_target_list ${target})
     foreach(item ${builtin_target_list})
       string(TOLOWER "${item}" item_lower)
@@ -245,6 +250,7 @@
 
     llvm_ExternalProject_Add(builtins-${target}
                              ${compiler_rt_path}/lib/builtins
+                             DEPENDS ${ARG_DEPS}
                              CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
                                         -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
                                         -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
@@ -266,10 +272,10 @@
   get_compiler_rt_path(compiler_rt_path)
   if(compiler_rt_path)
     if(NOT LLVM_BUILTIN_TARGETS)
-      builtin_default_target(${compiler_rt_path})
+      builtin_default_target(${compiler_rt_path} DEPS clang-headers)
     else()
       if("default" IN_LIST LLVM_BUILTIN_TARGETS)
-        builtin_default_target(${compiler_rt_path})
+        builtin_default_target(${compiler_rt_path} DEPS clang-headers)
         list(REMOVE_ITEM LLVM_BUILTIN_TARGETS "default")
       else()
         add_custom_target(builtins)
@@ -278,7 +284,7 @@
       endif()
 
       foreach(target ${LLVM_BUILTIN_TARGETS})
-        builtin_register_target(${compiler_rt_path} ${target})
+        builtin_register_target(${compiler_rt_path} ${target} DEPS clang-headers)
 
         add_dependencies(builtins builtins-${target})
         add_dependencies(install-builtins install-builtins-${target})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58471.187650.patch
Type: text/x-patch
Size: 2383 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190220/019e67ef/attachment.bin>


More information about the llvm-commits mailing list