Index: cmake/modules/LLVMExternalProjectUtils.cmake =================================================================== --- cmake/modules/LLVMExternalProjectUtils.cmake +++ cmake/modules/LLVMExternalProjectUtils.cmake @@ -182,7 +182,7 @@ endif() if(NOT ARG_NO_INSTALL) - install(CODE "execute_process\(COMMAND \${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX} -P ${BINARY_DIR}/cmake_install.cmake \)" + install(CODE "execute_process\(COMMAND \${CMAKE_COMMAND} -P ${BINARY_DIR}/cmake_install.cmake \)" COMPONENT ${name}) add_custom_target(install-${name} Index: runtimes/CMakeLists.txt =================================================================== --- runtimes/CMakeLists.txt +++ runtimes/CMakeLists.txt @@ -61,9 +61,9 @@ # This variable makes sure that e.g. llvm-lit is found. set(LLVM_MAIN_SRC_DIR ${LLVM_BUILD_MAIN_SRC_DIR}) - if(APPLE) - set(LLVM_ENABLE_LIBCXX ON CACHE BOOL "") - endif() + #if(APPLE) + set(LLVM_ENABLE_LIBCXX ON CACHE BOOL "") + #endif() set(SAFE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) set(SAFE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) @@ -245,39 +245,99 @@ endforeach() if(runtimes) + # Create a runtimes target that uses this file as its top-level CMake file. + # The runtimes target is a configuration of all the runtime libraries + # together in a single CMake invocaiton. + if(NOT LLVM_RUNTIME_TARGETS) + foreach(runtime_name ${runtime_names}) + list(APPEND extra_targets + ${runtime_name} + install-${runtime_name} + check-${runtime_name}) + endforeach() - foreach(runtime_name ${runtime_names}) - list(APPEND extra_targets - ${runtime_name} - install-${runtime_name} - check-${runtime_name}) - endforeach() + if(LLVM_INCLUDE_TESTS) + set(test_targets runtimes-test-depends check-runtimes) + foreach(component ${SUB_COMPONENTS}) + list(APPEND SUB_COMPONENT_CHECK_TARGETS check-${component}) + endforeach() + endif() - if(LLVM_INCLUDE_TESTS) - set(test_targets runtimes-test-depends check-runtimes) - foreach(component ${SUB_COMPONENTS}) - list(APPEND SUB_COMPONENT_CHECK_TARGETS check-${component}) + llvm_ExternalProject_Add(runtimes + ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${deps} + # Builtins were built separately above + CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off + -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS} + PASSTHROUGH_PREFIXES ${prefixes} + EXTRA_TARGETS ${extra_targets} + ${test_targets} + ${SUB_COMPONENTS} + ${SUB_COMPONENT_CHECK_TARGETS} + ${SUB_INSTALL_TARGETS} + USE_TOOLCHAIN + ${EXTRA_ARGS}) + else() + get_cmake_property(variableNames VARIABLES) + add_custom_target(runtimes) + add_custom_target(install-runtimes) + if(LLVM_INCLUDE_TESTS) + add_custom_target(check-runtimes) + add_custom_target(runtimes-test-depends) + endif() + foreach(target ${LLVM_RUNTIME_TARGETS}) + foreach(runtime_name ${runtime_names}) + list(APPEND ${target}_extra_targets + ${runtime_name}-${target} + install-${runtime_name}-${target} + check-${runtime_name}-${target}) + endforeach() + + if(LLVM_INCLUDE_TESTS) + set(${target}_test_targets runtimes-test-depends-${target} check-runtimes-${target}) + foreach(component ${SUB_COMPONENTS}) + list(APPEND SUB_COMPONENT_CHECK_TARGETS check-${component}-${target}) + endforeach() + endif() + + foreach(variableName ${variableNames}) + if(variableName MATCHES "^RUNTIMES_${target}") + string(REPLACE "RUNTIMES_${target}_" "" new_name ${variableName}) + list(APPEND ${target}_extra_args "-D${new_name}=${${variableName}}") + endif() + endforeach() + + llvm_ExternalProject_Add(runtimes-${target} + ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${deps} + # Builtins were built separately above + CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off + -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS} + -DCMAKE_C_COMPILER_TARGET=${target} + -DCMAKE_CXX_COMPILER_TARGET=${target} + -DCMAKE_ASM_COMPILER_TARGET=${target} + -DCMAKE_C_COMPILER_WORKS=ON + -DCMAKE_CXX_COMPILER_WORKS=ON + -DCMAKE_ASM_COMPILER_WORKS=ON + ${${target}_extra_args} + PASSTHROUGH_PREFIXES ${prefixes} + EXTRA_TARGETS ${${target}_extra_targets} + ${${target}_test_targets} + ${SUB_COMPONENTS} + ${SUB_COMPONENT_CHECK_TARGETS} + ${SUB_INSTALL_TARGETS} + USE_TOOLCHAIN + ${EXTRA_ARGS}) + + add_dependencies(runtimes runtimes-${target}) + add_dependencies(install-runtimes install-runtimes-${target}) + if(LLVM_INCLUDE_TESTS) + add_dependencies(check-runtimes check-runtimes-${target}) + add_dependencies(runtimes-test-depends runtimes-test-depends-${target}) + endif() endforeach() endif() - # Create a runtimes target that uses this file as its top-level CMake file. - # The runtimes target is a configuration of all the runtime libraries - # together in a single CMake invocaiton. - llvm_ExternalProject_Add(runtimes - ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${deps} - # Builtins were built separately above - CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off - -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS} - PASSTHROUGH_PREFIXES ${prefixes} - EXTRA_TARGETS ${extra_targets} - ${test_targets} - ${SUB_COMPONENTS} - ${SUB_COMPONENT_CHECK_TARGETS} - ${SUB_INSTALL_TARGETS} - USE_TOOLCHAIN - ${EXTRA_ARGS}) - # TODO: This is a hack needed because the libcxx headers are copied into the # build directory during configuration. Without that step the clang in the # build directory cannot find the C++ headers in certain configurations.