[runtimes] Support sub-components in LLVM_RUNTIME_DISTRIBUTION_COMPONENTS
authorShoaib Meenai <smeenai@fb.com>
Wed, 30 Nov 2022 01:38:12 +0000 (17:38 -0800)
committerShoaib Meenai <smeenai@fb.com>
Wed, 30 Nov 2022 19:14:37 +0000 (11:14 -0800)
Right now, sub-components are only accounted for when the runtime has
been configured and the main LLVM configure is rerun after that. We can
make use of LLVM_RUNTIME_DISTRIBUTION_COMPONENTS to make sub-component
targets available from the start, but that currently clashes with the
sub-component target generation once they are picked up. Make sure we
don't create duplicate targets; an analogous check already exists in
runtime_default_target.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D138966

llvm/runtimes/CMakeLists.txt

index a62d9fa..76ad1d6 100644 (file)
@@ -287,10 +287,12 @@ function(runtime_register_target name target)
   endforeach()
 
   foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
-    set(${component}-${name} ${component})
-    set(install-${component}-${name} install-${component})
-    set(install-${component}-${name}-stripped install-${component}-stripped)
-    list(APPEND ${name}_extra_targets ${component}-${name} install-${component}-${name} install-${component}-${name}-stripped)
+    if(NOT component IN_LIST SUB_COMPONENTS)
+      set(${component}-${name} ${component})
+      set(install-${component}-${name} install-${component})
+      set(install-${component}-${name}-stripped install-${component}-stripped)
+      list(APPEND ${name}_extra_targets ${component}-${name} install-${component}-${name} install-${component}-${name}-stripped)
+    endif()
   endforeach()
 
   if(LLVM_INCLUDE_TESTS)