From e619e9d5f542e0764362c2b6762ecd31640651cd Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Thu, 11 Jun 2020 13:50:40 -0400 Subject: [PATCH] [libc++abi] Simplify the logic for finding libc++ from libc++abi Since we have the monorepo, libc++abi's build requires a sibling checkout of the libc++ sources. Hence, the logic for finding libc++ can be greatly simplified. --- libcxxabi/CMakeLists.txt | 50 +++++------------------------------------------- libcxxabi/www/index.html | 3 +-- 2 files changed, 6 insertions(+), 47 deletions(-) diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt index bb79987..d4ffcf8 100644 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -126,53 +126,13 @@ if (NOT LIBCXXABI_ENABLE_SHARED AND NOT LIBCXXABI_ENABLE_STATIC) message(FATAL_ERROR "libc++abi must be built as either a shared or static library.") endif() -if (LLVM_EXTERNAL_LIBCXX_SOURCE_DIR) - set(LIBCXXABI_LIBCXX_SRC_DIRS ${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR}) -else() - set(LIBCXXABI_LIBCXX_SRC_DIRS - "${LLVM_MAIN_SRC_DIR}/projects/libcxx" - "${LLVM_MAIN_SRC_DIR}/runtimes/libcxx" - "${LLVM_MAIN_SRC_DIR}/../libcxx" - ) -endif() - -set(LIBCXXABI_LIBCXX_INCLUDE_DIRS "") -foreach(dir ${LIBCXXABI_LIBCXX_SRC_DIRS}) - list(APPEND LIBCXXABI_LIBCXX_INCLUDE_DIRS "${dir}/include") -endforeach() - -find_path( - LIBCXXABI_LIBCXX_INCLUDES - __config - PATHS ${LIBCXXABI_LIBCXX_INCLUDES} - ${LIBCXXABI_LIBCXX_PATH}/include - ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBCXX_INCLUDES} - ${LIBCXXABI_LIBCXX_INCLUDE_DIRS} - ${LLVM_INCLUDE_DIR}/c++/v1 - NO_DEFAULT_PATH - NO_CMAKE_FIND_ROOT_PATH - ) +set(LIBCXXABI_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx") +set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_PATH}/include") -set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_INCLUDES}" CACHE PATH - "Specify path to libc++ includes." FORCE) - -find_path( - LIBCXXABI_LIBCXX_PATH - utils/libcxx/test/__init__.py - PATHS ${LIBCXXABI_LIBCXX_PATH} - ${LIBCXXABI_LIBCXX_INCLUDES}/../ - ${LIBCXXABI_LIBCXX_SRC_DIRS} - NO_DEFAULT_PATH - NO_CMAKE_FIND_ROOT_PATH - ) - -if (LIBCXXABI_LIBCXX_PATH STREQUAL "LIBCXXABI_LIBCXX_PATH-NOTFOUND") - message(WARNING "LIBCXXABI_LIBCXX_PATH was not specified and couldn't be infered.") - set(LIBCXXABI_LIBCXX_PATH "") -endif() - -set(LIBCXXABI_LIBCXX_PATH "${LIBCXXABI_LIBCXX_PATH}" CACHE PATH +set(LIBCXXABI_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH "Specify path to libc++ source." FORCE) +set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_PATH}/include" CACHE PATH + "Specify path to libc++ includes." FORCE) option(LIBCXXABI_HERMETIC_STATIC_LIBRARY "Do not export any symbols from the static library." OFF) diff --git a/libcxxabi/www/index.html b/libcxxabi/www/index.html index 3fdff0d..b8fd20f 100644 --- a/libcxxabi/www/index.html +++ b/libcxxabi/www/index.html @@ -94,8 +94,7 @@
  • cd llvm-project
  • mkdir build-libcxxabi && cd build-libcxxabi
  • -
  • cmake -DLIBCXXABI_LIBCXX_PATH=path/to/libcxx ../libcxxabi # on - linux you may need -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
  • +
  • cmake ../libcxxabi # on linux you may need -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
  • make
  • By default CMake uses llvm-config to locate the required -- 2.7.4