diff options
-rw-r--r-- | CMakeLists.txt | 11 | ||||
-rw-r--r-- | cmake/Modules/AddCompilerRT.cmake | 4 | ||||
-rw-r--r-- | include/CMakeLists.txt | 17 | ||||
-rw-r--r-- | lib/dfsan/CMakeLists.txt | 11 |
4 files changed, 16 insertions, 27 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e8cc1a224..d9588253f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,12 +27,13 @@ add_custom_target(compiler-rt) string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION}) # Setup the paths where compiler-rt runtimes and headers should be stored. -set(LIBCLANG_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}) -string(TOLOWER ${CMAKE_SYSTEM_NAME} LIBCLANG_OS_DIR) -set(CLANG_RESOURCE_DIR ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}) -set(COMPILER_RT_LIBRARY_OUTPUT_DIR ${CLANG_RESOURCE_DIR}/lib/${LIBCLANG_OS_DIR}) +set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}) +string(TOLOWER ${CMAKE_SYSTEM_NAME} COMPILER_RT_OS_DIR) +set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}) +set(COMPILER_RT_LIBRARY_OUTPUT_DIR + ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR}) set(COMPILER_RT_LIBRARY_INSTALL_DIR - ${LIBCLANG_INSTALL_PATH}/lib/${LIBCLANG_OS_DIR}) + ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR}) # Add path for custom modules set(CMAKE_MODULE_PATH diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake index beb6e40af..bb350e972 100644 --- a/cmake/Modules/AddCompilerRT.cmake +++ b/cmake/Modules/AddCompilerRT.cmake @@ -133,10 +133,10 @@ endmacro() macro(add_compiler_rt_resource_file target_name file_name) set(src_file "${CMAKE_CURRENT_SOURCE_DIR}/${file_name}") - set(dst_file "${CLANG_RESOURCE_DIR}/${file_name}") + set(dst_file "${COMPILER_RT_OUTPUT_DIR}/${file_name}") add_custom_target(${target_name} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src_file} ${dst_file} DEPENDS ${file_name}) # Install in Clang resource directory. - install(FILES ${file_name} DESTINATION ${LIBCLANG_INSTALL_PATH}) + install(FILES ${file_name} DESTINATION ${COMPILER_RT_INSTALL_PATH}) endmacro() diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 5cb0f2f98..b5d98a805 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -7,11 +7,7 @@ set(SANITIZER_HEADERS sanitizer/msan_interface.h sanitizer/tsan_interface_atomic.h) -set(output_dir ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include) - -if(MSVC_IDE OR XCODE) - set(other_output_dir ${LLVM_BINARY_DIR}/bin/lib/clang/${CLANG_VERSION}/include) -endif() +set(output_dir ${COMPILER_RT_OUTPUT_DIR}/include) # Copy compiler-rt headers to the build tree. set(out_files) @@ -23,15 +19,6 @@ foreach( f ${SANITIZER_HEADERS} ) COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} COMMENT "Copying compiler-rt's ${f}...") list(APPEND out_files ${dst}) - - if(other_output_dir) - set(other_dst ${other_output_dir}/${f}) - add_custom_command(OUTPUT ${other_dst} - DEPENDS ${src} - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${other_dst} - COMMENT "Copying compiler-rt's ${f}...") - list(APPEND out_files ${other_dst}) - endif() endforeach( f ) add_custom_target(compiler-rt-headers ALL DEPENDS ${out_files}) @@ -40,4 +27,4 @@ add_dependencies(compiler-rt compiler-rt-headers) # Install sanitizer headers. install(FILES ${SANITIZER_HEADERS} PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - DESTINATION ${LIBCLANG_INSTALL_PATH}/include/sanitizer) + DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer) diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt index a5b2b2173..77cadadb2 100644 --- a/lib/dfsan/CMakeLists.txt +++ b/lib/dfsan/CMakeLists.txt @@ -32,17 +32,18 @@ if(CAN_TARGET_${arch}) clang_rt.dfsan-${arch}-symbols) endif() +set(dfsan_abilist_filename ${COMPILER_RT_OUTPUT_DIR}/dfsan_abilist.txt) add_custom_target(dfsan_abilist ALL - SOURCES ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt) -add_custom_command(OUTPUT ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt + SOURCES ${dfsan_abilist_filename}) +add_custom_command(OUTPUT ${dfsan_abilist_filename} VERBATIM COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/done_abilist.txt ${CMAKE_CURRENT_SOURCE_DIR}/libc_ubuntu1204_abilist.txt - > ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt + > ${dfsan_abilist_filename} DEPENDS done_abilist.txt libc_ubuntu1204_abilist.txt) add_dependencies(dfsan dfsan_abilist) -install(FILES ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt - DESTINATION ${LIBCLANG_INSTALL_PATH}) +install(FILES ${dfsan_abilist_filename} + DESTINATION ${COMPILER_RT_INSTALL_PATH}) add_dependencies(compiler-rt dfsan) |