150
|
1 if (COMPILER_RT_BUILD_SANITIZERS)
|
|
2 set(SANITIZER_HEADERS
|
|
3 sanitizer/allocator_interface.h
|
|
4 sanitizer/asan_interface.h
|
|
5 sanitizer/common_interface_defs.h
|
|
6 sanitizer/coverage_interface.h
|
|
7 sanitizer/dfsan_interface.h
|
|
8 sanitizer/hwasan_interface.h
|
|
9 sanitizer/linux_syscall_hooks.h
|
|
10 sanitizer/lsan_interface.h
|
|
11 sanitizer/msan_interface.h
|
|
12 sanitizer/netbsd_syscall_hooks.h
|
|
13 sanitizer/scudo_interface.h
|
|
14 sanitizer/tsan_interface.h
|
|
15 sanitizer/tsan_interface_atomic.h
|
|
16 sanitizer/ubsan_interface.h
|
|
17 )
|
|
18 set(FUZZER_HEADERS
|
|
19 fuzzer/FuzzedDataProvider.h
|
|
20 )
|
|
21 endif(COMPILER_RT_BUILD_SANITIZERS)
|
|
22
|
|
23 if (COMPILER_RT_BUILD_XRAY)
|
|
24 set(XRAY_HEADERS
|
|
25 xray/xray_interface.h
|
|
26 xray/xray_log_interface.h
|
|
27 xray/xray_records.h
|
|
28 )
|
|
29 endif(COMPILER_RT_BUILD_XRAY)
|
|
30
|
|
31 if (COMPILER_RT_BUILD_PROFILE)
|
|
32 set(PROFILE_HEADERS
|
|
33 profile/InstrProfData.inc
|
|
34 )
|
|
35 endif(COMPILER_RT_BUILD_PROFILE)
|
|
36
|
|
37 set(COMPILER_RT_HEADERS
|
|
38 ${SANITIZER_HEADERS}
|
|
39 ${FUZZER_HEADERS}
|
|
40 ${XRAY_HEADERS}
|
|
41 ${PROFILE_HEADERS})
|
|
42
|
|
43 set(output_dir ${COMPILER_RT_OUTPUT_DIR}/include)
|
|
44
|
|
45 # Copy compiler-rt headers to the build tree.
|
|
46 set(out_files)
|
|
47 foreach( f ${COMPILER_RT_HEADERS} )
|
|
48 set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} )
|
|
49 set( dst ${output_dir}/${f} )
|
|
50 add_custom_command(OUTPUT ${dst}
|
|
51 DEPENDS ${src}
|
|
52 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
|
|
53 COMMENT "Copying compiler-rt's ${f}...")
|
|
54 list(APPEND out_files ${dst})
|
|
55 endforeach( f )
|
|
56
|
|
57 add_custom_target(compiler-rt-headers ALL DEPENDS ${out_files})
|
|
58 add_dependencies(compiler-rt compiler-rt-headers)
|
|
59 set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
|
|
60
|
|
61 # Install sanitizer headers.
|
|
62 install(FILES ${SANITIZER_HEADERS}
|
|
63 COMPONENT compiler-rt-headers
|
|
64 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
|
65 DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer)
|
|
66 # Install fuzzer headers.
|
|
67 install(FILES ${FUZZER_HEADERS}
|
|
68 COMPONENT compiler-rt-headers
|
|
69 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
|
70 DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer)
|
|
71 # Install xray headers.
|
|
72 install(FILES ${XRAY_HEADERS}
|
|
73 COMPONENT compiler-rt-headers
|
|
74 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
|
75 DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray)
|
|
76 # Install profile headers.
|
|
77 install(FILES ${PROFILE_HEADERS}
|
|
78 COMPONENT compiler-rt-headers
|
|
79 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
|
80 DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/profile)
|
|
81
|
|
82 if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.
|
|
83 add_custom_target(install-compiler-rt-headers
|
|
84 DEPENDS compiler-rt-headers
|
|
85 COMMAND "${CMAKE_COMMAND}"
|
|
86 -DCMAKE_INSTALL_COMPONENT="compiler-rt-headers"
|
|
87 -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
|
88 USES_TERMINAL)
|
|
89 add_custom_target(install-compiler-rt-headers-stripped
|
|
90 DEPENDS compiler-rt-headers
|
|
91 COMMAND "${CMAKE_COMMAND}"
|
|
92 -DCMAKE_INSTALL_COMPONENT="compiler-rt-headers"
|
|
93 -DCMAKE_INSTALL_DO_STRIP=1
|
|
94 -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
|
95 USES_TERMINAL)
|
|
96 endif()
|