]> git.proxmox.com Git - rustc.git/blame - src/libcompiler_builtins/compiler-rt/lib/CMakeLists.txt
New upstream version 1.25.0+dfsg1
[rustc.git] / src / libcompiler_builtins / compiler-rt / lib / CMakeLists.txt
CommitLineData
1a4d82fc
JJ
1# First, add the subdirectories which contain feature-based runtime libraries
2# and several convenience helper libraries.
3
4include(AddCompilerRT)
5include(SanitizerUtils)
92a42be0 6
7cac9316
XL
7# Hoist the building of sanitizer_common on whether we're building either the
8# sanitizers or xray (or both).
9#
10#TODO: Refactor sanitizer_common into smaller pieces (e.g. flag parsing, utils).
11if (COMPILER_RT_HAS_SANITIZER_COMMON AND
12 (COMPILER_RT_BUILD_SANITIZERS OR COMPILER_RT_BUILD_XRAY))
13 add_subdirectory(sanitizer_common)
14endif()
15
92a42be0
SL
16if(COMPILER_RT_BUILD_BUILTINS)
17 add_subdirectory(builtins)
18endif()
19
7cac9316
XL
20function(compiler_rt_build_runtime runtime)
21 string(TOUPPER ${runtime} runtime_uppercase)
22 if(COMPILER_RT_HAS_${runtime_uppercase})
23 add_subdirectory(${runtime})
2c00a5a8
XL
24 if(${runtime} STREQUAL tsan)
25 add_subdirectory(tsan/dd)
26 endif()
7cac9316
XL
27 endif()
28endfunction()
29
30if(COMPILER_RT_BUILD_SANITIZERS)
31 compiler_rt_build_runtime(interception)
92a42be0
SL
32
33 if(COMPILER_RT_HAS_SANITIZER_COMMON)
5bcae85e 34 add_subdirectory(stats)
1a4d82fc 35 add_subdirectory(lsan)
1a4d82fc
JJ
36 add_subdirectory(ubsan)
37 endif()
92a42be0 38
2c00a5a8
XL
39 foreach(sanitizer ${COMPILER_RT_SANITIZERS_TO_BUILD})
40 compiler_rt_build_runtime(${sanitizer})
41 endforeach()
42endif()
92a42be0 43
2c00a5a8 44if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)
7cac9316
XL
45 compiler_rt_build_runtime(profile)
46endif()
5bcae85e 47
7cac9316
XL
48if(COMPILER_RT_BUILD_XRAY)
49 compiler_rt_build_runtime(xray)
92a42be0 50endif()
2c00a5a8
XL
51
52if(COMPILER_RT_BUILD_LIBFUZZER)
53 compiler_rt_build_runtime(fuzzer)
54endif()