[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.
This commit is contained in:
Louis Dionne 2020-10-26 14:25:49 -04:00
parent 0387015d75
commit b888463f8d
2 changed files with 19 additions and 1 deletions

View File

@ -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

View File

@ -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(