139 lines · plain
1if (COMPILER_RT_BUILD_SANITIZERS)2 set(SANITIZER_HEADERS3 sanitizer/allocator_interface.h4 sanitizer/asan_interface.h5 sanitizer/common_interface_defs.h6 sanitizer/coverage_interface.h7 sanitizer/dfsan_interface.h8 sanitizer/hwasan_interface.h9 sanitizer/linux_syscall_hooks.h10 sanitizer/lsan_interface.h11 sanitizer/msan_interface.h12 sanitizer/netbsd_syscall_hooks.h13 sanitizer/rtsan_interface.h14 sanitizer/scudo_interface.h15 sanitizer/tsan_interface.h16 sanitizer/tsan_interface_atomic.h17 sanitizer/ubsan_interface.h18 )19 set(FUZZER_HEADERS20 fuzzer/FuzzedDataProvider.h21 )22endif(COMPILER_RT_BUILD_SANITIZERS)23 24if (COMPILER_RT_BUILD_MEMPROF)25 set(MEMPROF_HEADERS26 sanitizer/memprof_interface.h27 profile/MemProfData.inc28 )29 if (NOT COMPILER_RT_BUILD_SANITIZERS)30 set(MEMPROF_HEADERS31 ${MEMPROF_HEADERS}32 sanitizer/allocator_interface.h33 sanitizer/common_interface_defs.h34 )35 endif()36endif(COMPILER_RT_BUILD_MEMPROF)37 38if (COMPILER_RT_BUILD_XRAY)39 set(XRAY_HEADERS40 xray/xray_interface.h41 xray/xray_log_interface.h42 xray/xray_records.h43 )44endif(COMPILER_RT_BUILD_XRAY)45 46if (COMPILER_RT_BUILD_ORC)47 set(ORC_HEADERS48 orc_rt/c_api.h49 )50endif(COMPILER_RT_BUILD_ORC)51 52if (COMPILER_RT_BUILD_PROFILE)53 set(PROFILE_HEADERS54 profile/InstrProfData.inc55 profile/instr_prof_interface.h56 )57endif(COMPILER_RT_BUILD_PROFILE)58 59set(COMPILER_RT_HEADERS60 ${SANITIZER_HEADERS}61 ${FUZZER_HEADERS}62 ${MEMPROF_HEADERS}63 ${XRAY_HEADERS}64 ${ORC_HEADERS}65 ${PROFILE_HEADERS})66 67set(output_dir ${COMPILER_RT_OUTPUT_DIR}/include)68 69# Copy compiler-rt headers to the build tree.70set(out_files)71foreach( f ${COMPILER_RT_HEADERS} )72 set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} )73 set( dst ${output_dir}/${f} )74 add_custom_command(OUTPUT ${dst}75 DEPENDS ${src}76 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}77 COMMENT "Copying compiler-rt's ${f}...")78 list(APPEND out_files ${dst})79endforeach( f )80 81add_custom_target(compiler-rt-headers ALL DEPENDS ${out_files})82add_dependencies(compiler-rt compiler-rt-headers)83set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT/Resources")84 85# Install sanitizer headers.86install(FILES ${SANITIZER_HEADERS}87 COMPONENT compiler-rt-headers88 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ89 DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/sanitizer)90# Install fuzzer headers.91install(FILES ${FUZZER_HEADERS}92 COMPONENT compiler-rt-headers93 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ94 DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/fuzzer)95# Install memprof headers.96if (COMPILER_RT_BUILD_MEMPROF)97 install(FILES sanitizer/memprof_interface.h98 COMPONENT compiler-rt-headers99 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ100 DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/sanitizer)101 if (NOT COMPILER_RT_BUILD_SANITIZERS)102 install(FILES sanitizer/allocator_interface.h sanitizer/common_interface_defs.h103 COMPONENT compiler-rt-headers104 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ105 DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/sanitizer)106 endif()107endif(COMPILER_RT_BUILD_MEMPROF)108# Install xray headers.109install(FILES ${XRAY_HEADERS}110 COMPONENT compiler-rt-headers111 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ112 DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/xray)113# Install ORC headers.114install(FILES ${ORC_HEADERS}115 COMPONENT compiler-rt-headers116 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ117 DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/orc)118# Install profile headers.119install(FILES ${PROFILE_HEADERS}120 COMPONENT compiler-rt-headers121 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ122 DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/profile)123 124if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.125 add_custom_target(install-compiler-rt-headers126 DEPENDS compiler-rt-headers127 COMMAND "${CMAKE_COMMAND}"128 -DCMAKE_INSTALL_COMPONENT="compiler-rt-headers"129 -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"130 USES_TERMINAL)131 add_custom_target(install-compiler-rt-headers-stripped132 DEPENDS compiler-rt-headers133 COMMAND "${CMAKE_COMMAND}"134 -DCMAKE_INSTALL_COMPONENT="compiler-rt-headers"135 -DCMAKE_INSTALL_DO_STRIP=1136 -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"137 USES_TERMINAL)138endif()139