150
|
1 #===============================================================================
|
|
2 # Setup Project
|
|
3 #===============================================================================
|
|
4
|
|
5 cmake_minimum_required(VERSION 3.4.3)
|
|
6
|
|
7 if (POLICY CMP0042)
|
|
8 cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default
|
|
9 endif()
|
|
10
|
|
11 # Add path for custom modules
|
|
12 set(CMAKE_MODULE_PATH
|
|
13 "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
|
14 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
|
|
15 ${CMAKE_MODULE_PATH}
|
|
16 )
|
|
17
|
|
18 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBUNWIND_STANDALONE_BUILD)
|
|
19 project(libunwind LANGUAGES C CXX ASM)
|
|
20
|
|
21 # Rely on llvm-config.
|
|
22 set(CONFIG_OUTPUT)
|
|
23 if(NOT LLVM_CONFIG_PATH)
|
|
24 find_program(LLVM_CONFIG_PATH "llvm-config")
|
|
25 endif()
|
|
26 if (DEFINED LLVM_PATH)
|
|
27 set(LLVM_INCLUDE_DIR ${LLVM_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
|
|
28 set(LLVM_PATH ${LLVM_PATH} CACHE PATH "Path to LLVM source tree")
|
|
29 set(LLVM_MAIN_SRC_DIR ${LLVM_PATH})
|
|
30 set(LLVM_CMAKE_PATH "${LLVM_PATH}/cmake/modules")
|
|
31 elseif(LLVM_CONFIG_PATH)
|
|
32 message(STATUS "Found LLVM_CONFIG_PATH as ${LLVM_CONFIG_PATH}")
|
|
33 set(CONFIG_COMMAND ${LLVM_CONFIG_PATH} "--includedir" "--prefix" "--src-root")
|
|
34 execute_process(COMMAND ${CONFIG_COMMAND}
|
|
35 RESULT_VARIABLE HAD_ERROR
|
|
36 OUTPUT_VARIABLE CONFIG_OUTPUT)
|
|
37 if (NOT HAD_ERROR)
|
|
38 string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";"
|
|
39 CONFIG_OUTPUT ${CONFIG_OUTPUT})
|
|
40 else()
|
|
41 string(REPLACE ";" " " CONFIG_COMMAND_STR "${CONFIG_COMMAND}")
|
|
42 message(STATUS "${CONFIG_COMMAND_STR}")
|
|
43 message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
|
|
44 endif()
|
|
45
|
|
46 list(GET CONFIG_OUTPUT 0 INCLUDE_DIR)
|
|
47 list(GET CONFIG_OUTPUT 1 LLVM_OBJ_ROOT)
|
|
48 list(GET CONFIG_OUTPUT 2 MAIN_SRC_DIR)
|
|
49
|
|
50 set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
|
|
51 set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
|
|
52 set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
|
|
53 set(LLVM_LIT_PATH "${LLVM_PATH}/utils/lit/lit.py")
|
|
54
|
|
55 # --cmakedir is supported since llvm r291218 (4.0 release)
|
|
56 execute_process(
|
|
57 COMMAND ${LLVM_CONFIG_PATH} --cmakedir
|
|
58 RESULT_VARIABLE HAD_ERROR
|
|
59 OUTPUT_VARIABLE CONFIG_OUTPUT
|
|
60 ERROR_QUIET)
|
|
61 if(NOT HAD_ERROR)
|
|
62 string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG)
|
|
63 file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH)
|
|
64 else()
|
|
65 file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE)
|
|
66 set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
|
|
67 endif()
|
|
68 else()
|
|
69 message(WARNING "UNSUPPORTED LIBUNWIND CONFIGURATION DETECTED: "
|
|
70 "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. "
|
|
71 "Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
|
|
72 "or -DLLVM_PATH=path/to/llvm-source-root.")
|
|
73 endif()
|
|
74
|
|
75 if (EXISTS ${LLVM_CMAKE_PATH})
|
|
76 # Enable warnings, otherwise -w gets added to the cflags by HandleLLVMOptions.
|
|
77 set(LLVM_ENABLE_WARNINGS ON)
|
|
78 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
|
|
79 include("${LLVM_CMAKE_PATH}/AddLLVM.cmake")
|
|
80 include("${LLVM_CMAKE_PATH}/HandleLLVMOptions.cmake")
|
|
81 else()
|
|
82 message(WARNING "Not found: ${LLVM_CMAKE_PATH}")
|
|
83 endif()
|
|
84
|
|
85 set(PACKAGE_NAME libunwind)
|
|
86 set(PACKAGE_VERSION 11.0.0git)
|
|
87 set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
|
88 set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org")
|
|
89
|
|
90 if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
|
|
91 set(LLVM_LIT ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
|
|
92 else()
|
|
93 # Seek installed Lit.
|
|
94 find_program(LLVM_LIT "lit.py" ${LLVM_MAIN_SRC_DIR}/utils/lit
|
|
95 DOC "Path to lit.py")
|
|
96 endif()
|
|
97
|
|
98 if (LLVM_LIT)
|
|
99 # Define the default arguments to use with 'lit', and an option for the user
|
|
100 # to override.
|
|
101 set(LIT_ARGS_DEFAULT "-sv")
|
|
102 if (MSVC OR XCODE)
|
|
103 set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
|
|
104 endif()
|
|
105 set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
|
|
106
|
|
107 # On Win32 hosts, provide an option to specify the path to the GnuWin32 tools.
|
|
108 if (WIN32 AND NOT CYGWIN)
|
|
109 set(LLVM_LIT_TOOLS_DIR "" CACHE PATH "Path to GnuWin32 tools")
|
|
110 endif()
|
|
111 else()
|
|
112 set(LLVM_INCLUDE_TESTS OFF)
|
|
113 endif()
|
|
114
|
|
115 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
|
|
116 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
|
|
117 else()
|
|
118 set(LLVM_LIT "${CMAKE_SOURCE_DIR}/utils/lit/lit.py")
|
|
119 endif()
|
|
120
|
|
121 #===============================================================================
|
|
122 # Setup CMake Options
|
|
123 #===============================================================================
|
|
124 include(CMakeDependentOption)
|
|
125 include(HandleCompilerRT)
|
|
126
|
|
127 # Define options.
|
|
128 option(LIBUNWIND_BUILD_32_BITS "Build 32 bit libunwind" ${LLVM_BUILD_32_BITS})
|
|
129 option(LIBUNWIND_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
|
|
130 option(LIBUNWIND_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
|
|
131 option(LIBUNWIND_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
|
132 option(LIBUNWIND_ENABLE_SHARED "Build libunwind as a shared library." ON)
|
|
133 option(LIBUNWIND_ENABLE_STATIC "Build libunwind as a static library." ON)
|
|
134 option(LIBUNWIND_ENABLE_CROSS_UNWINDING "Enable cross-platform unwinding support." OFF)
|
|
135 option(LIBUNWIND_ENABLE_ARM_WMMX "Enable unwinding support for ARM WMMX registers." OFF)
|
|
136 option(LIBUNWIND_ENABLE_THREADS "Build libunwind with threading support." ON)
|
|
137 option(LIBUNWIND_WEAK_PTHREAD_LIB "Use weak references to refer to pthread functions." OFF)
|
|
138 option(LIBUNWIND_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF)
|
|
139 option(LIBUNWIND_INCLUDE_DOCS "Build the libunwind documentation." ${LLVM_INCLUDE_DOCS})
|
|
140
|
|
141 set(LIBUNWIND_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
|
|
142 "Define suffix of library directory name (32/64)")
|
|
143 option(LIBUNWIND_INSTALL_LIBRARY "Install the libunwind library." ON)
|
|
144 cmake_dependent_option(LIBUNWIND_INSTALL_STATIC_LIBRARY
|
|
145 "Install the static libunwind library." ON
|
|
146 "LIBUNWIND_ENABLE_STATIC;LIBUNWIND_INSTALL_LIBRARY" OFF)
|
|
147 cmake_dependent_option(LIBUNWIND_INSTALL_SHARED_LIBRARY
|
|
148 "Install the shared libunwind library." ON
|
|
149 "LIBUNWIND_ENABLE_SHARED;LIBUNWIND_INSTALL_LIBRARY" OFF)
|
|
150 set(LIBUNWIND_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.")
|
|
151 set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
|
|
152 set(LIBUNWIND_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
|
|
153 set(LIBUNWIND_TEST_LINKER_FLAGS "" CACHE STRING
|
|
154 "Additional linker flags for test programs.")
|
|
155 set(LIBUNWIND_TEST_COMPILER_FLAGS "" CACHE STRING
|
|
156 "Additional compiler flags for test programs.")
|
|
157
|
|
158 if (NOT LIBUNWIND_ENABLE_SHARED AND NOT LIBUNWIND_ENABLE_STATIC)
|
|
159 message(FATAL_ERROR "libunwind must be built as either a shared or static library.")
|
|
160 endif()
|
|
161
|
|
162 # Check that we can build with 32 bits if requested.
|
|
163 if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
|
|
164 if (LIBUNWIND_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM
|
|
165 message(STATUS "Building 32 bits executables and libraries.")
|
|
166 endif()
|
|
167 elseif(LIBUNWIND_BUILD_32_BITS)
|
|
168 message(FATAL_ERROR "LIBUNWIND_BUILD_32_BITS=ON is not supported on this platform.")
|
|
169 endif()
|
|
170
|
|
171 option(LIBUNWIND_HERMETIC_STATIC_LIBRARY
|
|
172 "Do not export any symbols from the static library." OFF)
|
|
173
|
|
174 #===============================================================================
|
|
175 # Configure System
|
|
176 #===============================================================================
|
|
177
|
|
178 # Add path for custom modules
|
|
179 set(CMAKE_MODULE_PATH
|
|
180 "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
|
181 ${CMAKE_MODULE_PATH})
|
|
182
|
|
183 set(LIBUNWIND_COMPILER ${CMAKE_CXX_COMPILER})
|
|
184 set(LIBUNWIND_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
185 set(LIBUNWIND_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
|
186
|
|
187 string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
|
|
188 ${PACKAGE_VERSION})
|
|
189
|
|
190 if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
|
191 set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
|
|
192 set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
|
|
193 if(LIBCXX_LIBDIR_SUBDIR)
|
|
194 string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
|
|
195 string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
|
|
196 endif()
|
|
197 elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
|
|
198 set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
|
|
199 set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
|
|
200 else()
|
|
201 set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
|
|
202 set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
|
|
203 endif()
|
|
204
|
|
205 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
|
|
206 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
|
|
207 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
|
|
208
|
|
209 set(LIBUNWIND_INSTALL_PREFIX "" CACHE STRING "Define libunwind destination prefix.")
|
|
210
|
|
211 set(LIBUNWIND_C_FLAGS "")
|
|
212 set(LIBUNWIND_CXX_FLAGS "")
|
|
213 set(LIBUNWIND_COMPILE_FLAGS "")
|
|
214 set(LIBUNWIND_LINK_FLAGS "")
|
|
215
|
|
216 # Include macros for adding and removing libunwind flags.
|
|
217 include(HandleLibunwindFlags)
|
|
218
|
|
219 #===============================================================================
|
|
220 # Setup Compiler Flags
|
|
221 #===============================================================================
|
|
222
|
|
223 # Get required flags.
|
|
224 add_target_flags_if(LIBUNWIND_BUILD_32_BITS "-m32")
|
|
225
|
|
226 if(LIBUNWIND_TARGET_TRIPLE)
|
|
227 add_target_flags("--target=${LIBUNWIND_TARGET_TRIPLE}")
|
|
228 elseif(CMAKE_CXX_COMPILER_TARGET)
|
|
229 set(LIBUNWIND_TARGET_TRIPLE "${CMAKE_CXX_COMPILER_TARGET}")
|
|
230 endif()
|
|
231 if(LIBUNWIND_GCC_TOOLCHAIN)
|
|
232 add_target_flags("--gcc-toolchain=${LIBUNWIND_GCC_TOOLCHAIN}")
|
|
233 elseif(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN)
|
|
234 set(LIBUNWIND_GCC_TOOLCHAIN "${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}")
|
|
235 endif()
|
|
236 if(LIBUNWIND_SYSROOT)
|
|
237 add_target_flags("--sysroot=${LIBUNWIND_SYSROOT}")
|
|
238 elseif(CMAKE_SYSROOT)
|
|
239 set(LIBUNWIND_SYSROOT "${CMAKE_SYSROOT}")
|
|
240 endif()
|
|
241
|
|
242 if (LIBUNWIND_TARGET_TRIPLE)
|
|
243 set(TARGET_TRIPLE "${LIBUNWIND_TARGET_TRIPLE}")
|
|
244 endif()
|
|
245
|
|
246 # Configure compiler.
|
|
247 include(config-ix)
|
|
248
|
|
249 if (LIBUNWIND_USE_COMPILER_RT AND NOT LIBUNWIND_HAS_NODEFAULTLIBS_FLAG)
|
|
250 list(APPEND LIBUNWIND_LINK_FLAGS "-rtlib=compiler-rt")
|
|
251 endif()
|
|
252
|
|
253 add_compile_flags_if_supported(-Werror=return-type)
|
|
254
|
|
255 # Get warning flags
|
|
256 add_compile_flags_if_supported(-W)
|
|
257 add_compile_flags_if_supported(-Wall)
|
|
258 add_compile_flags_if_supported(-Wchar-subscripts)
|
|
259 add_compile_flags_if_supported(-Wconversion)
|
|
260 add_compile_flags_if_supported(-Wmismatched-tags)
|
|
261 add_compile_flags_if_supported(-Wmissing-braces)
|
|
262 add_compile_flags_if_supported(-Wnewline-eof)
|
|
263 add_compile_flags_if_supported(-Wno-unused-function)
|
|
264 add_compile_flags_if_supported(-Wshadow)
|
|
265 add_compile_flags_if_supported(-Wshorten-64-to-32)
|
|
266 add_compile_flags_if_supported(-Wsign-compare)
|
|
267 add_compile_flags_if_supported(-Wsign-conversion)
|
|
268 add_compile_flags_if_supported(-Wstrict-aliasing=2)
|
|
269 add_compile_flags_if_supported(-Wstrict-overflow=4)
|
|
270 add_compile_flags_if_supported(-Wunused-parameter)
|
|
271 add_compile_flags_if_supported(-Wunused-variable)
|
|
272 add_compile_flags_if_supported(-Wwrite-strings)
|
|
273 add_compile_flags_if_supported(-Wundef)
|
|
274
|
|
275 if (LIBUNWIND_ENABLE_WERROR)
|
|
276 add_compile_flags_if_supported(-Werror)
|
|
277 add_compile_flags_if_supported(-WX)
|
|
278 else()
|
|
279 add_compile_flags_if_supported(-Wno-error)
|
|
280 add_compile_flags_if_supported(-WX-)
|
|
281 endif()
|
|
282
|
|
283 if (LIBUNWIND_ENABLE_PEDANTIC)
|
|
284 add_compile_flags_if_supported(-pedantic)
|
|
285 endif()
|
|
286
|
|
287 # Get feature flags.
|
|
288 # Exceptions
|
|
289 # Catches C++ exceptions only and tells the compiler to assume that extern C
|
|
290 # functions never throw a C++ exception.
|
|
291 add_cxx_compile_flags_if_supported(-fstrict-aliasing)
|
|
292 add_cxx_compile_flags_if_supported(-EHsc)
|
|
293
|
|
294 # Don't run the linker in this CMake check.
|
|
295 #
|
|
296 # The reason why this was added is that when building libunwind for
|
|
297 # ARM Linux, we need to pass the -funwind-tables flag in order for it to
|
|
298 # work properly with ARM EHABI.
|
|
299 #
|
|
300 # However, when performing CMake checks, adding this flag causes the check
|
|
301 # to produce a false negative, because the compiler generates calls
|
|
302 # to __aeabi_unwind_cpp_pr0, which is defined in libunwind itself,
|
|
303 # which isn't built yet, so the linker complains about undefined symbols.
|
|
304 #
|
|
305 # This leads to libunwind not being built with this flag, which makes
|
|
306 # libunwind quite useless in this setup.
|
|
307 set(_previous_CMAKE_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
|
|
308 set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
|
309 add_compile_flags_if_supported(-funwind-tables)
|
|
310 set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_previous_CMAKE_TRY_COMPILE_TARGET_TYPE})
|
|
311
|
|
312 if (LIBUNWIND_USES_ARM_EHABI AND NOT LIBUNWIND_SUPPORTS_FUNWIND_TABLES_FLAG)
|
|
313 message(SEND_ERROR "The -funwind-tables flag must be supported "
|
|
314 "because this target uses ARM Exception Handling ABI")
|
|
315 endif()
|
|
316
|
|
317 add_cxx_compile_flags_if_supported(-fno-exceptions)
|
|
318 add_cxx_compile_flags_if_supported(-fno-rtti)
|
|
319
|
|
320 # Ensure that we don't depend on C++ standard library.
|
|
321 if (LIBUNWIND_HAS_NOSTDINCXX_FLAG)
|
|
322 list(APPEND LIBUNWIND_COMPILE_FLAGS -nostdinc++)
|
|
323 # Remove -stdlib flags to prevent them from causing an unused flag warning.
|
|
324 string(REPLACE "-stdlib=libc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
325 string(REPLACE "-stdlib=libstdc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
326 endif()
|
|
327
|
|
328 # Assert
|
|
329 string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
|
|
330 if (LIBUNWIND_ENABLE_ASSERTIONS)
|
|
331 # MSVC doesn't like _DEBUG on release builds. See PR 4379.
|
|
332 if (NOT MSVC)
|
|
333 add_compile_flags(-D_DEBUG)
|
|
334 endif()
|
|
335
|
|
336 # On Release builds cmake automatically defines NDEBUG, so we
|
|
337 # explicitly undefine it:
|
|
338 if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
|
339 add_compile_flags(-UNDEBUG)
|
|
340 endif()
|
|
341 else()
|
|
342 if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
|
343 add_compile_flags(-DNDEBUG)
|
|
344 endif()
|
|
345 endif()
|
|
346
|
|
347 # Cross-unwinding
|
|
348 if (NOT LIBUNWIND_ENABLE_CROSS_UNWINDING)
|
|
349 add_compile_flags(-D_LIBUNWIND_IS_NATIVE_ONLY)
|
|
350 endif()
|
|
351
|
|
352 # Threading-support
|
|
353 if (NOT LIBUNWIND_ENABLE_THREADS)
|
|
354 add_compile_flags(-D_LIBUNWIND_HAS_NO_THREADS)
|
|
355 endif()
|
|
356
|
|
357 # ARM WMMX register support
|
|
358 if (LIBUNWIND_ENABLE_ARM_WMMX)
|
|
359 # __ARM_WMMX is a compiler pre-define (as per the ACLE 2.0). Clang does not
|
|
360 # define this macro for any supported target at present. Therefore, here we
|
|
361 # provide the option to explicitly enable support for WMMX registers in the
|
|
362 # unwinder.
|
|
363 add_compile_flags(-D__ARM_WMMX)
|
|
364 endif()
|
|
365
|
|
366 # This is the _ONLY_ place where add_definitions is called.
|
|
367 if (MSVC)
|
|
368 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
|
369 endif()
|
|
370
|
|
371 # Disable DLL annotations on Windows for static builds.
|
|
372 if (WIN32 AND LIBUNWIND_ENABLE_STATIC AND NOT LIBUNWIND_ENABLE_SHARED)
|
|
373 add_definitions(-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS)
|
|
374 endif()
|
|
375
|
|
376 if (LIBUNWIND_HAS_COMMENT_LIB_PRAGMA)
|
|
377 if (LIBUNWIND_HAS_DL_LIB)
|
|
378 add_definitions(-D_LIBUNWIND_LINK_DL_LIB)
|
|
379 endif()
|
|
380 if (LIBUNWIND_HAS_PTHREAD_LIB)
|
|
381 add_definitions(-D_LIBUNWIND_LINK_PTHREAD_LIB)
|
|
382 endif()
|
|
383 endif()
|
|
384
|
|
385 #===============================================================================
|
|
386 # Setup Source Code
|
|
387 #===============================================================================
|
|
388
|
|
389 include_directories(include)
|
|
390
|
|
391 add_subdirectory(src)
|
|
392
|
|
393 if (LIBUNWIND_INCLUDE_DOCS)
|
|
394 add_subdirectory(docs)
|
|
395 endif()
|
|
396
|
|
397 if (EXISTS ${LLVM_CMAKE_PATH})
|
|
398 add_subdirectory(test)
|
|
399 endif()
|