[Lldb-commits] [lldb] 576b538 - Revert "[libc++] Stop copying headers to the build directory (#115380)"

Kirill Stoimenov via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 14 10:24:49 PST 2025


Author: Kirill Stoimenov
Date: 2025-01-14T18:23:07Z
New Revision: 576b53801fc3d721602ae0d8377af9950f356000

URL: https://github.com/llvm/llvm-project/commit/576b53801fc3d721602ae0d8377af9950f356000
DIFF: https://github.com/llvm/llvm-project/commit/576b53801fc3d721602ae0d8377af9950f356000.diff

LOG: Revert "[libc++] Stop copying headers to the build directory (#115380)"

This reverts commit 428c8767ae997b0f726c0b40160ea8172551babf.

Breaks sanitizer build: https://lab.llvm.org/buildbot/#/builders/51/builds/9056

Added: 
    

Modified: 
    libcxx/CMakeLists.txt
    libcxxabi/CMakeLists.txt
    libcxxabi/include/CMakeLists.txt
    lldb/test/CMakeLists.txt
    lldb/utils/lldb-dotest/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 5fab3a99e9e862..abe12c2805a7cf 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -414,16 +414,15 @@ set(LIBCXX_INSTALL_MODULES_DIR "share/libc++/v1" CACHE STRING
 set(LIBCXX_SHARED_OUTPUT_NAME "c++" CACHE STRING "Output name for the shared libc++ runtime library.")
 set(LIBCXX_STATIC_OUTPUT_NAME "c++" CACHE STRING "Output name for the static libc++ runtime library.")
 
-set(LIBCXX_GENERATED_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++/v1")
-set(LIBCXX_GENERATED_MODULE_DIR "${LIBCXX_BINARY_DIR}/modules/c++/v1")
-
 if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
   set(LIBCXX_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE})
   if(LIBCXX_LIBDIR_SUBDIR)
     string(APPEND LIBCXX_TARGET_SUBDIR /${LIBCXX_LIBDIR_SUBDIR})
   endif()
   set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBCXX_TARGET_SUBDIR})
-  set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_BINARY_DIR}/include/${LIBCXX_TARGET_SUBDIR}/c++/v1")
+  set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
+  set(LIBCXX_GENERATED_MODULE_DIR "${LLVM_BINARY_DIR}/modules/c++/v1")
+  set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LIBCXX_TARGET_SUBDIR}/c++/v1")
   set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBCXX_TARGET_SUBDIR} CACHE STRING
       "Path where built libc++ libraries should be installed.")
   set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${LIBCXX_TARGET_SUBDIR}/c++/v1" CACHE STRING
@@ -432,8 +431,12 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
 else()
   if(LLVM_LIBRARY_OUTPUT_INTDIR)
     set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+    set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
+    set(LIBCXX_GENERATED_MODULE_DIR "${LLVM_BINARY_DIR}/modules/c++/v1")
   else()
     set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+    set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
+    set(LIBCXX_GENERATED_MODULE_DIR "${CMAKE_BINARY_DIR}/modules/c++/v1")
   endif()
   set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}")
   set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX} CACHE STRING

