blob: a0675818f2dd909285f4bd5fe87a571af84387c6 [file] [log] [blame]
Chandler Carruthd51e0a02012-04-04 22:12:04 +00001# CMake build for CompilerRT.
2#
3# This build assumes that CompilerRT is checked out into the
Stephen Hines2d1fdb22014-05-28 23:58:16 -07004# 'projects/compiler-rt' inside of an LLVM tree.
5# Standalone build system for CompilerRT is not yet ready.
Chandler Carruthd51e0a02012-04-04 22:12:04 +00006#
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
Stephen Hines2d1fdb22014-05-28 23:58:16 -070010# Check if compiler-rt is built as a standalone project.
11if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080012 project(CompilerRT C CXX ASM)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070013 set(COMPILER_RT_STANDALONE_BUILD TRUE)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070014endif()
Chandler Carruthd51e0a02012-04-04 22:12:04 +000015
Pirama Arumuga Nainarc58a4362016-09-19 23:00:23 -070016cmake_minimum_required(VERSION 3.4.3)
17# FIXME:
18# The OLD behavior (pre 3.2) for this policy is to not set the value of the
19# CMAKE_EXE_LINKER_FLAGS variable in the generated test project. The NEW behavior
20# for this policy is to set the value of the CMAKE_EXE_LINKER_FLAGS variable
21# in the test project to the same as it is in the calling project. The new
22# behavior cause the compiler_rt test to fail during try_compile: see
23# projects/compiler-rt/cmake/Modules/CompilerRTUtils.cmake:121 such that
24# CAN_TARGET_${arch} is not set properly. This results in COMPILER_RT_SUPPORTED_ARCH
25# not being updated properly leading to poblems.
26cmake_policy(SET CMP0056 OLD)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070027
Pirama Arumuga Nainarc58a4362016-09-19 23:00:23 -070028# Add path for custom compiler-rt modules.
29list(INSERT CMAKE_MODULE_PATH 0
30 "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
31 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
32 )
Chandler Carrutha765ffc2012-06-25 08:40:10 +000033
Pirama Arumuga Nainarc58a4362016-09-19 23:00:23 -070034include(base-config-ix)
Alexey Samsonovc3494662013-10-01 12:52:15 +000035
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080036option(COMPILER_RT_BUILD_BUILTINS "Build builtins" ON)
37mark_as_advanced(COMPILER_RT_BUILD_BUILTINS)
38option(COMPILER_RT_BUILD_SANITIZERS "Build sanitizers" ON)
39mark_as_advanced(COMPILER_RT_BUILD_SANITIZERS)
40
Pirama Arumuga Nainarc58a4362016-09-19 23:00:23 -070041if (COMPILER_RT_STANDALONE_BUILD)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070042 if (NOT LLVM_CONFIG_PATH)
43 find_program(LLVM_CONFIG_PATH "llvm-config"
44 DOC "Path to llvm-config binary")
45 if (NOT LLVM_CONFIG_PATH)
46 message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
47 endif()
48 endif()
49 execute_process(
50 COMMAND ${LLVM_CONFIG_PATH} "--obj-root" "--bindir" "--libdir" "--src-root"
51 RESULT_VARIABLE HAD_ERROR
52 OUTPUT_VARIABLE CONFIG_OUTPUT)
53 if (HAD_ERROR)
54 message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
55 endif()
56 string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" CONFIG_OUTPUT ${CONFIG_OUTPUT})
57 list(GET CONFIG_OUTPUT 0 LLVM_BINARY_DIR)
58 list(GET CONFIG_OUTPUT 1 LLVM_TOOLS_BINARY_DIR)
59 list(GET CONFIG_OUTPUT 2 LLVM_LIBRARY_DIR)
60 list(GET CONFIG_OUTPUT 3 LLVM_MAIN_SRC_DIR)
61
62 # Make use of LLVM CMake modules.
63 file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE)
Pirama Arumuga Nainarc58a4362016-09-19 23:00:23 -070064 set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
Stephen Hines2d1fdb22014-05-28 23:58:16 -070065 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
66 # Get some LLVM variables from LLVMConfig.
67 include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
68
Stephen Hines86277eb2015-03-23 12:06:32 -070069 set(LLVM_LIBRARY_OUTPUT_INTDIR
70 ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
Stephen Hines2d1fdb22014-05-28 23:58:16 -070071
72 # Find Python interpreter.
73 set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5)
74 include(FindPythonInterp)
75 if(NOT PYTHONINTERP_FOUND)
76 message(FATAL_ERROR "
77 Unable to find Python interpreter required testing. Please install Python
78 or specify the PYTHON_EXECUTABLE CMake variable.")
79 endif()
80
81 # Define default arguments to lit.
82 set(LIT_ARGS_DEFAULT "-sv")
83 if (MSVC OR XCODE)
84 set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
85 endif()
86 set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
87endif()
88
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080089set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${TARGET_TRIPLE} CACHE STRING
90 "Default triple for which compiler-rt runtimes will be built.")
91if(DEFINED COMPILER_RT_TEST_TARGET_TRIPLE)
92 # Backwards compatibility: this variable used to be called
93 # COMPILER_RT_TEST_TARGET_TRIPLE.
94 set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${COMPILER_RT_TEST_TARGET_TRIPLE})
95endif()
Stephen Hines6a211c52014-07-21 00:49:56 -070096
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080097string(REPLACE "-" ";" TARGET_TRIPLE_LIST ${COMPILER_RT_DEFAULT_TARGET_TRIPLE})
98list(GET TARGET_TRIPLE_LIST 0 COMPILER_RT_DEFAULT_TARGET_ARCH)
99list(GET TARGET_TRIPLE_LIST 1 COMPILER_RT_DEFAULT_TARGET_OS)
100list(GET TARGET_TRIPLE_LIST 2 COMPILER_RT_DEFAULT_TARGET_ABI)
101# Determine if test target triple is specified explicitly, and doesn't match the
102# default.
103if(NOT COMPILER_RT_DEFAULT_TARGET_TRIPLE STREQUAL TARGET_TRIPLE)
104 set(COMPILER_RT_HAS_EXPLICIT_DEFAULT_TARGET_TRIPLE TRUE)
105else()
106 set(COMPILER_RT_HAS_EXPLICIT_DEFAULT_TARGET_TRIPLE FALSE)
107endif()
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -0800108if ("${COMPILER_RT_DEFAULT_TARGET_ABI}" STREQUAL "androideabi")
Stephen Hines6a211c52014-07-21 00:49:56 -0700109 set(ANDROID 1)
110endif()
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700111include(CompilerRTUtils)
Alexey Samsonov02dcc632012-12-19 12:33:39 +0000112
113set(COMPILER_RT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
Alexey Samsonovdd6605e2013-06-06 12:35:48 +0000114set(COMPILER_RT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700115
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700116# We support running instrumented tests when we're not cross compiling
117# and target a UNIX-like system or Windows.
118# We can run tests on Android even when we are cross-compiling.
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -0800119if(("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}" AND (UNIX OR WIN32)) OR ANDROID
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700120 OR COMPILER_RT_EMULATOR)
Michael Gottesmanfd0a7892013-04-01 04:13:03 +0000121 option(COMPILER_RT_CAN_EXECUTE_TESTS "Can we execute instrumented tests" ON)
Alexey Samsonovd7d7b5f2012-12-27 13:19:23 +0000122else()
Michael Gottesmanfd0a7892013-04-01 04:13:03 +0000123 option(COMPILER_RT_CAN_EXECUTE_TESTS "Can we execute instrumented tests" OFF)
Alexey Samsonovd7d7b5f2012-12-27 13:19:23 +0000124endif()
Michael Gottesmanfd0a7892013-04-01 04:13:03 +0000125
Peter Collingbourne7e8db742013-10-25 23:03:34 +0000126option(COMPILER_RT_DEBUG "Build runtimes with full debug info" OFF)
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -0800127option(COMPILER_RT_EXTERNALIZE_DEBUGINFO
128 "Generate dSYM files and strip executables and libraries (Darwin Only)" OFF)
Peter Collingbourne7e8db742013-10-25 23:03:34 +0000129# COMPILER_RT_DEBUG_PYBOOL is used by lit.common.configured.in.
130pythonize_bool(COMPILER_RT_DEBUG)
131
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700132#================================
133# Setup Compiler Flags
134#================================
Stephen Hines86277eb2015-03-23 12:06:32 -0700135
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700136include(config-ix)
137
138if(MSVC)
Pirama Arumuga Nainarc58a4362016-09-19 23:00:23 -0700139 # Override any existing /W flags with /W4. This is what LLVM does. Failing to
140 # remove other /W[0-4] flags will result in a warning about overriding a
141 # previous flag.
142 if (COMPILER_RT_HAS_W4_FLAG)
143 string(REGEX REPLACE " /W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
144 string(REGEX REPLACE " /W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
145 append_string_if(COMPILER_RT_HAS_W4_FLAG /W4 CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
146 endif()
Alexey Samsonov275ca012012-11-08 14:49:28 +0000147else()
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700148 append_string_if(COMPILER_RT_HAS_WALL_FLAG -Wall CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
Hans Wennborgc1f1af72013-08-27 01:24:01 +0000149endif()
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700150if(COMPILER_RT_ENABLE_WERROR)
151 append_string_if(COMPILER_RT_HAS_WERROR_FLAG -Werror CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
152 append_string_if(COMPILER_RT_HAS_WX_FLAG /WX CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
153endif()
154
155append_string_if(COMPILER_RT_HAS_STD_CXX11_FLAG -std=c++11 CMAKE_CXX_FLAGS)
156
157# Emulate C99 and C++11's __func__ for MSVC prior to 2013 CTP.
158if(NOT COMPILER_RT_HAS_FUNC_SYMBOL)
159 add_definitions(-D__func__=__FUNCTION__)
160endif()
161
162# Provide some common commmandline flags for Sanitizer runtimes.
Stephen Hines6d186232014-11-26 17:56:19 -0800163append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC SANITIZER_COMMON_CFLAGS)
164append_list_if(COMPILER_RT_HAS_FNO_BUILTIN_FLAG -fno-builtin SANITIZER_COMMON_CFLAGS)
165append_list_if(COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions SANITIZER_COMMON_CFLAGS)
Pirama Arumuga Nainarc58a4362016-09-19 23:00:23 -0700166if(NOT COMPILER_RT_DEBUG)
167 append_list_if(COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG -fomit-frame-pointer SANITIZER_COMMON_CFLAGS)
168endif()
Stephen Hines6d186232014-11-26 17:56:19 -0800169append_list_if(COMPILER_RT_HAS_FUNWIND_TABLES_FLAG -funwind-tables SANITIZER_COMMON_CFLAGS)
170append_list_if(COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG -fno-stack-protector SANITIZER_COMMON_CFLAGS)
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -0700171append_list_if(COMPILER_RT_HAS_FNO_SANITIZE_SAFE_STACK_FLAG -fno-sanitize=safe-stack SANITIZER_COMMON_CFLAGS)
Stephen Hines6d186232014-11-26 17:56:19 -0800172append_list_if(COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG -fvisibility=hidden SANITIZER_COMMON_CFLAGS)
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -0800173append_list_if(COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG -fvisibility-inlines-hidden SANITIZER_COMMON_CFLAGS)
Stephen Hines6d186232014-11-26 17:56:19 -0800174append_list_if(COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG -fno-function-sections SANITIZER_COMMON_CFLAGS)
Stephen Hines86277eb2015-03-23 12:06:32 -0700175append_list_if(COMPILER_RT_HAS_FNO_LTO_FLAG -fno-lto SANITIZER_COMMON_CFLAGS)
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700176
177if(MSVC)
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -0800178 # Replace the /M[DT][d] flags with /MT, and strip any definitions of _DEBUG,
179 # which cause definition mismatches at link time.
Stephen Hines6d186232014-11-26 17:56:19 -0800180 # FIXME: In fact, sanitizers should support both /MT and /MD, see PR20214.
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700181 if(COMPILER_RT_HAS_MT_FLAG)
Stephen Hines6d186232014-11-26 17:56:19 -0800182 foreach(flag_var
Pirama Arumuga Nainarc58a4362016-09-19 23:00:23 -0700183 CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
184 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
Stephen Hines6d186232014-11-26 17:56:19 -0800185 CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
186 CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -0800187 string(REGEX REPLACE "/M[DT]d" "/MT" ${flag_var} "${${flag_var}}")
188 string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
189 string(REGEX REPLACE "/D_DEBUG" "" ${flag_var} "${${flag_var}}")
Stephen Hines6d186232014-11-26 17:56:19 -0800190 endforeach()
Hans Wennborgc1f1af72013-08-27 01:24:01 +0000191 endif()
Stephen Hines6d186232014-11-26 17:56:19 -0800192 append_list_if(COMPILER_RT_HAS_Oy_FLAG /Oy- SANITIZER_COMMON_CFLAGS)
193 append_list_if(COMPILER_RT_HAS_GS_FLAG /GS- SANITIZER_COMMON_CFLAGS)
Pirama Arumuga Nainarc58a4362016-09-19 23:00:23 -0700194 # VS 2015 (version 1900) added support for thread safe static initialization.
195 # However, ASan interceptors run before CRT initialization, which causes the
196 # new thread safe code to crash. Disable this feature for now.
197 if (MSVC_VERSION GREATER 1899)
198 list(APPEND SANITIZER_COMMON_CFLAGS /Zc:threadSafeInit-)
199 endif()
Alexey Samsonov275ca012012-11-08 14:49:28 +0000200endif()
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700201
Stephen Hines86277eb2015-03-23 12:06:32 -0700202append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 SANITIZER_COMMON_CFLAGS)
203
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700204# Build with optimization, unless we're in debug mode. If we're using MSVC,
205# always respect the optimization flags set by CMAKE_BUILD_TYPE instead.
206if(NOT COMPILER_RT_DEBUG AND NOT MSVC)
207 list(APPEND SANITIZER_COMMON_CFLAGS -O3)
Chandler Carruth60ab0902012-08-29 00:13:11 +0000208endif()
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700209
Stephen Hines86277eb2015-03-23 12:06:32 -0700210# Determine if we should restrict stack frame sizes.
Pirama Arumuga Nainar259f7062015-05-06 11:49:53 -0700211# Stack frames on PowerPC and Mips and in debug biuld can be much larger than
Stephen Hines86277eb2015-03-23 12:06:32 -0700212# anticipated.
213# FIXME: Fix all sanitizers and add -Wframe-larger-than to
214# SANITIZER_COMMON_FLAGS
215if(COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG AND NOT COMPILER_RT_DEBUG
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -0800216 AND NOT ${COMPILER_RT_DEFAULT_TARGET_ARCH} MATCHES "powerpc|mips")
Stephen Hines86277eb2015-03-23 12:06:32 -0700217 set(SANITIZER_LIMIT_FRAME_SIZE TRUE)
218else()
219 set(SANITIZER_LIMIT_FRAME_SIZE FALSE)
220endif()
221
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700222# Build sanitizer runtimes with debug info.
Stephen Hines86277eb2015-03-23 12:06:32 -0700223if(COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG AND NOT COMPILER_RT_DEBUG)
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700224 list(APPEND SANITIZER_COMMON_CFLAGS -gline-tables-only)
225elseif(COMPILER_RT_HAS_G_FLAG)
226 list(APPEND SANITIZER_COMMON_CFLAGS -g)
227elseif(COMPILER_RT_HAS_Zi_FLAG)
228 list(APPEND SANITIZER_COMMON_CFLAGS /Zi)
Chandler Carruth60ab0902012-08-29 00:13:11 +0000229endif()
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700230
231# Turn off several warnings.
Stephen Hines6d186232014-11-26 17:56:19 -0800232append_list_if(COMPILER_RT_HAS_WGNU_FLAG -Wno-gnu SANITIZER_COMMON_CFLAGS)
233append_list_if(COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG -Wno-variadic-macros SANITIZER_COMMON_CFLAGS)
234append_list_if(COMPILER_RT_HAS_WC99_EXTENSIONS_FLAG -Wno-c99-extensions SANITIZER_COMMON_CFLAGS)
235append_list_if(COMPILER_RT_HAS_WNON_VIRTUAL_DTOR_FLAG -Wno-non-virtual-dtor SANITIZER_COMMON_CFLAGS)
236append_list_if(COMPILER_RT_HAS_WD4146_FLAG /wd4146 SANITIZER_COMMON_CFLAGS)
237append_list_if(COMPILER_RT_HAS_WD4291_FLAG /wd4291 SANITIZER_COMMON_CFLAGS)
238append_list_if(COMPILER_RT_HAS_WD4391_FLAG /wd4391 SANITIZER_COMMON_CFLAGS)
239append_list_if(COMPILER_RT_HAS_WD4722_FLAG /wd4722 SANITIZER_COMMON_CFLAGS)
240append_list_if(COMPILER_RT_HAS_WD4800_FLAG /wd4800 SANITIZER_COMMON_CFLAGS)
Stephen Hines86277eb2015-03-23 12:06:32 -0700241
Pirama Arumuga Nainarc58a4362016-09-19 23:00:23 -0700242# Warnings to turn off for all libraries, not just sanitizers.
243append_string_if(COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG -Wno-unused-parameter CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
244
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -0800245if(APPLE AND SANITIZER_MIN_OSX_VERSION VERSION_LESS "10.9")
246 # Mac OS X prior to 10.9 had problems with exporting symbols from
247 # libc++/libc++abi.
248 set(SANITIZER_CAN_USE_CXXABI FALSE)
Pirama Arumuga Nainarc58a4362016-09-19 23:00:23 -0700249elseif(MSVC)
250 set(SANITIZER_CAN_USE_CXXABI FALSE)
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -0800251else()
252 set(SANITIZER_CAN_USE_CXXABI TRUE)
Alexey Samsonov0f7d4a42012-09-05 09:00:03 +0000253endif()
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -0800254pythonize_bool(SANITIZER_CAN_USE_CXXABI)
Chandler Carruth60ab0902012-08-29 00:13:11 +0000255
Alexey Samsonov2a529ad2013-04-11 15:49:52 +0000256add_subdirectory(include)
257
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700258set(COMPILER_RT_LIBCXX_PATH ${LLVM_MAIN_SRC_DIR}/projects/libcxx)
259if(EXISTS ${COMPILER_RT_LIBCXX_PATH}/)
260 set(COMPILER_RT_HAS_LIBCXX_SOURCES TRUE)
261else()
262 set(COMPILER_RT_HAS_LIBCXX_SOURCES FALSE)
Alexey Samsonov38a61aa2013-08-29 10:49:04 +0000263endif()
Chandler Carruthd865fec2012-08-29 02:27:54 +0000264
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -0800265set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/tools/lld)
266if(EXISTS ${COMPILER_RT_LLD_PATH}/)
267 set(COMPILER_RT_HAS_LLD_SOURCES TRUE)
268else()
269 set(COMPILER_RT_HAS_LLD_SOURCES FALSE)
270endif()
271pythonize_bool(COMPILER_RT_HAS_LLD_SOURCES)
272
Chandler Carruthd51e0a02012-04-04 22:12:04 +0000273add_subdirectory(lib)
274
Stephen Hines2d1fdb22014-05-28 23:58:16 -0700275if(COMPILER_RT_INCLUDE_TESTS)
276 add_subdirectory(unittests)
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -0800277 add_subdirectory(test)
Chandler Carruthd51e0a02012-04-04 22:12:04 +0000278endif()