Skip to content

Commit 8a534b0

Browse files
committedMay 17, 2018
[CMake] Support runtimes in distributions
Summary: This patch adds a new internal variable LLVM_RUNTIME_DISTRIBUTION_COMPONENTS which specifies distribution components that are part of runtime projects, and thus should be exposed from runtime configuraitons up into the top-level CMake configurations. This is required for allowing runtime components to be included in LLVM_DISTRIBUTION_COMPONENTS because we verify that the build and install targets exist for every component specified for the distribution. Without this patch runtimes and builtins can only be included in distributions in whole, not by component. Reviewers: phosek Reviewed By: phosek Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D46705 llvm-svn: 332631
1 parent 93d45bc commit 8a534b0

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
 

‎llvm/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ if(LLVM_DISTRIBUTION_COMPONENTS)
998998
add_custom_target(distribution)
999999
add_custom_target(install-distribution)
10001000
add_custom_target(install-distribution-stripped)
1001-
foreach(target ${LLVM_DISTRIBUTION_COMPONENTS})
1001+
foreach(target ${LLVM_DISTRIBUTION_COMPONENTS} ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
10021002
if(TARGET ${target})
10031003
add_dependencies(distribution ${target})
10041004
else()

‎llvm/runtimes/CMakeLists.txt

+19
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,11 @@ else() # if this is included from LLVM's CMake
352352
list(APPEND test_targets check-${runtime_name})
353353
endif()
354354
endforeach()
355+
foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
356+
if(NOT ${component} IN_LIST SUB_COMPONENTS)
357+
list(APPEND extra_targets ${component} install-${component} install-${component}-stripped)
358+
endif()
359+
endforeach()
355360

356361
if(LLVM_INCLUDE_TESTS)
357362
list(APPEND test_targets runtimes-test-depends check-runtimes)
@@ -407,6 +412,14 @@ else() # if this is included from LLVM's CMake
407412
list(APPEND ${name}_extra_targets "${target_name}:${target_name}-${name}")
408413
endforeach()
409414

415+
foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
416+
if(NOT "${target_name}:${target_name}-${component}" IN_LIST extra_targets)
417+
list(APPEND ${name}_extra_targets
418+
"${target_name}:${target_name}-${component}"
419+
"${target_name}:${target_name}-install-${component}")
420+
endif()
421+
endforeach()
422+
410423
if(LLVM_INCLUDE_TESTS)
411424
list(APPEND ${name}_test_targets
412425
"runtimes-test-depends:runtimes-test-depends-${name}"
@@ -478,6 +491,12 @@ else() # if this is included from LLVM's CMake
478491
add_custom_target(runtimes-test-depends)
479492
set(test_targets "")
480493
endif()
494+
if(LLVM_RUNTIME_DISTRIBUTION_COMPONENTS)
495+
foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
496+
add_custom_target(${component})
497+
add_custom_target(install-${component})
498+
endforeach()
499+
endif()
481500
endif()
482501

483502
foreach(name ${LLVM_RUNTIME_TARGETS})

0 commit comments

Comments
 (0)
Please sign in to comment.