blob: 42b16047fe35b58c16f5a7f01509ef2ced51a7fd [file] [log] [blame]
Dmitry Vyukov530fb942014-03-03 13:15:12 +00001# Build for the experimental deadlock detector runtime library.
2
3include_directories(../..)
4
5set(DD_CFLAGS ${SANITIZER_COMMON_CFLAGS})
6append_no_rtti_flag(DD_CFLAGS)
7
8if("${CMAKE_BUILD_TYPE}" EQUAL "Release")
9 set(DD_COMMON_DEFINITIONS DEBUG=0)
10else()
11 set(DD_COMMON_DEFINITIONS DEBUG=1)
12endif()
13
Dmitry Vyukovd1d86532014-03-04 12:52:20 +000014set(DD_DYNAMIC_DEFINITIONS DYNAMIC=1)
15
Dmitry Vyukov530fb942014-03-03 13:15:12 +000016set(DD_SOURCES
17 dd_rtl.cc
18 dd_interceptors.cc
19)
20
21set(DD_HEADERS
22 dd_rtl.h
23)
24
25add_custom_target(dd)
26# Deadlock detector is currently supported on 64-bit Linux only.
Dmitry Vyukovd1d86532014-03-04 12:52:20 +000027if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE AND NOT ANDROID)
Dmitry Vyukov530fb942014-03-03 13:15:12 +000028 set(arch "x86_64")
29 add_compiler_rt_static_runtime(clang_rt.dd-${arch} ${arch}
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 Vyukovd1d86532014-03-04 12:52:20 +000036
37 add_library(RTDD OBJECT ${DD_SOURCES})
38 set_target_compile_flags(RTDD ${DD_CFLAGS})
39 set_property(TARGET RTDD APPEND PROPERTY
40 COMPILE_DEFINITIONS ${DD_COMMON_DEFINITIONS})
41 set_property(TARGET RTDD APPEND PROPERTY
42 COMPILE_DEFINITIONS ${DD_DYNAMIC_DEFINITIONS})
43
44 add_library(clang_rt.dyndd-${arch} SHARED
45 $<TARGET_OBJECTS:RTDD>
46 $<TARGET_OBJECTS:RTInterception.${arch}>
47 $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
48 $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>)
49# set_target_compile_flags(clang_rt.dd-${arch} ${DD_CFLAGS})
50# set_property(TARGET clang_rt.dd-${arch} APPEND PROPERTY
51# COMPILE_DEFINITIONS ${DD_COMMON_DEFINITIONS})
52 target_link_libraries(clang_rt.dyndd-${arch} pthread dl)
Dmitry Vyukov530fb942014-03-03 13:15:12 +000053endif()
54
55add_dependencies(compiler-rt dd)
56