[PATCH] D62155: [CMake] Copy C++ headers during config on Darwin

Chris Bieneman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 12:42:57 PDT 2019


beanz updated this revision to Diff 200345.
beanz added a comment.

Updates based on review feedback.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62155

Files:
  llvm/cmake/modules/CopyRuntimeHeaders.cmake
  llvm/runtimes/CMakeLists.txt


Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -4,8 +4,12 @@
 # should be built with the LLVM toolchain from the build directory. This file is
 # a first step to formalizing runtime build interfaces.
 
-# In the current state this file only works with compiler-rt, other runtimes
-# will work as the runtime build interface standardizes.
+# Setting CMake minimum required version should be at the very top of the file
+# if this is the entry point.
+if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+  cmake_minimum_required(VERSION 3.4.3)
+  project(Runtimes C CXX ASM)
+endif()
 
 # Find all subdirectories containing CMake projects
 file(GLOB entries *)
@@ -205,6 +209,8 @@
 
 else() # if this is included from LLVM's CMake
   include(LLVMExternalProjectUtils)
+  include(CopyRuntimeHeaders)
+  copy_libcxx_headers(${LLVM_INCLUDE_DIR})
 
   if(NOT LLVM_BUILD_RUNTIMES)
     set(EXTRA_ARGS EXCLUDE_FROM_ALL)
Index: llvm/cmake/modules/CopyRuntimeHeaders.cmake
===================================================================
--- /dev/null
+++ llvm/cmake/modules/CopyRuntimeHeaders.cmake
@@ -0,0 +1,11 @@
+# On some platforms c++ headers come with the toolchain, not the sysroot, and
+# when building with the runtimes we need to make sure the C++ headers are
+# copied into place before running any of the build.
+
+function(copy_libcxx_headers destination)
+  if(LLVM_EXTERNAL_LIBCXX_SOURCE_DIR)
+    execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory
+                            ${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR}/include
+                            ${destination}/c++/v1/)
+  endif()
+endfunction()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62155.200345.patch
Type: text/x-patch
Size: 1748 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190520/8ad3e21b/attachment.bin>


More information about the llvm-commits mailing list