Lines Matching +full:libc +full:- +full:build
1 # See www/CMake.html for instructions on how to build libcxxabi with CMake.
8 set(LLVM_SUBPROJECT_TITLE "libc++abi")
21 set(CMAKE_FOLDER "libc++")
26 "Specify path to libc++ source.")
30 # Require out of source build.
33 "${PROJECT_NAME} requires an out of source build. Please create a separate
34 build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
38 message(FATAL_ERROR "Libc++abi can't be built for MSVC targets, and doing so is pointless anyway because such "
39 "targets must use the MS C++ ABI, and libc++abi provides the Itanium C++ ABI.")
51 When disabled, libc++abi does not support stack unwinding and other exceptions-related features." ON)
52 option(LIBCXXABI_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
55 option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." ON)
60 option(LIBCXXABI_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF)
61 option(LIBCXXABI_ENABLE_THREADS "Build with threads enabled" ON)
62 option(LIBCXXABI_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF)
63 option(LIBCXXABI_HAS_WIN32_THREAD_API "Ignore auto-detection and force use of win32 thread API" OFF)
65 "Build libc++abi with an externalized threading API.
75 "Build libc++abi with definitions for operator new/delete. These are normally
76 defined in libc++abi, but it is also possible to define them in libc++, in
77 which case the definition in libc++abi should be turned off." ON)
78 option(LIBCXXABI_BUILD_32_BITS "Build 32 bit multilib libc++abi. This option is not supported anymore when building the runtimes. Please specify a full triple instead." ${LLVM_BUILD_32_BITS})
83 option(LIBCXXABI_INCLUDE_TESTS "Generate build targets for the libc++abi unit tests." ${LLVM_INCLUDE_TESTS})
86 option(LIBCXXABI_INSTALL_HEADERS "Install the libc++abi headers." ON)
87 option(LIBCXXABI_INSTALL_LIBRARY "Install the libc++abi library." ON)
89 set(LIBCXXABI_SHARED_OUTPUT_NAME "c++abi" CACHE STRING "Output name for the shared libc++abi runtime library.")
90 set(LIBCXXABI_STATIC_OUTPUT_NAME "c++abi" CACHE STRING "Output name for the static libc++abi runtime library.")
92 set(LIBCXXABI_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1" CACHE STRING "Path to install the libc++abi headers at.")
100 set(LIBCXXABI_LIBCXX_LIBRARY_PATH "" CACHE PATH "The path to libc++ library.")
102 "Version of libc++abi. This will be reflected in the name of the shared \
103 library produced. For example, -DLIBCXXABI_LIBRARY_VERSION=x.y will \
104 result in the library being named libc++abi.x.y.dylib, along with the \
108 # the libc++abi that is being built. The problem with testing a static libc++abi
109 # is that libc++ will prefer a dynamic libc++abi from the system over a static
110 # libc++abi from the output directory.
111 option(LIBCXXABI_ENABLE_SHARED "Build libc++abi as a shared library." ON)
112 option(LIBCXXABI_ENABLE_STATIC "Build libc++abi as a static library." ON)
115 "Install the static libc++abi library." ON
118 "Install the shared libc++abi library." ON
128 option(LIBCXXABI_BAREMETAL "Build libc++abi for baremetal targets." OFF)
136 message(FATAL_ERROR "libc++abi must be built as either a shared or static library.")
147 set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-mingw.cfg.in")
148 elseif(WIN32) # clang-cl
150 set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-shared-clangcl.cfg.in")
152 set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-static-clangcl.cfg.in")
156 set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-shared.cfg.in")
158 set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-static.cfg.in")
167 message(STATUS "Using libc++abi testing configuration: ${LIBCXXABI_TEST_CONFIG}")
183 "Path where built libc++abi runtime libraries should be installed.")
193 "Path where built libc++abi libraries should be installed.")
204 "Path where built libc++abi libraries should be installed.")
214 "The path to libc++ library." FORCE)
217 # Declare libc++abi configuration variables.
223 # LIBCXXABI_LIBRARIES: libraries libc++abi is linked to.
232 "Additional libraries libc++abi is linked to which can be provided in cache")
234 # Include macros for adding and removing libc++abi flags.
243 add_flags_if_supported("-mdefault-visibility-export-mapping=explicit")
249 include(config-ix)
252 list(APPEND LIBCXXABI_COMPILE_FLAGS -nostdinc++)
254 # passed on the command line. We build with -nostdinc++ and explicitly add
255 # just the libcxx system include paths with -I on the command line.
260 # Remove -stdlib flags to prevent them from causing an unused flag warning.
261 string(REPLACE "--stdlib=libc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
262 string(REPLACE "--stdlib=libstdc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
263 string(REPLACE "-stdlib=libc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
264 string(REPLACE "-stdlib=libstdc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
273 append_flags_if_supported(SANITIZER_FLAGS "-fno-omit-frame-pointer")
274 append_flags_if_supported(SANITIZER_FLAGS "-gline-tables-only")
278 append_flags_if_supported(SANITIZER_FLAGS "-gline-tables-only")
281 append_flags(SANITIZER_FLAGS "-fsanitize=address")
283 append_flags(SANITIZER_FLAGS "-fsanitize=hwaddress")
285 append_flags(SANITIZER_FLAGS -fsanitize=memory)
287 append_flags(SANITIZER_FLAGS "-fsanitize-memory-track-origins")
290 append_flags(SANITIZER_FLAGS "-fsanitize=undefined" "-fno-sanitize=vptr,function" "-fno-sanitize-recover=all")
293 append_flags(SANITIZER_FLAGS "-fsanitize=address,undefined" "-fno-sanitize=vptr,function" "-fno-sanitize-recover=all")
295 append_flags(SANITIZER_FLAGS -fsanitize=thread)
297 append_flags(SANITIZER_FLAGS -fsanitize=dataflow)
310 # Let the library headers know they are currently being used to build the
312 add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
316 add_definitions(-D_LIBCPP_BUILDING_LIBRARY)
319 add_compile_flags_if_supported(-fstrict-aliasing)
325 add_compile_flags_if_supported(-EHsc)
327 add_c_compile_flags_if_supported(-funwind-tables)
329 add_compile_flags_if_supported(-fno-exceptions)
330 add_compile_flags_if_supported(-EHs-)
331 add_compile_flags_if_supported(-EHa-)
339 list(APPEND LIBCXXABI_COMPILE_FLAGS -D_DEBUG)
344 list(APPEND LIBCXXABI_COMPILE_FLAGS -UNDEBUG)
348 list(APPEND LIBCXXABI_COMPILE_FLAGS -DNDEBUG)
369 add_definitions(-D_LIBCXXABI_HAS_NO_THREADS)
395 add_compile_flags_if_supported(-Wno-unused-command-line-argument)
396 add_compile_flags(-fno-modules)
407 list(APPEND LIBCXXABI_LINK_FLAGS "-undefined dynamic_lookup")
410 string(REPLACE "-Wl,-z,defs" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
415 add_definitions(-D_LIBCPP_HAS_THREAD_API_PTHREAD)
419 add_definitions(-D_LIBCPP_HAS_THREAD_API_WIN32)
423 add_definitions(-D_LIBCPP_HAS_THREAD_API_EXTERNAL)
427 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
431 add_definitions(-DLIBCXXABI_SILENT_TERMINATE)
435 add_definitions(-DLIBCXXABI_NON_DEMANGLING_TERMINATE)
439 add_definitions(-DLIBCXXABI_BAREMETAL)
444 add_definitions(-D_LIBCXXABI_LINK_PTHREAD_LIB)
455 add_definitions("-D_XOPEN_SOURCE=700")
479 if (LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL-NOTFOUND")
488 add_custom_target(cxxabi-test-depends
489 COMMENT "Build dependencies required to run the libc++abi test suite.")