Dan Liew bb78eef6b6 [CMake] Tidy up the organisation of compiler-rt when configured as a standalone
build with an IDE (e.g. Xcode) as the generator.

Previously the global `USE_FOLDERS` property wasn't set in standalone
builds leading to existing settings of FOLDER not being respected.

In addition to this there were several targets that appeared at the top
level that were not interesting and clustered up the view. These have
been changed to be displayed in "Compiler-RT Misc".

Now when an Xcode project is generated from a standalone compiler-rt
build the project navigator is much less cluttered. The interesting
libraries should appear in "Compiler-RT Libraries" in the IDE.

Differential Revision: https://reviews.llvm.org/D48378

llvm-svn: 335728
2018-06-27 12:56:34 +00:00

53 lines
1.6 KiB
CMake

# Build for the experimental deadlock detector runtime library.
include_directories(../..)
set(DD_CFLAGS ${SANITIZER_COMMON_CFLAGS})
append_rtti_flag(OFF DD_CFLAGS)
set(DD_SOURCES
dd_rtl.cc
dd_interceptors.cc
)
set(DD_LINKLIBS ${SANITIZER_CXX_ABI_LIBRARY} ${SANITIZER_COMMON_LINK_LIBS})
append_list_if(COMPILER_RT_HAS_LIBDL dl DD_LINKLIBS)
append_list_if(COMPILER_RT_HAS_LIBRT rt DD_LINKLIBS)
append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread DD_LINKLIBS)
add_custom_target(dd)
set_target_properties(dd PROPERTIES FOLDER "Compiler-RT Misc")
# Deadlock detector is currently supported on 64-bit Linux only.
if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE AND NOT ANDROID)
set(arch "x86_64")
add_compiler_rt_runtime(clang_rt.dd
STATIC
ARCHS ${arch}
SOURCES ${DD_SOURCES}
$<TARGET_OBJECTS:RTInterception.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
CFLAGS ${DD_CFLAGS}
PARENT_TARGET dd)
add_compiler_rt_object_libraries(RTDD
ARCHS ${arch}
SOURCES ${DD_SOURCES} CFLAGS ${DD_CFLAGS})
add_compiler_rt_runtime(clang_rt.dyndd
SHARED
ARCHS ${arch}
SOURCES $<TARGET_OBJECTS:RTDD.${arch}>
$<TARGET_OBJECTS:RTInterception.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonSymbolizer.${arch}>
LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS}
LINK_LIBS ${DD_LINKLIBS}
PARENT_TARGET dd)
endif()
add_dependencies(compiler-rt dd)