phosek updated this revision to Diff 198347.
Herald added projects: clang, Sanitizers.
Herald added subscribers: Sanitizers, cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D49587

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake
  compiler-rt/cmake/Modules/AddCompilerRT.cmake
  libcxx/src/CMakeLists.txt
  libcxxabi/src/CMakeLists.txt
  libunwind/src/CMakeLists.txt
  llvm/runtimes/CMakeLists.txt

Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -114,6 +114,9 @@
   # Remove the -nostdlib++ option we've added earlier.
   string(REPLACE "-nostdlib++" "" CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
 
+  string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+         ${PACKAGE_VERSION})
+
   # This can be used to detect whether we're in the runtimes build.
   set(RUNTIMES_BUILD ON)
 
@@ -203,6 +206,18 @@
     endif()
   endif()
 
+  get_property(llvm_runtime_has_exports GLOBAL PROPERTY LLVM_RUNTIME_HAS_EXPORTS)
+  if(llvm_runtime_has_exports)
+    if(LLVM_RUNTIMES_TARGET)
+      set(LLVM_RUNTIMES_FILE ${LLVM_BINARY_DIR}/runtimes/${LLVM_RUNTIMES_TARGET}/LLVMRuntimes.cmake)
+    else()
+      set(LLVM_RUNTIMES_FILE ${LLVM_BINARY_DIR}/runtimes/LLVMRuntimes.cmake)
+    endif()
+    export(EXPORT LLVMRuntimes FILE ${LLVM_RUNTIMES_FILE})
+    install(EXPORT LLVMRuntimes
+            DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}
+            COMPONENT cmake-exports)
+  endif()
 else() # if this is included from LLVM's CMake
   include(LLVMExternalProjectUtils)
 
@@ -409,7 +424,10 @@
     foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
       set(${component}-${name} ${component})
       set(install-${component}-${name} ${component})
-      list(APPEND ${name}_extra_targets ${component}-${name} install-${component}-${name})
+      set(install-${component}-${name}-stripped ${component})
+      if(NOT ${component}-${name} IN_LIST extra_targets)
+        list(APPEND ${extra}_extra_targets ${component}-${name} install-${component}-${name} install-${component}-${name}-stripped)
+      endif()
     endforeach()
 
     if(LLVM_INCLUDE_TESTS)
@@ -461,6 +479,7 @@
                                         -DLLVM_RUNTIMES_TARGET=${name}
                                         ${${name}_extra_args}
                              PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES
+                                                  LLVM_RUNTIME_DISTRIBUTION_COMPONENTS
                              TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib llvm-nm llvm-objcopy llvm-objdump llvm-strip
                              EXTRA_TARGETS ${${name}_extra_targets}
                                            ${${name}_test_targets}
@@ -496,6 +515,7 @@
           foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
             add_custom_target(${component})
             add_custom_target(install-${component})
+            add_custom_target(install-${component}-stripped)
           endforeach()
         endif()
       endif()
Index: libunwind/src/CMakeLists.txt
===================================================================
--- libunwind/src/CMakeLists.txt
+++ libunwind/src/CMakeLists.txt
@@ -157,7 +157,11 @@
 add_custom_target(unwind DEPENDS ${LIBUNWIND_BUILD_TARGETS})
 
 if (LIBUNWIND_INSTALL_LIBRARY)
-  install(TARGETS ${LIBUNWIND_INSTALL_TARGETS}
+  if(libcxxabi IN_LIST LLVM_RUNTIME_DISTRIBUTION_COMPONENTS)
+    set(export_to_llvmruntimes EXPORT LLVMRuntimes)
+    set_property(GLOBAL PROPERTY LLVM_RUNTIME_HAS_EXPORTS TRUE)
+  endif()
+  install(TARGETS ${LIBUNWIND_INSTALL_TARGETS} ${export_to_llvmruntimes}
     LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind
     ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind)
 endif()
Index: libcxxabi/src/CMakeLists.txt
===================================================================
--- libcxxabi/src/CMakeLists.txt
+++ libcxxabi/src/CMakeLists.txt
@@ -237,7 +237,11 @@
 add_custom_target(cxxabi DEPENDS ${LIBCXXABI_BUILD_TARGETS})
 
 if (LIBCXXABI_INSTALL_LIBRARY)
-  install(TARGETS ${LIBCXXABI_INSTALL_TARGETS}
+  if(libcxxabi IN_LIST LLVM_RUNTIME_DISTRIBUTION_COMPONENTS)
+    set(export_to_llvmruntimes EXPORT LLVMRuntimes)
+    set_property(GLOBAL PROPERTY LLVM_RUNTIME_HAS_EXPORTS TRUE)
+  endif()
+  install(TARGETS ${LIBCXXABI_INSTALL_TARGETS} ${export_to_llvmruntimes}
     LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
     ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
     )
Index: libcxx/src/CMakeLists.txt
===================================================================
--- libcxx/src/CMakeLists.txt
+++ libcxx/src/CMakeLists.txt
@@ -436,7 +436,11 @@
   if (LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
     set(experimental_lib cxx_experimental)
   endif()
-  install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${experimental_lib}
+  if(libcxx IN_LIST LLVM_RUNTIME_DISTRIBUTION_COMPONENTS)
+    set(export_to_llvmruntimes EXPORT LLVMRuntimes)
+    set_property(GLOBAL PROPERTY LLVM_RUNTIME_HAS_EXPORTS TRUE)
+  endif()
+  install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${experimental_lib} ${export_to_llvmruntimes}
     LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
     ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
     )
Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
===================================================================
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -320,7 +320,12 @@
       set_property(TARGET ${libname} APPEND PROPERTY
                    COMPILE_DEFINITIONS ${LIB_DEFS})
       set_target_output_directories(${libname} ${output_dir_${libname}})
-      install(TARGETS ${libname}
+      if(${name} IN_LIST LLVM_RUNTIME_DISTRIBUTION_COMPONENTS OR
+         "compiler-rt" IN_LIST LLVM_RUNTIME_DISTRIBUTION_COMPONENTS)
+        set(export_to_llvmruntimes EXPORT LLVMRuntimes)
+        set_property(GLOBAL PROPERTY LLVM_RUNTIME_HAS_EXPORTS TRUE)
+      endif()
+      install(TARGETS ${libname} ${export_to_llvmruntimes}
         ARCHIVE DESTINATION ${install_dir_${libname}}
                 ${COMPONENT_OPTION}
         LIBRARY DESTINATION ${install_dir_${libname}}
Index: clang/cmake/caches/Fuchsia-stage2.cmake
===================================================================
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -206,3 +206,10 @@
   runtimes
   ${LLVM_TOOLCHAIN_TOOLS}
   CACHE STRING "")
+
+set(LLVM_RUNTIME_DISTRIBUTION_COMPONENTS
+  compiler-rt
+  libcxx
+  libcxxabi
+  libunwind
+  CACHE STRING "")
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to