[CMake] Add top-level target for each compiler-rt library, and add 'compiler-rt' target encompassing them all.

llvm-svn: 201556
This commit is contained in:
Alexey Samsonov 2014-02-18 09:33:45 +00:00
parent e9a3e5a93e
commit 63a4af7346
11 changed files with 27 additions and 6 deletions

View File

@ -58,7 +58,6 @@ macro(add_compiler_rt_static_runtime name arch)
# Add installation command.
install(TARGETS ${name}
ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
add_dependencies(compiler-rt ${name})
else()
message(FATAL_ERROR "Archtecture ${arch} can't be targeted")
endif()
@ -81,7 +80,6 @@ macro(add_compiler_rt_osx_static_runtime name)
ARCHIVE_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR})
install(TARGETS ${name}
ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
add_dependencies(compiler-rt ${name})
endmacro()
# Adds dynamic runtime library on osx/iossim, which supports multiple
@ -104,7 +102,6 @@ macro(add_compiler_rt_darwin_dynamic_runtime name os)
LIBRARY_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR})
install(TARGETS ${name}
LIBRARY DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
add_dependencies(compiler-rt ${name})
endmacro()
# Unittests support.

View File

@ -26,7 +26,6 @@ macro(add_sanitizer_rt_symbols name)
DEPENDS ${symsfile}
SOURCES ${SANITIZER_GEN_DYNAMIC_LIST} ${ARGN})
install(FILES ${symsfile} DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
add_dependencies(compiler-rt ${name}-symbols)
endmacro()
# Add target to check code style for sanitizer runtimes.

View File

@ -127,6 +127,7 @@ endif()
add_compiler_rt_resource_file(asan_blacklist asan_blacklist.txt)
add_dependencies(asan asan_blacklist)
add_dependencies(compiler-rt asan)
if(LLVM_INCLUDE_TESTS)
add_subdirectory(tests)

View File

@ -222,12 +222,17 @@ set(arm_SOURCES
arm/unordsf2vfp.S
${GENERIC_SOURCES})
add_custom_target(builtins)
if (NOT WIN32)
foreach(arch x86_64 i386 arm)
if(CAN_TARGET_${arch})
add_compiler_rt_static_runtime(clang_rt.${arch} ${arch}
SOURCES ${${arch}_SOURCES}
CFLAGS "-std=c99")
add_dependencies(builtins clang_rt.${arch})
endif()
endforeach()
endif()
add_dependencies(compiler-rt builtins)

View File

@ -44,3 +44,5 @@ add_custom_command(OUTPUT ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt
add_dependencies(dfsan dfsan_abilist)
install(FILES ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt
DESTINATION ${LIBCLANG_INSTALL_PATH})
add_dependencies(compiler-rt dfsan)

View File

@ -48,3 +48,5 @@ elseif(NOT ANDROID)
add_dependencies(lsan clang_rt.lsan-${arch})
endforeach()
endif()
add_dependencies(compiler-rt lsan)

View File

@ -35,6 +35,7 @@ endif()
add_compiler_rt_resource_file(msan_blacklist msan_blacklist.txt)
add_dependencies(msan msan_blacklist)
add_dependencies(compiler-rt msan)
if(LLVM_INCLUDE_TESTS)
add_subdirectory(tests)

View File

@ -4,14 +4,20 @@ set(PROFILE_SOURCES
filter_available_targets(PROFILE_SUPPORTED_ARCH x86_64 i386 arm)
add_custom_target(profile)
if(APPLE)
add_compiler_rt_osx_static_runtime(clang_rt.profile_osx
ARCH ${PROFILE_SUPPORTED_ARCH}
SOURCES ${PROFILE_SOURCES})
add_dependencies(profile clang_rt.profile_osx)
else()
foreach(arch ${PROFILE_SUPPORTED_ARCH})
add_compiler_rt_static_runtime(clang_rt.profile-${arch}
${arch}
SOURCES ${PROFILE_SOURCES})
add_dependencies(profile clang_rt.profile-${arch})
endforeach()
endif()
add_dependencies(compiler-rt profile)

View File

@ -94,6 +94,7 @@ append_no_rtti_flag(SANITIZER_CFLAGS)
append_if(SANITIZER_CFLAGS COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG -Wframe-larger-than=512)
append_if(SANITIZER_CFLAGS COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG -Wglobal-constructors)
add_custom_target(sanitizer_common)
set(SANITIZER_RUNTIME_LIBRARIES)
if(APPLE)
# Build universal binary on APPLE.
@ -122,16 +123,19 @@ else()
add_compiler_rt_object_library(RTSanitizerCommonLibc ${arch}
SOURCES ${SANITIZER_LIBCDEP_SOURCES} CFLAGS ${SANITIZER_CFLAGS}
DEFS ${SANITIZER_COMMON_DEFINITIONS})
list(APPEND SANITIZER_RUNTIME_LIBRARIES RTSanitizerCommon.${arch}
RTSanitizerCommonLibc.${arch})
add_compiler_rt_static_runtime(clang_rt.san-${arch} ${arch}
SOURCES $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
CFLAGS ${SANITIZER_CFLAGS}
DEFS ${SANITIZER_COMMON_DEFINITIONS})
list(APPEND SANITIZER_RUNTIME_LIBRARIES RTSanitizerCommon.${arch}
RTSanitizerCommonLibc.${arch})
add_dependencies(sanitizer_common clang_rt.san-${arch})
endforeach()
endif()
add_dependencies(compiler-rt sanitizer_common)
# Unit tests for common sanitizer runtime.
if(LLVM_INCLUDE_TESTS)
add_subdirectory(tests)

View File

@ -71,6 +71,8 @@ if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE)
clang_rt.tsan-${arch}-symbols)
endif()
add_dependencies(compiler-rt tsan)
if(LLVM_INCLUDE_TESTS)
add_subdirectory(tests)
endif()

View File

@ -49,3 +49,5 @@ else()
endif()
endforeach()
endif()
add_dependencies(compiler-rt ubsan)