[AA] Rename CaptureInfo -> CaptureAnalysis (NFC) (#116842)
[llvm-project.git] / compiler-rt / include / CMakeLists.txt
blob242d62b9b447b1f76c2a3c5647e12928fc0bb9a4
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/rtsan_interface.h
14     sanitizer/scudo_interface.h
15     sanitizer/tsan_interface.h
16     sanitizer/tsan_interface_atomic.h
17     sanitizer/ubsan_interface.h
18     )
19   set(FUZZER_HEADERS
20     fuzzer/FuzzedDataProvider.h
21     )
22 endif(COMPILER_RT_BUILD_SANITIZERS)
24 if (COMPILER_RT_BUILD_MEMPROF)
25   set(MEMPROF_HEADERS
26     sanitizer/memprof_interface.h
27     profile/MemProfData.inc
28     )
29   if (NOT COMPILER_RT_BUILD_SANITIZERS)
30     set(MEMPROF_HEADERS
31       ${MEMPROF_HEADERS}
32       sanitizer/allocator_interface.h
33       sanitizer/common_interface_defs.h
34       )
35   endif()
36 endif(COMPILER_RT_BUILD_MEMPROF)
38 if (COMPILER_RT_BUILD_XRAY)
39   set(XRAY_HEADERS
40     xray/xray_interface.h
41     xray/xray_log_interface.h
42     xray/xray_records.h
43     )
44 endif(COMPILER_RT_BUILD_XRAY)
46 if (COMPILER_RT_BUILD_ORC)
47   set(ORC_HEADERS
48     orc_rt/c_api.h
49     )
50 endif(COMPILER_RT_BUILD_ORC)
52 if (COMPILER_RT_BUILD_PROFILE)
53   set(PROFILE_HEADERS
54     profile/InstrProfData.inc
55     profile/instr_prof_interface.h
56     )
57 endif(COMPILER_RT_BUILD_PROFILE)
59 set(COMPILER_RT_HEADERS
60   ${SANITIZER_HEADERS}
61   ${FUZZER_HEADERS}
62   ${MEMPROF_HEADERS}
63   ${XRAY_HEADERS}
64   ${ORC_HEADERS}
65   ${PROFILE_HEADERS})
67 set(output_dir ${COMPILER_RT_OUTPUT_DIR}/include)
69 # Copy compiler-rt headers to the build tree.
70 set(out_files)
71 foreach( 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})
79 endforeach( f )
81 add_custom_target(compiler-rt-headers ALL DEPENDS ${out_files})
82 add_dependencies(compiler-rt compiler-rt-headers)
83 set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT/Resources")
85 # Install sanitizer headers.
86 install(FILES ${SANITIZER_HEADERS}
87   COMPONENT compiler-rt-headers
88   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
89   DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/sanitizer)
90 # Install fuzzer headers.
91 install(FILES ${FUZZER_HEADERS}
92   COMPONENT compiler-rt-headers
93   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
94   DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/fuzzer)
95 # Install memprof headers.
96 if (COMPILER_RT_BUILD_MEMPROF)
97   install(FILES sanitizer/memprof_interface.h
98     COMPONENT compiler-rt-headers
99     PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
100     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.h
103       COMPONENT compiler-rt-headers
104       PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
105       DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/sanitizer)
106   endif()
107 endif(COMPILER_RT_BUILD_MEMPROF)
108 # Install xray headers.
109 install(FILES ${XRAY_HEADERS}
110   COMPONENT compiler-rt-headers
111   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
112   DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/xray)
113 # Install ORC headers.
114 install(FILES ${ORC_HEADERS}
115   COMPONENT compiler-rt-headers
116   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
117   DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/orc)
118 # Install profile headers.
119 install(FILES ${PROFILE_HEADERS}
120   COMPONENT compiler-rt-headers
121   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
122   DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/profile)
124 if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.
125   add_custom_target(install-compiler-rt-headers
126                     DEPENDS compiler-rt-headers
127                     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-stripped
132                     DEPENDS compiler-rt-headers
133                     COMMAND "${CMAKE_COMMAND}"
134                             -DCMAKE_INSTALL_COMPONENT="compiler-rt-headers"
135                             -DCMAKE_INSTALL_DO_STRIP=1
136                             -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
137                     USES_TERMINAL)
138 endif()