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 | |
| 8 | if("${CMAKE_BUILD_TYPE}" EQUAL "Release") |
| 9 | set(DD_COMMON_DEFINITIONS DEBUG=0) |
| 10 | else() |
| 11 | set(DD_COMMON_DEFINITIONS DEBUG=1) |
| 12 | endif() |
| 13 | |
Dmitry Vyukov | d1d8653 | 2014-03-04 12:52:20 +0000 | [diff] [blame] | 14 | set(DD_DYNAMIC_DEFINITIONS DYNAMIC=1) |
| 15 | |
Dmitry Vyukov | 530fb94 | 2014-03-03 13:15:12 +0000 | [diff] [blame] | 16 | set(DD_SOURCES |
| 17 | dd_rtl.cc |
| 18 | dd_interceptors.cc |
| 19 | ) |
| 20 | |
| 21 | set(DD_HEADERS |
| 22 | dd_rtl.h |
| 23 | ) |
| 24 | |
| 25 | add_custom_target(dd) |
| 26 | # Deadlock detector is currently supported on 64-bit Linux only. |
Dmitry Vyukov | d1d8653 | 2014-03-04 12:52:20 +0000 | [diff] [blame] | 27 | 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] | 28 | set(arch "x86_64") |
Alexey Samsonov | 78a8435 | 2014-03-31 13:45:36 +0000 | [diff] [blame] | 29 | add_compiler_rt_runtime(clang_rt.dd-${arch} ${arch} STATIC |
Dmitry Vyukov | 530fb94 | 2014-03-03 13:15:12 +0000 | [diff] [blame] | 30 | SOURCES ${DD_SOURCES} |
| 31 | $<TARGET_OBJECTS:RTInterception.${arch}> |
| 32 | $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> |
| 33 | $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> |
| 34 | CFLAGS ${DD_CFLAGS} |
| 35 | DEFS ${DD_COMMON_DEFINITIONS}) |
Dmitry Vyukov | d1d8653 | 2014-03-04 12:52:20 +0000 | [diff] [blame] | 36 | |
Alexey Samsonov | 1c9a921 | 2014-06-05 00:58:28 +0000 | [diff] [blame^] | 37 | add_compiler_rt_object_library(RTDD ${arch} |
| 38 | SOURCES ${DD_SOURCES} CFLAGS ${DD_CFLAGS} |
| 39 | DEFS ${DD_COMMON_DEFINITIONS} ${DD_DYNAMIC_DEFINITIONS}) |
Dmitry Vyukov | d1d8653 | 2014-03-04 12:52:20 +0000 | [diff] [blame] | 40 | |
Alexey Samsonov | 1c9a921 | 2014-06-05 00:58:28 +0000 | [diff] [blame^] | 41 | add_compiler_rt_runtime(clang_rt.dyndd-${arch} ${arch} SHARED |
| 42 | SOURCES $<TARGET_OBJECTS:RTDD.${arch}> |
| 43 | $<TARGET_OBJECTS:RTInterception.${arch}> |
| 44 | $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> |
| 45 | $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>) |
Dmitry Vyukov | d1d8653 | 2014-03-04 12:52:20 +0000 | [diff] [blame] | 46 | target_link_libraries(clang_rt.dyndd-${arch} pthread dl) |
Dmitry Vyukov | 530fb94 | 2014-03-03 13:15:12 +0000 | [diff] [blame] | 47 | endif() |
| 48 | |
| 49 | add_dependencies(compiler-rt dd) |
| 50 | |