llvm.org GIT mirror llvm / e72a9e9
[CMake][runtimes] Set clang-header dependency for builtins 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. Differential Revision: https://reviews.llvm.org/D58471 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354524 91177308-0d34-0410-b5e6-96231b3b80d8 Petr Hosek 6 months ago
1 changed file(s) with 22 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
210210 endif()
211211
212212 function(builtin_default_target compiler_rt_path)
213 cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN})
214
213215 llvm_ExternalProject_Add(builtins
214216 ${compiler_rt_path}/lib/builtins
217 DEPENDS ${ARG_DEPENDS}
215218 CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
216219 -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
217220 -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
226229 endfunction()
227230
228231 function(builtin_register_target compiler_rt_path target)
232 cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN})
233
229234 string(REPLACE "-" ";" builtin_target_list ${target})
230235 foreach(item ${builtin_target_list})
231236 string(TOLOWER "${item}" item_lower)
244249
245250 llvm_ExternalProject_Add(builtins-${target}
246251 ${compiler_rt_path}/lib/builtins
252 DEPENDS ${ARG_DEPENDS}
247253 CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
248254 -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
249255 -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
265271 get_compiler_rt_path(compiler_rt_path)
266272 if(compiler_rt_path)
267273 if(NOT LLVM_BUILTIN_TARGETS)
268 builtin_default_target(${compiler_rt_path})
274 builtin_default_target(${compiler_rt_path}
275 DEPENDS clang-headers)
269276 else()
270277 if("default" IN_LIST LLVM_BUILTIN_TARGETS)
271 builtin_default_target(${compiler_rt_path})
278 builtin_default_target(${compiler_rt_path}
279 DEPENDS clang-headers)
272280 list(REMOVE_ITEM LLVM_BUILTIN_TARGETS "default")
273281 else()
274282 add_custom_target(builtins)
277285 endif()
278286
279287 foreach(target ${LLVM_BUILTIN_TARGETS})
280 builtin_register_target(${compiler_rt_path} ${target})
288 builtin_register_target(${compiler_rt_path} ${target}
289 DEPENDS clang-headers)
281290
282291 add_dependencies(builtins builtins-${target})
283292 add_dependencies(install-builtins install-builtins-${target})
309318 endforeach()
310319
311320 function(runtime_default_target)
312 cmake_parse_arguments(ARG "" "" "DEPS;PREFIXES" ${ARGN})
321 cmake_parse_arguments(ARG "" "" "DEPENDS;PREFIXES" ${ARGN})
313322
314323 include(${LLVM_BINARY_DIR}/runtimes/Components.cmake OPTIONAL)
315324 set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/Components.cmake)
335344
336345 llvm_ExternalProject_Add(runtimes
337346 ${CMAKE_CURRENT_SOURCE_DIR}
338 DEPENDS ${ARG_DEPS}
347 DEPENDS ${ARG_DEPENDS}
339348 # Builtins were built separately above
340349 CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
341350 -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
362371 # runtime_register_target(target)
363372 # Utility function to register external runtime target.
364373 function(runtime_register_target name target)
365 cmake_parse_arguments(ARG "" "" "DEPS" ${ARGN})
374 cmake_parse_arguments(ARG "" "" "DEPENDS" ${ARGN})
366375 include(${LLVM_BINARY_DIR}/runtimes/${name}/Components.cmake OPTIONAL)
367376 set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/${name}/Components.cmake)
368377
369 set(${name}_deps ${ARG_DEPS})
378 set(${name}_deps ${ARG_DEPENDS})
370379 if(NOT name STREQUAL target)
371380 list(APPEND ${name}_deps runtimes-${target})
372381 endif()
448457 # together in a single CMake invocaiton.
449458 if(NOT LLVM_RUNTIME_TARGETS)
450459 runtime_default_target(
451 DEPS ${deps}
452 PREFIXES ${prefixes}
453 )
460 DEPENDS ${deps}
461 PREFIXES ${prefixes})
454462 else()
455463 if("default" IN_LIST LLVM_RUNTIME_TARGETS)
456464 runtime_default_target(
457 DEPS ${deps}
465 DEPENDS ${deps}
458466 PREFIXES ${prefixes})
459467 list(REMOVE_ITEM LLVM_RUNTIME_TARGETS "default")
460468 else()
477485
478486 foreach(name ${LLVM_RUNTIME_TARGETS})
479487 runtime_register_target(${name} ${name}
480 DEPS ${deps}
481 )
488 DEPENDS ${deps})
482489
483490 add_dependencies(runtimes runtimes-${name})
484491 add_dependencies(runtimes-configure runtimes-${name}-configure)
504511 endif()
505512 foreach(name ${LLVM_RUNTIME_SANITIZER_${sanitizer}_TARGETS})
506513 runtime_register_target(${name}-${sanitizer_name} ${name}
507 DEPS runtimes-${name}
514 DEPENDS runtimes-${name}
508515 CMAKE_ARGS -DLLVM_USE_SANITIZER=${sanitizer}
509516 -DLLVM_RUNTIMES_PREFIX=${name}/
510 -DLLVM_RUNTIMES_LIBDIR_SUFFIX=/${sanitizer_name}
511 )
517 -DLLVM_RUNTIMES_LIBDIR_SUFFIX=/${sanitizer_name})
512518 add_dependencies(runtimes runtimes-${name}-${sanitizer_name})
513519 add_dependencies(runtimes-configure runtimes-${name}-${sanitizer_name}-configure)
514520 add_dependencies(install-runtimes install-runtimes-${name}-${sanitizer_name})