[libcxx-commits] [libcxx] b888463 - [libc++abi] Make sure we can run the tests in Standalone mode

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 26 11:26:54 PDT 2020


Author: Louis Dionne
Date: 2020-10-26T14:26:44-04:00
New Revision: b888463f8d6b1a0b003fa329c28e7348356787b5

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

LOG: [libc++abi] Make sure we can run the tests in Standalone mode

The tests would previously fail if the `python` executable wasn't found,
because we were missing the mandatory find_package.

Added: 
    

Modified: 
    libcxx/utils/ci/run-buildbot.sh
    libcxxabi/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/ci/run-buildbot.sh b/libcxx/utils/ci/run-buildbot.sh
index cee4f39cfc17..31035a4dd4fa 100755
--- a/libcxx/utils/ci/run-buildbot.sh
+++ b/libcxx/utils/ci/run-buildbot.sh
@@ -201,7 +201,8 @@ legacy-standalone)
           -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
           -DLLVM_PATH="${MONOREPO_ROOT}/llvm" \
           -DLIBCXXABI_LIBCXX_PATH="${MONOREPO_ROOT}/libcxx" \
-          -DLIBCXXABI_LIBCXX_INCLUDES="${MONOREPO_ROOT}/libcxx/include"
+          -DLIBCXXABI_LIBCXX_INCLUDES="${MONOREPO_ROOT}/libcxx/include" \
+          -DLIBCXXABI_LIBCXX_LIBRARY_PATH="${BUILD_DIR}/libcxx/lib"
 
     echo "+++ Building libc++abi"
     ninja -C "${BUILD_DIR}/libcxxabi" cxxabi

diff  --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index 3f37dbf4cd36..d9ed55aadc77 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -48,6 +48,23 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXXABI_STANDALONE_B
   include(HandleOutOfTreeLLVM)
 endif()
 
+if (LIBCXXABI_STANDALONE_BUILD)
+  find_package(Python3 COMPONENTS Interpreter)
+  if(NOT Python3_Interpreter_FOUND)
+    message(WARNING "Python3 not found, using python2 as a fallback")
+    find_package(Python2 COMPONENTS Interpreter REQUIRED)
+    if(Python2_VERSION VERSION_LESS 2.7)
+      message(SEND_ERROR "Python 2.7 or newer is required")
+    endif()
+
+    # Treat python2 as python3
+    add_executable(Python3::Interpreter IMPORTED)
+    set_target_properties(Python3::Interpreter PROPERTIES
+      IMPORTED_LOCATION ${Python2_EXECUTABLE})
+    set(Python3_EXECUTABLE ${Python2_EXECUTABLE})
+  endif()
+endif()
+
 # Require out of source build.
 include(MacroEnsureOutOfSourceBuild)
 MACRO_ENSURE_OUT_OF_SOURCE_BUILD(


        


More information about the libcxx-commits mailing list