[libcxx-commits] [PATCH] D132526: [libcxxabi] Unbreak `LLVM_ENABLE_RUNTIMES=libcxxabi` build v2

John Ericson via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 24 07:11:25 PDT 2022


Ericson2314 updated this revision to Diff 455195.
Ericson2314 added a comment.

Fix bugs


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132526

Files:
  libcxxabi/CMakeLists.txt
  libcxxabi/cmake/Modules/HandleLibCXX.cmake


Index: libcxxabi/cmake/Modules/HandleLibCXX.cmake
===================================================================
--- /dev/null
+++ libcxxabi/cmake/Modules/HandleLibCXX.cmake
@@ -0,0 +1,31 @@
+set(LIBCXXABI_LIBCXX_PATH "${LIBCXXABI_SOURCE_DIR}/../libcxx" CACHE PATH
+    "Specify path to libc++ source.")
+
+option(LIBCXXABI_USE_PREBUILT_LIBCXX_HEADERS
+    "Use prebuilt libc++ headers because we are not also building libcc++."
+    OFF)
+
+# TODO: Move this under the conditional. All usages should use `cxx-headers`
+# instead of this, so this is us used to make the "fake" cxx-headers below and
+# nothing else.
+set(LIBCXXABI_LIBCXX_INCLUDES "" CACHE PATH
+    "Specify path to libc++ includes.")
+if (LIBCXXABI_USE_PREBUILT_LIBCXX_HEADERS)
+  if (NOT IS_DIRECTORY ${LIBCXXABI_LIBCXX_INCLUDES})
+    message(FATAL_ERROR
+      "LIBCXXABI_LIBCXX_INCLUDES=${LIBCXXABI_LIBCXX_INCLUDES} is not a valid directory. "
+      "Since we are not also building libc++, "
+      "please provide the path to where the libc++ headers have been installed.")
+
+  endif()
+  add_library(cxx-headers INTERFACE)
+  target_include_directories(cxx-headers INTERFACE "${LIBCXXABI_LIBCXX_INCLUDES}")
+endif()
+
+if (LIBCXXABI_INCLUDE_TESTS)
+  # The libraries are just needed for the "lit tests"
+
+  # By default, libcxx and libcxxabi share a library directory.
+  set(LIBCXXABI_LIBCXX_LIBRARY_PATH "${LIBCXXABI_LIBRARY_DIR}" CACHE PATH
+      "The path to libc++ library.")
+endif()
Index: libcxxabi/CMakeLists.txt
===================================================================
--- libcxxabi/CMakeLists.txt
+++ libcxxabi/CMakeLists.txt
@@ -20,8 +20,6 @@
 
 set(LIBCXXABI_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBCXXABI_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
-set(LIBCXXABI_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH
-        "Specify path to libc++ source.")
 
 include(GNUInstallDirs)
 
@@ -92,7 +90,6 @@
   message(WARNING "LIBCXXABI_SYSROOT, LIBCXXABI_TARGET_TRIPLE and LIBCXXABI_GCC_TOOLCHAIN are not supported anymore, please use the native CMake equivalents instead")
 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 \
 library produced. For example, -DLIBCXXABI_LIBRARY_VERSION=x.y will \
@@ -131,10 +128,7 @@
   message(FATAL_ERROR "libc++abi must be built as either a shared or static library.")
 endif()
 
-# TODO: Remove this, which shouldn't be necessary since we know we're being built
-#       side-by-side with libc++.
-set(LIBCXXABI_LIBCXX_INCLUDES "" CACHE PATH
-    "Specify path to libc++ includes.")
+include(HandleLibCXX)
 
 set(LIBCXXABI_HERMETIC_STATIC_LIBRARY_DEFAULT OFF)
 if (WIN32)
@@ -174,13 +168,6 @@
 # Configure System
 #===============================================================================
 
-# Add path for custom modules
-set(CMAKE_MODULE_PATH
-  "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
-  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
-  ${CMAKE_MODULE_PATH}
-  )
-
 set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
     "Path where built libc++abi runtime libraries should be installed.")
 
@@ -209,12 +196,6 @@
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})
 
-# By default, libcxx and libcxxabi share a library directory.
-if (NOT LIBCXXABI_LIBCXX_LIBRARY_PATH)
-  set(LIBCXXABI_LIBCXX_LIBRARY_PATH "${LIBCXXABI_LIBRARY_DIR}" CACHE PATH
-      "The path to libc++ library." FORCE)
-endif()
-
 # Declare libc++abi configuration variables.
 # They are intended for use as follows:
 # LIBCXXABI_C_FLAGS: General flags for both the c++ compiler and linker.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132526.455195.patch
Type: text/x-patch
Size: 3782 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220824/9e0dc6ce/attachment.bin>


More information about the libcxx-commits mailing list