Ericson2314 created this revision. Herald added a subscriber: mgorny. Ericson2314 requested review of this revision. Herald added projects: clang, Sanitizers. Herald added subscribers: Sanitizers, cfe-commits.
It turns out we don't neeed to remove `clang/runtime` to make this work, as @phosek thought might be acceptable is in fact not. To do this, we just set `CMAKE_INSTALL_PREFIX` rather than `COMPILER_RT_INSTALL_PATH` in `clang/runtime` in the child CMake invocation. Since it's a separate CMake invocation, we don't have to worry about mutation "bleeding over" and effecting other projects. However I am still worrie about redefining of `CMAKE_INSTALL_PREIX` in `compiler-rt/cmake/base-config-ix.cmake`. This occurs under `LLVM_TREE_AVAILABLE`. If this is just for separate compiler-rt builds (separate invocation of CMake, that is), this is fine. But if on the other hand this is for combination builds in a single CMake run, then this sort of redefinition is no good as it will effect more than compiler-rt. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D99860 Files: clang/runtime/CMakeLists.txt compiler-rt/cmake/Modules/AddCompilerRT.cmake compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake compiler-rt/cmake/Modules/CompilerRTUtils.cmake compiler-rt/cmake/base-config-ix.cmake compiler-rt/include/CMakeLists.txt compiler-rt/lib/dfsan/CMakeLists.txt
Index: compiler-rt/lib/dfsan/CMakeLists.txt =================================================================== --- compiler-rt/lib/dfsan/CMakeLists.txt +++ compiler-rt/lib/dfsan/CMakeLists.txt @@ -62,4 +62,4 @@ DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt) add_dependencies(dfsan dfsan_abilist) install(FILES ${dfsan_abilist_filename} - DESTINATION ${COMPILER_RT_INSTALL_PATH}/share) + DESTINATION share) Index: compiler-rt/include/CMakeLists.txt =================================================================== --- compiler-rt/include/CMakeLists.txt +++ compiler-rt/include/CMakeLists.txt @@ -69,22 +69,22 @@ install(FILES ${SANITIZER_HEADERS} COMPONENT compiler-rt-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer) + DESTINATION include/sanitizer) # Install fuzzer headers. install(FILES ${FUZZER_HEADERS} COMPONENT compiler-rt-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer) + DESTINATION include/fuzzer) # Install xray headers. install(FILES ${XRAY_HEADERS} COMPONENT compiler-rt-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray) + DESTINATION include/xray) # Install profile headers. install(FILES ${PROFILE_HEADERS} COMPONENT compiler-rt-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/profile) + DESTINATION include/profile) if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs. add_custom_target(install-compiler-rt-headers Index: compiler-rt/cmake/base-config-ix.cmake =================================================================== --- compiler-rt/cmake/base-config-ix.cmake +++ compiler-rt/cmake/base-config-ix.cmake @@ -42,7 +42,7 @@ # Setup the paths where compiler-rt runtimes and headers should be stored. set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}) set(COMPILER_RT_EXEC_OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) - set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}) + set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}) option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." ${LLVM_INCLUDE_TESTS}) option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" @@ -68,8 +68,6 @@ "Path where built compiler-rt libraries should be stored.") set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH "Path where built compiler-rt executables should be stored.") - set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH - "Path where built compiler-rt libraries should be installed.") option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF) option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF) # Use a host compiler to compile/link tests. @@ -92,12 +90,12 @@ set(COMPILER_RT_LIBRARY_OUTPUT_DIR ${COMPILER_RT_OUTPUT_DIR}) set(COMPILER_RT_LIBRARY_INSTALL_DIR - ${COMPILER_RT_INSTALL_PATH}) + "") else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR) set(COMPILER_RT_LIBRARY_OUTPUT_DIR ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR}) set(COMPILER_RT_LIBRARY_INSTALL_DIR - ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR}) + lib/${COMPILER_RT_OS_DIR}) endif() if(APPLE) Index: compiler-rt/cmake/Modules/CompilerRTUtils.cmake =================================================================== --- compiler-rt/cmake/Modules/CompilerRTUtils.cmake +++ compiler-rt/cmake/Modules/CompilerRTUtils.cmake @@ -386,7 +386,7 @@ function(get_compiler_rt_install_dir arch install_dir) if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) get_compiler_rt_target(${arch} target) - set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE) + set(${install_dir} lib/${target} PARENT_SCOPE) else() set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE) endif() Index: compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake =================================================================== --- compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake +++ compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake @@ -508,7 +508,7 @@ set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded) set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR - ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded) + lib/macho_embedded) set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi") set(CFLAGS_i386 "-march=pentium") Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake =================================================================== --- compiler-rt/cmake/Modules/AddCompilerRT.cmake +++ compiler-rt/cmake/Modules/AddCompilerRT.cmake @@ -510,7 +510,7 @@ add_custom_target(${target_name} DEPENDS ${dst_file}) # Install in Clang resource directory. install(FILES ${file_name} - DESTINATION ${COMPILER_RT_INSTALL_PATH}/share + DESTINATION share COMPONENT ${component}) add_dependencies(${component} ${target_name}) @@ -527,7 +527,7 @@ add_custom_target(${name} DEPENDS ${dst}) install(FILES ${dst} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin) + DESTINATION bin) endmacro(add_compiler_rt_script src name) # Builds custom version of libc++ and installs it in <prefix>. Index: clang/runtime/CMakeLists.txt =================================================================== --- clang/runtime/CMakeLists.txt +++ clang/runtime/CMakeLists.txt @@ -82,9 +82,8 @@ -DLLVM_LIT_ARGS=${LLVM_LIT_ARGS} -DCOMPILER_RT_OUTPUT_DIR=${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION} -DCOMPILER_RT_EXEC_OUTPUT_DIR=${LLVM_RUNTIME_OUTPUT_INTDIR} - -DCOMPILER_RT_INSTALL_PATH:STRING=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION} + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION} -DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS} - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_RUNTIME_OUTPUT_INTDIR} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits