Chandler Carruth | 1f5d5c0 | 2012-04-04 22:12:04 +0000 | [diff] [blame] | 1 | # CMake build for CompilerRT. |
| 2 | # |
| 3 | # This build assumes that CompilerRT is checked out into the |
| 4 | # 'projects/compiler-rt' inside of an LLVM tree, it is not a stand-alone build |
| 5 | # system. |
| 6 | # |
| 7 | # An important constraint of the build is that it only produces libraries |
| 8 | # based on the ability of the host toolchain to target various platforms. |
| 9 | |
Chandler Carruth | c78ad00 | 2012-06-25 08:40:10 +0000 | [diff] [blame] | 10 | # The CompilerRT build system requires CMake version 2.8.8 or higher in order |
| 11 | # to use its support for building convenience "libraries" as a collection of |
| 12 | # .o files. This is particularly useful in producing larger, more complex |
| 13 | # runtime libraries. |
Hans Wennborg | a97442f | 2014-02-11 21:46:19 +0000 | [diff] [blame] | 14 | if (NOT MSVC) |
| 15 | cmake_minimum_required(VERSION 2.8.8) |
| 16 | else() |
| 17 | # Version 2.8.12.1 is required to build with Visual Studion 2013. |
| 18 | cmake_minimum_required(VERSION 2.8.12.1) |
| 19 | endif() |
| 20 | |
Alexey Samsonov | 20abdf6 | 2013-10-01 12:52:15 +0000 | [diff] [blame] | 21 | # Top level target used to build all compiler-rt libraries. |
| 22 | add_custom_target(compiler-rt) |
| 23 | |
Alexey Samsonov | 8c2cd86 | 2013-01-20 13:58:10 +0000 | [diff] [blame] | 24 | # Compute the Clang version from the LLVM version. |
| 25 | # FIXME: We should be able to reuse CLANG_VERSION variable calculated |
| 26 | # in Clang cmake files, instead of copying the rules here. |
| 27 | string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION |
| 28 | ${PACKAGE_VERSION}) |
| 29 | # Setup the paths where compiler-rt runtimes and headers should be stored. |
Alexey Samsonov | 1181a10 | 2014-02-18 14:28:53 +0000 | [diff] [blame] | 30 | set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}) |
| 31 | string(TOLOWER ${CMAKE_SYSTEM_NAME} COMPILER_RT_OS_DIR) |
| 32 | set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}) |
| 33 | set(COMPILER_RT_LIBRARY_OUTPUT_DIR |
| 34 | ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR}) |
Alexey Samsonov | 8c2cd86 | 2013-01-20 13:58:10 +0000 | [diff] [blame] | 35 | set(COMPILER_RT_LIBRARY_INSTALL_DIR |
Alexey Samsonov | 1181a10 | 2014-02-18 14:28:53 +0000 | [diff] [blame] | 36 | ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR}) |
Alexey Samsonov | 8c2cd86 | 2013-01-20 13:58:10 +0000 | [diff] [blame] | 37 | |
Alexey Samsonov | ca7fcf2 | 2012-12-19 12:33:39 +0000 | [diff] [blame] | 38 | # Add path for custom modules |
| 39 | set(CMAKE_MODULE_PATH |
Alexey Samsonov | 9a1ffce | 2014-02-18 07:26:58 +0000 | [diff] [blame] | 40 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake" |
Alexey Samsonov | ca7fcf2 | 2012-12-19 12:33:39 +0000 | [diff] [blame] | 41 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules" |
Alexey Samsonov | 9a1ffce | 2014-02-18 07:26:58 +0000 | [diff] [blame] | 42 | ${CMAKE_MODULE_PATH} |
Alexey Samsonov | ca7fcf2 | 2012-12-19 12:33:39 +0000 | [diff] [blame] | 43 | ) |
Alexey Samsonov | 9a1ffce | 2014-02-18 07:26:58 +0000 | [diff] [blame] | 44 | include(CompilerRTUtils) |
Alexey Samsonov | ca7fcf2 | 2012-12-19 12:33:39 +0000 | [diff] [blame] | 45 | |
| 46 | set(COMPILER_RT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) |
Alexey Samsonov | 6a65b18 | 2013-06-06 12:35:48 +0000 | [diff] [blame] | 47 | set(COMPILER_RT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) |
Alexey Samsonov | 4c17c1b | 2013-03-19 09:17:35 +0000 | [diff] [blame] | 48 | # Setup custom SDK sysroots. |
| 49 | set(COMPILER_RT_DARWIN_SDK_SYSROOT ${COMPILER_RT_SOURCE_DIR}/SDKs/darwin) |
| 50 | set(COMPILER_RT_LINUX_SDK_SYSROOT ${COMPILER_RT_SOURCE_DIR}/SDKs/linux) |
Alexey Samsonov | ca7fcf2 | 2012-12-19 12:33:39 +0000 | [diff] [blame] | 51 | |
Evgeniy Stepanov | 6db97e8 | 2014-02-10 13:34:43 +0000 | [diff] [blame] | 52 | set(COMPILER_RT_EXTRA_ANDROID_HEADERS ${COMPILER_RT_SOURCE_DIR}/third_party/android/include) |
| 53 | |
Chandler Carruth | 1f5d5c0 | 2012-04-04 22:12:04 +0000 | [diff] [blame] | 54 | # Detect whether the current target platform is 32-bit or 64-bit, and setup |
| 55 | # the correct commandline flags needed to attempt to target 32-bit and 64-bit. |
Alexey Samsonov | dd8872b | 2013-06-30 16:21:32 +0000 | [diff] [blame] | 56 | if (NOT CMAKE_SIZEOF_VOID_P EQUAL 4 AND |
| 57 | NOT CMAKE_SIZEOF_VOID_P EQUAL 8) |
| 58 | message(FATAL_ERROR "Please use architecture with 4 or 8 byte pointers.") |
Chandler Carruth | 1f5d5c0 | 2012-04-04 22:12:04 +0000 | [diff] [blame] | 59 | endif() |
Hans Wennborg | 67c6e50 | 2013-08-27 01:24:01 +0000 | [diff] [blame] | 60 | if (NOT MSVC) |
| 61 | set(TARGET_64_BIT_CFLAGS "-m64") |
| 62 | set(TARGET_32_BIT_CFLAGS "-m32") |
| 63 | else() |
| 64 | set(TARGET_64_BIT_CFLAGS "") |
| 65 | set(TARGET_32_BIT_CFLAGS "") |
| 66 | endif() |
Chandler Carruth | 1f5d5c0 | 2012-04-04 22:12:04 +0000 | [diff] [blame] | 67 | |
Alexey Samsonov | b670018 | 2013-01-21 14:31:45 +0000 | [diff] [blame] | 68 | # List of architectures we can target. |
| 69 | set(COMPILER_RT_SUPPORTED_ARCH) |
Alexey Samsonov | 4b0ee8e | 2013-01-18 13:10:42 +0000 | [diff] [blame] | 70 | |
Alexey Samsonov | 85bd73d | 2012-12-19 15:17:23 +0000 | [diff] [blame] | 71 | function(get_target_flags_for_arch arch out_var) |
Alexey Samsonov | 4b0ee8e | 2013-01-18 13:10:42 +0000 | [diff] [blame] | 72 | list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX) |
| 73 | if(ARCH_INDEX EQUAL -1) |
Alexey Samsonov | 85bd73d | 2012-12-19 15:17:23 +0000 | [diff] [blame] | 74 | message(FATAL_ERROR "Unsupported architecture: ${arch}") |
Alexey Samsonov | 4b0ee8e | 2013-01-18 13:10:42 +0000 | [diff] [blame] | 75 | else() |
| 76 | set(${out_var} ${TARGET_${arch}_CFLAGS} PARENT_SCOPE) |
Alexey Samsonov | 85bd73d | 2012-12-19 15:17:23 +0000 | [diff] [blame] | 77 | endif() |
| 78 | endfunction() |
| 79 | |
Chandler Carruth | 1f5d5c0 | 2012-04-04 22:12:04 +0000 | [diff] [blame] | 80 | # Try to compile a very simple source file to ensure we can target the given |
| 81 | # platform. We use the results of these tests to build only the various target |
| 82 | # runtime libraries supported by our current compilers cross-compiling |
| 83 | # abilities. |
Alexey Samsonov | b670018 | 2013-01-21 14:31:45 +0000 | [diff] [blame] | 84 | set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.c) |
| 85 | file(WRITE ${SIMPLE_SOURCE} "#include <stdlib.h>\nint main() {}") |
Chandler Carruth | 1f5d5c0 | 2012-04-04 22:12:04 +0000 | [diff] [blame] | 86 | |
Alexey Samsonov | b670018 | 2013-01-21 14:31:45 +0000 | [diff] [blame] | 87 | # test_target_arch(<arch> <target flags...>) |
| 88 | # Sets the target flags for a given architecture and determines if this |
| 89 | # architecture is supported by trying to build a simple file. |
| 90 | macro(test_target_arch arch) |
| 91 | set(TARGET_${arch}_CFLAGS ${ARGN}) |
| 92 | try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_SOURCE} |
| 93 | COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS}" |
| 94 | CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${TARGET_${arch}_CFLAGS}") |
| 95 | if(${CAN_TARGET_${arch}}) |
| 96 | list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch}) |
| 97 | endif() |
| 98 | endmacro() |
| 99 | |
Evgeniy Stepanov | aa9d74c | 2014-02-14 09:22:10 +0000 | [diff] [blame] | 100 | if(ANDROID_COMMON_FLAGS) |
| 101 | test_target_arch(arm_android "${ANDROID_COMMON_FLAGS}") |
| 102 | else() |
| 103 | if("${LLVM_NATIVE_ARCH}" STREQUAL "X86") |
| 104 | if (NOT MSVC) |
| 105 | test_target_arch(x86_64 ${TARGET_64_BIT_CFLAGS}) |
| 106 | endif() |
| 107 | test_target_arch(i386 ${TARGET_32_BIT_CFLAGS}) |
| 108 | elseif("${LLVM_NATIVE_ARCH}" STREQUAL "PowerPC") |
| 109 | test_target_arch(powerpc64 ${TARGET_64_BIT_CFLAGS}) |
| 110 | elseif("${LLVM_NATIVE_ARCH}" STREQUAL "ARM") |
| 111 | test_target_arch(arm "") |
Hans Wennborg | 67c6e50 | 2013-08-27 01:24:01 +0000 | [diff] [blame] | 112 | endif() |
Alexey Samsonov | b670018 | 2013-01-21 14:31:45 +0000 | [diff] [blame] | 113 | endif() |
Chandler Carruth | 1f5d5c0 | 2012-04-04 22:12:04 +0000 | [diff] [blame] | 114 | |
Alexey Samsonov | c20f5d2 | 2012-12-27 13:19:23 +0000 | [diff] [blame] | 115 | # We only support running instrumented tests when we're not cross compiling |
Evgeniy Stepanov | aa9d74c | 2014-02-14 09:22:10 +0000 | [diff] [blame] | 116 | # and target a unix-like system. We can run tests on Android even when we are |
| 117 | # cross-compiling. |
| 118 | if(("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}" AND UNIX) OR ANDROID) |
Michael Gottesman | 4ddc215 | 2013-04-01 04:13:03 +0000 | [diff] [blame] | 119 | option(COMPILER_RT_CAN_EXECUTE_TESTS "Can we execute instrumented tests" ON) |
Alexey Samsonov | c20f5d2 | 2012-12-27 13:19:23 +0000 | [diff] [blame] | 120 | else() |
Michael Gottesman | 4ddc215 | 2013-04-01 04:13:03 +0000 | [diff] [blame] | 121 | option(COMPILER_RT_CAN_EXECUTE_TESTS "Can we execute instrumented tests" OFF) |
Alexey Samsonov | c20f5d2 | 2012-12-27 13:19:23 +0000 | [diff] [blame] | 122 | endif() |
Michael Gottesman | 4ddc215 | 2013-04-01 04:13:03 +0000 | [diff] [blame] | 123 | |
Alexey Samsonov | 5cb7860 | 2013-02-08 07:39:25 +0000 | [diff] [blame] | 124 | # Check if compiler-rt is built with libc++. |
| 125 | find_flag_in_string("${CMAKE_CXX_FLAGS}" "-stdlib=libc++" |
| 126 | COMPILER_RT_USES_LIBCXX) |
| 127 | |
Alexey Samsonov | fb844c7 | 2012-08-10 14:45:52 +0000 | [diff] [blame] | 128 | function(filter_available_targets out_var) |
| 129 | set(archs) |
| 130 | foreach(arch ${ARGN}) |
Alexey Samsonov | 4b0ee8e | 2013-01-18 13:10:42 +0000 | [diff] [blame] | 131 | list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX) |
| 132 | if(NOT (ARCH_INDEX EQUAL -1) AND CAN_TARGET_${arch}) |
Alexey Samsonov | fb844c7 | 2012-08-10 14:45:52 +0000 | [diff] [blame] | 133 | list(APPEND archs ${arch}) |
| 134 | endif() |
| 135 | endforeach() |
| 136 | set(${out_var} ${archs} PARENT_SCOPE) |
| 137 | endfunction() |
| 138 | |
Peter Collingbourne | cbdea32 | 2013-10-25 23:03:34 +0000 | [diff] [blame] | 139 | option(COMPILER_RT_DEBUG "Build runtimes with full debug info" OFF) |
Peter Collingbourne | cbdea32 | 2013-10-25 23:03:34 +0000 | [diff] [blame] | 140 | # COMPILER_RT_DEBUG_PYBOOL is used by lit.common.configured.in. |
| 141 | pythonize_bool(COMPILER_RT_DEBUG) |
| 142 | |
Alexey Samsonov | 9a1ffce | 2014-02-18 07:26:58 +0000 | [diff] [blame] | 143 | #================================ |
| 144 | # Setup Compiler Flags |
| 145 | #================================ |
| 146 | include(config-ix) |
| 147 | |
Chandler Carruth | c1c9d58 | 2012-08-29 00:13:11 +0000 | [diff] [blame] | 148 | # Provide some common commmandline flags for Sanitizer runtimes. |
Alexey Samsonov | 9a1ffce | 2014-02-18 07:26:58 +0000 | [diff] [blame] | 149 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_FPIC_FLAG -fPIC) |
| 150 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_FNO_BUILTIN_FLAG -fno-builtin) |
| 151 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions) |
| 152 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG -fomit-frame-pointer) |
| 153 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_FUNWIND_TABLES_FLAG -funwind-tables) |
| 154 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG -fno-stack-protector) |
| 155 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG -fvisibility=hidden) |
| 156 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG -fno-function-sections) |
| 157 | |
| 158 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_MT_FLAG /MT) |
| 159 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_Oy_FLAG /Oy-) |
| 160 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_GS_FLAG /GS-) |
| 161 | |
| 162 | # Build with optimization, unless we're in debug mode. |
| 163 | if(NOT COMPILER_RT_DEBUG) |
| 164 | if(MSVC) |
| 165 | list(APPEND SANITIZER_COMMON_CFLAGS /O2) |
| 166 | else() |
Peter Collingbourne | cbdea32 | 2013-10-25 23:03:34 +0000 | [diff] [blame] | 167 | list(APPEND SANITIZER_COMMON_CFLAGS -O3) |
| 168 | endif() |
Hans Wennborg | 67c6e50 | 2013-08-27 01:24:01 +0000 | [diff] [blame] | 169 | endif() |
Alexey Samsonov | 9a1ffce | 2014-02-18 07:26:58 +0000 | [diff] [blame] | 170 | |
| 171 | # Build sanitizer runtimes with debug info. |
| 172 | if(COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG) |
| 173 | list(APPEND SANITIZER_COMMON_CFLAGS -gline-tables-only) |
| 174 | elseif(COMPILER_RT_HAS_G_FLAG) |
| 175 | list(APPEND SANITIZER_COMMON_CFLAGS -g) |
| 176 | elseif(COMPILER_RT_HAS_Zi_FLAG) |
| 177 | list(APPEND SANITIZER_COMMON_CFLAGS /Zi) |
Alexey Samsonov | 75fb677 | 2012-11-08 14:49:28 +0000 | [diff] [blame] | 178 | endif() |
Alexey Samsonov | 9a1ffce | 2014-02-18 07:26:58 +0000 | [diff] [blame] | 179 | |
| 180 | # Turn off several warnings. |
| 181 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_WNO_GNU_FLAG -Wno-gnu) |
| 182 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_WNO_VARIADIC_MACROS_FLAG -Wno-variadic-macros) |
| 183 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_WNO_C99_EXTENSIONS_FLAG -Wno-c99-extensions) |
| 184 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_WNO_NON_VIRTUAL_DTOR_FLAG -Wno-non-virtual-dtor) |
| 185 | append_if(SANITIZER_COMMON_CFLAGS COMPILER_RT_HAS_WD4722_FLAG /wd4722) |
Alexey Samsonov | 5cb7860 | 2013-02-08 07:39:25 +0000 | [diff] [blame] | 186 | |
Alexey Samsonov | d83ccd0 | 2012-09-05 09:00:03 +0000 | [diff] [blame] | 187 | if(APPLE) |
Alexander Potapenko | 49034e3 | 2013-11-07 10:08:19 +0000 | [diff] [blame] | 188 | # Obtain the iOS Simulator SDK path from xcodebuild. |
| 189 | execute_process( |
| 190 | COMMAND xcodebuild -version -sdk iphonesimulator Path |
| 191 | OUTPUT_VARIABLE IOSSIM_SDK_DIR |
| 192 | OUTPUT_STRIP_TRAILING_WHITESPACE |
| 193 | ) |
Alexey Samsonov | 1dbe6e0 | 2014-02-18 12:01:24 +0000 | [diff] [blame] | 194 | string(REGEX MATCH "-mmacosx-version-min=" |
| 195 | MACOSX_VERSION_MIN_FLAG "${CMAKE_CXX_FLAGS}") |
Alexander Potapenko | 49034e3 | 2013-11-07 10:08:19 +0000 | [diff] [blame] | 196 | set(SANITIZER_COMMON_SUPPORTED_DARWIN_OS osx) |
Alexey Samsonov | 1dbe6e0 | 2014-02-18 12:01:24 +0000 | [diff] [blame] | 197 | if (IOSSIM_SDK_DIR AND NOT MACOSX_VERSION_MIN_FLAG) |
Alexander Potapenko | 49034e3 | 2013-11-07 10:08:19 +0000 | [diff] [blame] | 198 | list(APPEND SANITIZER_COMMON_SUPPORTED_DARWIN_OS iossim) |
| 199 | endif() |
| 200 | |
Alexey Samsonov | 5cb7860 | 2013-02-08 07:39:25 +0000 | [diff] [blame] | 201 | if(COMPILER_RT_USES_LIBCXX) |
| 202 | set(SANITIZER_MIN_OSX_VERSION 10.7) |
| 203 | else() |
Alexey Samsonov | eb79732 | 2013-07-16 11:54:40 +0000 | [diff] [blame] | 204 | set(SANITIZER_MIN_OSX_VERSION 10.6) |
Alexey Samsonov | 5cb7860 | 2013-02-08 07:39:25 +0000 | [diff] [blame] | 205 | endif() |
Alexander Potapenko | 49034e3 | 2013-11-07 10:08:19 +0000 | [diff] [blame] | 206 | set(DARWIN_osx_CFLAGS -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}) |
| 207 | set(DARWIN_iossim_CFLAGS |
| 208 | -mios-simulator-version-min=7.0 -isysroot ${IOSSIM_SDK_DIR}) |
| 209 | set(DARWIN_osx_LINKFLAGS) |
| 210 | set(DARWIN_iossim_LINKFLAGS |
| 211 | -Wl,-ios_simulator_version_min,7.0.0 |
| 212 | -mios-simulator-version-min=7.0 |
Alexander Potapenko | 2b00289 | 2013-11-19 14:58:42 +0000 | [diff] [blame] | 213 | -isysroot ${IOSSIM_SDK_DIR}) |
Alexey Samsonov | d83ccd0 | 2012-09-05 09:00:03 +0000 | [diff] [blame] | 214 | endif() |
Chandler Carruth | c1c9d58 | 2012-08-29 00:13:11 +0000 | [diff] [blame] | 215 | |
Alexey Samsonov | b068483 | 2013-01-18 16:51:07 +0000 | [diff] [blame] | 216 | # Architectures supported by Sanitizer runtimes. Specific sanitizers may |
| 217 | # support only subset of these (e.g. TSan works on x86_64 only). |
| 218 | filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH |
Renato Golin | 66e2b70 | 2014-01-31 14:25:58 +0000 | [diff] [blame] | 219 | x86_64 i386 powerpc64 arm) |
Alexey Samsonov | 9f20d67 | 2014-02-14 14:06:10 +0000 | [diff] [blame] | 220 | filter_available_targets(ASAN_SUPPORTED_ARCH x86_64 i386 powerpc64) |
Alexey Samsonov | f6cf6ab | 2014-02-14 12:05:41 +0000 | [diff] [blame] | 221 | filter_available_targets(DFSAN_SUPPORTED_ARCH x86_64) |
Alexey Samsonov | 7eeef85 | 2014-02-14 12:26:05 +0000 | [diff] [blame] | 222 | filter_available_targets(LSAN_SUPPORTED_ARCH x86_64) |
Alexey Samsonov | 8434e60 | 2014-02-14 13:02:58 +0000 | [diff] [blame] | 223 | filter_available_targets(MSAN_SUPPORTED_ARCH x86_64) |
Alexey Samsonov | e6a6183 | 2014-02-14 14:35:48 +0000 | [diff] [blame] | 224 | filter_available_targets(TSAN_SUPPORTED_ARCH x86_64) |
Alexey Samsonov | f6cf6ab | 2014-02-14 12:05:41 +0000 | [diff] [blame] | 225 | filter_available_targets(UBSAN_SUPPORTED_ARCH x86_64 i386) |
Alexey Samsonov | b068483 | 2013-01-18 16:51:07 +0000 | [diff] [blame] | 226 | |
Alexey Samsonov | 9f3938e | 2013-04-11 15:49:52 +0000 | [diff] [blame] | 227 | add_subdirectory(include) |
| 228 | |
Alexey Samsonov | 8434e60 | 2014-02-14 13:02:58 +0000 | [diff] [blame] | 229 | set(COMPILER_RT_LIBCXX_PATH ${LLVM_MAIN_SRC_DIR}/projects/libcxx) |
| 230 | if(EXISTS ${COMPILER_RT_LIBCXX_PATH}/) |
| 231 | set(COMPILER_RT_HAS_LIBCXX_SOURCES TRUE) |
| 232 | else() |
| 233 | set(COMPILER_RT_HAS_LIBCXX_SOURCES FALSE) |
| 234 | endif() |
| 235 | |
Chandler Carruth | 1f5d5c0 | 2012-04-04 22:12:04 +0000 | [diff] [blame] | 236 | add_subdirectory(lib) |
| 237 | |
| 238 | if(LLVM_INCLUDE_TESTS) |
Alexey Samsonov | 81a2b46 | 2014-02-14 11:00:07 +0000 | [diff] [blame] | 239 | add_subdirectory(unittests) |
Chandler Carruth | 1f5d5c0 | 2012-04-04 22:12:04 +0000 | [diff] [blame] | 240 | endif() |
Alexey Samsonov | 9f20d67 | 2014-02-14 14:06:10 +0000 | [diff] [blame] | 241 | add_subdirectory(test) |