diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake --- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake +++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake @@ -565,13 +565,9 @@ -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}) endif() - set(STAMP_DIR ${prefix}-stamps/) - set(BINARY_DIR ${prefix}-bins/) - add_custom_target(${name}-clear - COMMAND ${CMAKE_COMMAND} -E remove_directory ${BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E remove_directory ${STAMP_DIR} - COMMENT "Clobbering ${name} build and stamp directories" + COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix} + COMMENT "Clobbering ${name} build directories" USES_TERMINAL ) set_target_properties(${name}-clear PROPERTIES FOLDER "Compiler-RT Misc") @@ -579,10 +575,9 @@ add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}-clobber-stamp DEPENDS ${LIBCXX_DEPS} ${toolchain_deps} - COMMAND ${CMAKE_COMMAND} -E touch ${BINARY_DIR}/CMakeCache.txt - COMMAND ${CMAKE_COMMAND} -E touch ${STAMP_DIR}/${name}-mkdir + COMMAND ${CMAKE_COMMAND} -E touch ${prefix}/CMakeCache.txt COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${name}-clobber-stamp - COMMENT "Clobbering bootstrap build and stamp directories" + COMMENT "Clobbering bootstrap build directories" ) add_custom_target(${name}-clobber @@ -629,10 +624,9 @@ ExternalProject_Add(${name} DEPENDS ${name}-clobber ${LIBCXX_DEPS} - PREFIX ${prefix} - SOURCE_DIR ${COMPILER_RT_SOURCE_DIR}/cmake/Modules/CustomLibcxx - STAMP_DIR ${STAMP_DIR} - BINARY_DIR ${BINARY_DIR} + PREFIX ${CMAKE_CURRENT_BINARY_DIR}/${name} + SOURCE_DIR ${LLVM_MAIN_SRC_DIR}/../runtimes + BINARY_DIR ${prefix} CMAKE_ARGS ${CMAKE_PASSTHROUGH_VARIABLES} ${compiler_args} -DCMAKE_C_FLAGS=${LIBCXX_C_FLAGS} @@ -640,10 +634,19 @@ -DCMAKE_BUILD_TYPE=Release -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY -DLLVM_PATH=${LLVM_MAIN_SRC_DIR} - -DLLVM_BINARY_DIR=${prefix} - -DLLVM_LIBRARY_OUTPUT_INTDIR=${prefix}/lib - -DCOMPILER_RT_LIBCXX_PATH=${COMPILER_RT_LIBCXX_PATH} - -DCOMPILER_RT_LIBCXXABI_PATH=${COMPILER_RT_LIBCXXABI_PATH} + -DLLVM_ENABLE_RUNTIMES=libcxx|libcxxabi + -DLIBCXXABI_ENABLE_SHARED=OFF + -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF + -DLIBCXXABI_HERMETIC_STATIC_LIBRARY=ON + -DLIBCXXABI_INCLUDE_TESTS=OFF + -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF + -DLIBCXX_ENABLE_SHARED=OFF + -DLIBCXX_ENABLE_EXCEPTIONS=OFF + -DLIBCXX_HERMETIC_STATIC_LIBRARY=ON + -DLIBCXX_INCLUDE_TESTS=OFF + -DLIBCXX_CXX_ABI=libcxxabi + -DLIBCXX_CXX_ABI_INTREE=1 + -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON ${LIBCXX_CMAKE_ARGS} INSTALL_COMMAND "" STEP_TARGETS configure build @@ -651,14 +654,14 @@ USES_TERMINAL_CONFIGURE 1 USES_TERMINAL_BUILD 1 USES_TERMINAL_INSTALL 1 + LIST_SEPARATOR | EXCLUDE_FROM_ALL TRUE - BUILD_BYPRODUCTS "${prefix}/lib/libc++.a" "${prefix}/lib/libc++abi.a" ) if (CMAKE_GENERATOR MATCHES "Make") - set(run_clean "$(MAKE)" "-C" "${BINARY_DIR}" "clean") + set(run_clean "$(MAKE)" "-C" "${prefix}" "clean") else() - set(run_clean ${CMAKE_COMMAND} --build ${BINARY_DIR} --target clean + set(run_clean ${CMAKE_COMMAND} --build ${prefix} --target clean --config "$") endif() @@ -667,7 +670,7 @@ COMMENT "Cleaning ${name}..." DEPENDEES configure ${force_deps} - WORKING_DIRECTORY ${BINARY_DIR} + WORKING_DIRECTORY ${prefix} EXCLUDE_FROM_MAIN 1 USES_TERMINAL 1 ) diff --git a/compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt b/compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt deleted file mode 100644 --- a/compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -# TODO(phosek): We should use the runtimes build instead configured with -# LLVM_ENABLE_RUNTIMES=libcxxabi;libcxx to avoid duplication of logic. - -cmake_minimum_required(VERSION 3.13.4) -project(custom-libcxx C CXX) - -find_package(Python3 REQUIRED COMPONENTS Interpreter) - -# Build static libcxxabi. -set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "") -set(LIBCXXABI_ENABLE_EXCEPTIONS ON CACHE BOOL "") -set(LIBCXXABI_HERMETIC_STATIC_LIBRARY ON CACHE STRING "") -set(LIBCXXABI_LIBCXX_PATH ${COMPILER_RT_LIBCXX_PATH} CACHE PATH "") -set(LIBCXXABI_INCLUDE_TESTS OFF CACHE BOOL "") -add_subdirectory(${COMPILER_RT_LIBCXXABI_PATH} ${CMAKE_CURRENT_BINARY_DIR}/cxxabi) - -# Build static libcxx without exceptions. -set(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY OFF CACHE BOOL "") -set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "") -set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "") -set(LIBCXX_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "") - -# Use above libcxxabi. -set(LIBCXX_CXX_ABI "libcxxabi" CACHE STRING "") -set(LIBCXX_CXX_ABI_INTREE 1) -set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "") -set(LIBCXX_CXX_ABI_INCLUDE_PATHS ${COMPILER_RT_LIBCXXABI_PATH}/include CACHE PATH "") - -add_subdirectory(${COMPILER_RT_LIBCXX_PATH} ${CMAKE_CURRENT_BINARY_DIR}/cxx)