Dmitry Vyukov | 530fb94 | 2014-03-03 13:15:12 +0000 | [diff] [blame] | 1 | # Build for the experimental deadlock detector runtime library. |
| 2 | |
| 3 | include_directories(../..) |
| 4 | |
| 5 | set(DD_CFLAGS ${SANITIZER_COMMON_CFLAGS}) |
| 6 | append_no_rtti_flag(DD_CFLAGS) |
| 7 | |
Dmitry Vyukov | 530fb94 | 2014-03-03 13:15:12 +0000 | [diff] [blame] | 8 | set(DD_SOURCES |
| 9 | dd_rtl.cc |
| 10 | dd_interceptors.cc |
| 11 | ) |
| 12 | |
Viktor Kutuzov | 68b3e87 | 2014-09-17 07:54:46 +0000 | [diff] [blame] | 13 | set(DD_LINKLIBS) |
Kuba Brecka | 14c0c59 | 2014-10-15 22:47:54 +0000 | [diff] [blame] | 14 | append_list_if(COMPILER_RT_HAS_LIBDL dl DD_LINKLIBS) |
Evgeniy Stepanov | 42fb966 | 2015-05-29 22:57:15 +0000 | [diff] [blame] | 15 | append_list_if(COMPILER_RT_HAS_LIBRT rt DD_LINKLIBS) |
Kuba Brecka | 14c0c59 | 2014-10-15 22:47:54 +0000 | [diff] [blame] | 16 | append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread DD_LINKLIBS) |
Viktor Kutuzov | 68b3e87 | 2014-09-17 07:54:46 +0000 | [diff] [blame] | 17 | |
Dmitry Vyukov | 530fb94 | 2014-03-03 13:15:12 +0000 | [diff] [blame] | 18 | add_custom_target(dd) |
| 19 | # Deadlock detector is currently supported on 64-bit Linux only. |
Dmitry Vyukov | d1d8653 | 2014-03-04 12:52:20 +0000 | [diff] [blame] | 20 | if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE AND NOT ANDROID) |
Dmitry Vyukov | 530fb94 | 2014-03-03 13:15:12 +0000 | [diff] [blame] | 21 | set(arch "x86_64") |
Chris Bieneman | d160260 | 2015-08-25 19:53:09 +0000 | [diff] [blame] | 22 | add_compiler_rt_runtime(clang_rt.dd |
| 23 | STATIC |
| 24 | ARCHS ${arch} |
Dmitry Vyukov | 530fb94 | 2014-03-03 13:15:12 +0000 | [diff] [blame] | 25 | SOURCES ${DD_SOURCES} |
| 26 | $<TARGET_OBJECTS:RTInterception.${arch}> |
| 27 | $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> |
| 28 | $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> |
Chris Bieneman | d160260 | 2015-08-25 19:53:09 +0000 | [diff] [blame] | 29 | CFLAGS ${DD_CFLAGS} |
| 30 | PARENT_TARGET dd) |
Dmitry Vyukov | d1d8653 | 2014-03-04 12:52:20 +0000 | [diff] [blame] | 31 | |
Chris Bieneman | 6bd006f | 2015-06-10 23:55:07 +0000 | [diff] [blame] | 32 | add_compiler_rt_object_libraries(RTDD |
Filipe Cabecinhas | 7af0a1c | 2015-06-19 03:39:24 +0000 | [diff] [blame] | 33 | ARCHS ${arch} |
Alexey Samsonov | c2485ca | 2014-12-10 02:14:15 +0000 | [diff] [blame] | 34 | SOURCES ${DD_SOURCES} CFLAGS ${DD_CFLAGS}) |
Dmitry Vyukov | d1d8653 | 2014-03-04 12:52:20 +0000 | [diff] [blame] | 35 | |
Chris Bieneman | d160260 | 2015-08-25 19:53:09 +0000 | [diff] [blame] | 36 | add_compiler_rt_runtime(clang_rt.dyndd |
| 37 | SHARED |
| 38 | ARCHS ${arch} |
Alexey Samsonov | 1c9a921 | 2014-06-05 00:58:28 +0000 | [diff] [blame] | 39 | SOURCES $<TARGET_OBJECTS:RTDD.${arch}> |
| 40 | $<TARGET_OBJECTS:RTInterception.${arch}> |
| 41 | $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> |
Chris Bieneman | d160260 | 2015-08-25 19:53:09 +0000 | [diff] [blame] | 42 | $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> |
| 43 | LINK_LIBS ${DD_LINKLIBS} |
| 44 | PARENT_TARGET dd) |
Dmitry Vyukov | 530fb94 | 2014-03-03 13:15:12 +0000 | [diff] [blame] | 45 | endif() |
| 46 | |
| 47 | add_dependencies(compiler-rt dd) |