diff  --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index 4da42faad67413..6dcfc51e553213 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -91,6 +91,12 @@ set(LIBCXXABI_STATIC_OUTPUT_NAME "c++abi" CACHE STRING "Output name for the stat
 
 set(LIBCXXABI_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1" CACHE STRING "Path to install the libc++abi headers at.")
 
+if(LLVM_LIBRARY_OUTPUT_INTDIR)
+  set(LIBCXXABI_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
+else()
+  set(LIBCXXABI_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
+endif()
+
 set(LIBCXXABI_LIBCXX_LIBRARY_PATH "" CACHE PATH "The path to libc++ library.")
 set(LIBCXXABI_LIBRARY_VERSION "1.0" CACHE STRING
 "Version of libc++abi. This will be reflected in the name of the shared \

diff  --git a/libcxxabi/include/CMakeLists.txt b/libcxxabi/include/CMakeLists.txt
index 0deb7b1eb9e715..5b1cc2545016ec 100644
--- a/libcxxabi/include/CMakeLists.txt
+++ b/libcxxabi/include/CMakeLists.txt
@@ -3,7 +3,20 @@ set(files
   cxxabi.h
   )
 
+foreach(f ${files})
+  set(src "${CMAKE_CURRENT_SOURCE_DIR}/${f}")
+  set(dst "${LIBCXXABI_GENERATED_INCLUDE_DIR}/${f}")
+  add_custom_command(OUTPUT ${dst}
+    DEPENDS ${src}
+    COMMAND ${CMAKE_COMMAND} -E copy_if_
diff erent ${src} ${dst}
+    COMMENT "Copying CXXABI header ${f}")
+  list(APPEND _all_includes "${dst}")
+endforeach()
+
+add_custom_target(generate-cxxabi-headers ALL DEPENDS ${_all_includes})
+
 add_library(cxxabi-headers INTERFACE)
+add_dependencies(cxxabi-headers generate-cxxabi-headers)
 target_include_directories(cxxabi-headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
 
 if (LIBCXXABI_INSTALL_HEADERS)

diff  --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt
index d51b18d71f3980..6449ac5a9247f6 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -157,22 +157,15 @@ if(TARGET clang)
   # TestFullLtoStepping depends on LTO, and only runs when the compiler is clang.
   add_lldb_test_dependency(LTO)
 
-  if ("libcxx" IN_LIST LLVM_ENABLE_RUNTIMES)
+  if (TARGET libcxx OR ("libcxx" IN_LIST LLVM_ENABLE_RUNTIMES))
     set(LLDB_HAS_LIBCXX ON)
-    # libc++ can only be used for tests after installing to a fake prefix
-    # which is done by the install-cxx-test-suite-prefix target in libc++. We
-    # ensure this is run by depending on the runtimes-test-depends target.
-    # While this could build too many dependencies, it is currently the only
-    # test dependencies target exposed by the runtimes build.
-    add_lldb_test_dependency(runtimes-test-depends)
-    set(LIBCXX_TEST_INSTALL_DIR "${CMAKE_BINARY_DIR}/runtimes/runtimes-${LLVM_DEFAULT_TARGET_TRIPLE}-bins/libcxx/test-suite-install")
     if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-      set(LIBCXX_LIBRARY_DIR ${LIBCXX_TEST_INSTALL_DIR}/lib/${LLVM_DEFAULT_TARGET_TRIPLE})
-      set(LIBCXX_GENERATED_INCLUDE_DIR "${LIBCXX_TEST_INSTALL_DIR}/include/c++/v1")
-      set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_TEST_INSTALL_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
+      set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
+      set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
+      set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
     else()
-      set(LIBCXX_LIBRARY_DIR ${LIBCXX_TEST_INSTALL_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
-      set(LIBCXX_GENERATED_INCLUDE_DIR "${LIBCXX_TEST_INSTALL_DIR}/include/c++/v1")
+      set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+      set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
     endif()
   endif()
 

diff  --git a/lldb/utils/lldb-dotest/CMakeLists.txt b/lldb/utils/lldb-dotest/CMakeLists.txt
index 414caf43df0e6c..3b8c88b6dc78cb 100644
--- a/lldb/utils/lldb-dotest/CMakeLists.txt
+++ b/lldb/utils/lldb-dotest/CMakeLists.txt
@@ -14,19 +14,13 @@ llvm_canonicalize_cmake_booleans(
 
 if ("libcxx" IN_LIST LLVM_ENABLE_RUNTIMES)
   set(LLDB_HAS_LIBCXX ON)
-  # libc++ can only be used for tests after installing to a fake prefix
-  # which is done by the install-cxx-test-suite-prefix target in libc++. We
-  # ensure this is run by depending on the runtimes-test-depends target.
-  # While this could build too many dependencies, it is currently the only
-  # test dependencies target exposed by the runtimes build.
-  set(LIBCXX_TEST_INSTALL_DIR "${CMAKE_BINARY_DIR}/runtimes/runtimes-${LLVM_DEFAULT_TARGET_TRIPLE}-bins/libcxx/test-suite-install")
   if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-    set(LIBCXX_LIBRARY_DIR ${LIBCXX_TEST_INSTALL_DIR}/lib/${LLVM_DEFAULT_TARGET_TRIPLE})
-    set(LIBCXX_GENERATED_INCLUDE_DIR "${LIBCXX_TEST_INSTALL_DIR}/include/c++/v1")
-    set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_TEST_INSTALL_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
+    set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
+    set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
+    set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
   else()
-    set(LIBCXX_LIBRARY_DIR ${LIBCXX_TEST_INSTALL_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
-    set(LIBCXX_GENERATED_INCLUDE_DIR "${LIBCXX_TEST_INSTALL_DIR}/include/c++/v1")
+    set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+    set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
   endif()
 endif()
 


        


More information about the lldb-commits mailing list