[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 11:05:23 PDT 2019


beanz created this revision.
beanz added reviewers: phosek, compnerd, smeenai.
Herald added a subscriber: mgorny.
Herald added a project: LLVM.

On Darwin C++ headers are packaged with the compiler not the sysroot. If you don't copy C++ headers into the build include directory during configuraiton of the outer build the C++ check during the runtime configuration may get inaccurate results.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62155

Files:
  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 *)
@@ -34,6 +38,15 @@
   set(LLVM_EXTERNAL_${canon_name}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../${proj}")
 endforeach()
 
+# On Apple 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 plae before running any of the build.
+if(APPLE)
+  if ("libcxx" IN_LIST LLVM_ENABLE_RUNTIMES)
+    execute_process(COMMAND ditto ${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR}/include ${LLVM_INCLUDE_DIR}/c++/v1/)
+  endif()
+endif()
+
 function(get_compiler_rt_path path)
   foreach(entry ${runtimes})
     get_filename_component(projName ${entry} NAME)


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


More information about the llvm-commits mailing list