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 14 set(DD_DYNAMIC_DEFINITIONS DYNAMIC=1) 15 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. 27 if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE AND NOT ANDROID) 28 set(arch "x86_64") 29 add_compiler_rt_runtime(clang_rt.dd-${arch} ${arch} STATIC 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}) 36 37 add_compiler_rt_object_library(RTDD ${arch} 38 SOURCES ${DD_SOURCES} CFLAGS ${DD_CFLAGS} 39 DEFS ${DD_COMMON_DEFINITIONS} ${DD_DYNAMIC_DEFINITIONS}) 40 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}>) 46 target_link_libraries(clang_rt.dyndd-${arch} pthread dl) 47 endif() 48 49 add_dependencies(compiler-rt dd) 50 51