diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2014-08-08 22:01:20 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2014-08-08 22:01:20 +0000 |
commit | beab84b64ef5547c6b1eb19654cc90071e60fbf5 (patch) | |
tree | 4816c0e4017558fb9e6914fe4f06a478f1516024 /CMakeLists.txt | |
parent | a7ff1013793a63f96e2ca652c369f6751ef1bd5d (diff) |
[CMake] Determine which compiler-rt libraries are supported on
a given platform in a top-level CMakeLists.txt to use it both
in lib/ and in test/ subdirectories. Move architecture/platform
checks to config-ix.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@215247 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b457cb4e1..7e5f5715c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,9 +179,6 @@ else() set(TARGET_32_BIT_CFLAGS "") endif() -# List of architectures we can target. -set(COMPILER_RT_SUPPORTED_ARCH) - function(get_target_flags_for_arch arch out_var) list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX) if(ARCH_INDEX EQUAL -1) @@ -191,52 +188,6 @@ function(get_target_flags_for_arch arch out_var) endif() endfunction() -# Try to compile a very simple source file to ensure we can target the given -# platform. We use the results of these tests to build only the various target -# runtime libraries supported by our current compilers cross-compiling -# abilities. -set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.cc) -file(WRITE ${SIMPLE_SOURCE} "#include <stdlib.h>\n#include <limits>\nint main() {}\n") - -# test_target_arch(<arch> <target flags...>) -# Sets the target flags for a given architecture and determines if this -# architecture is supported by trying to build a simple file. -macro(test_target_arch arch) - set(TARGET_${arch}_CFLAGS ${ARGN}) - try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_SOURCE} - COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS}" - OUTPUT_VARIABLE TARGET_${arch}_OUTPUT - CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${TARGET_${arch}_CFLAGS}") - if(${CAN_TARGET_${arch}}) - list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch}) - elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "${arch}" OR - "${arch}" STREQUAL "arm_android") - # Bail out if we cannot target the architecture we plan to test. - message(FATAL_ERROR "Cannot compile for ${arch}:\n${TARGET_${arch}_OUTPUT}") - endif() -endmacro() - -if(ANDROID) - test_target_arch(arm_android "") -else() - if("${LLVM_NATIVE_ARCH}" STREQUAL "X86") - if (NOT MSVC) - test_target_arch(x86_64 ${TARGET_64_BIT_CFLAGS}) - endif() - test_target_arch(i386 ${TARGET_32_BIT_CFLAGS}) - elseif("${LLVM_NATIVE_ARCH}" STREQUAL "PowerPC") - test_target_arch(powerpc64 ${TARGET_64_BIT_CFLAGS}) - elseif("${LLVM_NATIVE_ARCH}" STREQUAL "Mips") - test_target_arch(mips "") - endif() - - # Build ARM libraries if we are configured to test on ARM - if("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "arm|aarch64") - test_target_arch(arm "-march=armv7-a") - test_target_arch(aarch64 "-march=armv8-a") - endif() -endif() - # We support running instrumented tests when we're not cross compiling # and target a UNIX-like system or Windows. # We can run tests on Android even when we are cross-compiling. @@ -251,17 +202,6 @@ endif() find_flag_in_string("${CMAKE_CXX_FLAGS}" "-stdlib=libc++" COMPILER_RT_USES_LIBCXX) -function(filter_available_targets out_var) - set(archs) - foreach(arch ${ARGN}) - list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX) - if(NOT (ARCH_INDEX EQUAL -1) AND CAN_TARGET_${arch}) - list(APPEND archs ${arch}) - endif() - endforeach() - set(${out_var} ${archs} PARENT_SCOPE) -endfunction() - option(COMPILER_RT_DEBUG "Build runtimes with full debug info" OFF) # COMPILER_RT_DEBUG_PYBOOL is used by lit.common.configured.in. pythonize_bool(COMPILER_RT_DEBUG) @@ -361,18 +301,6 @@ if(APPLE) -isysroot ${IOSSIM_SDK_DIR}) endif() -# Architectures supported by Sanitizer runtimes. Specific sanitizers may -# support only subset of these (e.g. TSan works on x86_64 only). -filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH - x86_64 i386 powerpc64 arm aarch64 mips) -filter_available_targets(ASAN_SUPPORTED_ARCH x86_64 i386 powerpc64 arm mips) -filter_available_targets(DFSAN_SUPPORTED_ARCH x86_64) -filter_available_targets(LSAN_SUPPORTED_ARCH x86_64) -filter_available_targets(MSAN_SUPPORTED_ARCH x86_64) -filter_available_targets(PROFILE_SUPPORTED_ARCH x86_64 i386 arm aarch64) -filter_available_targets(TSAN_SUPPORTED_ARCH x86_64) -filter_available_targets(UBSAN_SUPPORTED_ARCH x86_64 i386 arm aarch64) - add_subdirectory(include) set(COMPILER_RT_LIBCXX_PATH ${LLVM_MAIN_SRC_DIR}/projects/libcxx) |