2019-12-20 00:35:35 +00:00
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
|
2022-10-27 08:39:48 +00:00
|
|
|
set(LIBCXX_SOURCE_DIR "${ClickHouse_SOURCE_DIR}/contrib/llvm-project/libcxx")
|
2019-07-08 23:33:32 +00:00
|
|
|
|
|
|
|
set(SRCS
|
2021-04-24 19:48:44 +00:00
|
|
|
"${LIBCXX_SOURCE_DIR}/src/algorithm.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/any.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/atomic.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/barrier.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/bind.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/charconv.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/chrono.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/condition_variable.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/condition_variable_destructor.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/debug.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/exception.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/experimental/memory_resource.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/filesystem/directory_iterator.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/filesystem/int128_builtins.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/filesystem/operations.cpp"
|
2022-02-25 11:33:23 +00:00
|
|
|
"${LIBCXX_SOURCE_DIR}/src/format.cpp"
|
2021-04-24 19:48:44 +00:00
|
|
|
"${LIBCXX_SOURCE_DIR}/src/functional.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/future.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/hash.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/ios.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/ios.instantiations.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/iostream.cpp"
|
2022-10-20 10:52:43 +00:00
|
|
|
"${LIBCXX_SOURCE_DIR}/src/legacy_debug_handler.cpp"
|
2022-02-25 11:33:23 +00:00
|
|
|
"${LIBCXX_SOURCE_DIR}/src/legacy_pointer_safety.cpp"
|
2021-04-24 19:48:44 +00:00
|
|
|
"${LIBCXX_SOURCE_DIR}/src/locale.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/memory.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/mutex.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/mutex_destructor.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/new.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/optional.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/random.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/random_shuffle.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/regex.cpp"
|
2022-02-25 11:33:23 +00:00
|
|
|
"${LIBCXX_SOURCE_DIR}/src/ryu/d2fixed.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/ryu/d2s.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/ryu/f2s.cpp"
|
2021-04-24 19:48:44 +00:00
|
|
|
"${LIBCXX_SOURCE_DIR}/src/shared_mutex.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/stdexcept.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/string.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/strstream.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/system_error.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/thread.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/typeinfo.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/utility.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/valarray.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/variant.cpp"
|
|
|
|
"${LIBCXX_SOURCE_DIR}/src/vector.cpp"
|
2022-10-20 10:52:43 +00:00
|
|
|
"${LIBCXX_SOURCE_DIR}/src/verbose_abort.cpp"
|
2019-07-08 23:33:32 +00:00
|
|
|
)
|
|
|
|
|
2019-08-28 20:49:37 +00:00
|
|
|
add_library(cxx ${SRCS})
|
2021-10-17 20:10:01 +00:00
|
|
|
set_target_properties(cxx PROPERTIES FOLDER "contrib/libcxx-cmake")
|
2019-07-08 23:33:32 +00:00
|
|
|
|
2022-09-02 12:15:18 +00:00
|
|
|
target_include_directories(cxx SYSTEM BEFORE PRIVATE $<BUILD_INTERFACE:${LIBCXX_SOURCE_DIR}/src>)
|
2022-11-11 11:52:46 +00:00
|
|
|
target_include_directories(cxx SYSTEM BEFORE PUBLIC $<$<COMPILE_LANGUAGE:CXX>:$<BUILD_INTERFACE:${LIBCXX_SOURCE_DIR}/include>>)
|
2019-08-28 20:49:37 +00:00
|
|
|
target_compile_definitions(cxx PRIVATE -D_LIBCPP_BUILDING_LIBRARY -DLIBCXX_BUILDING_LIBCXXABI)
|
2019-09-15 15:20:31 +00:00
|
|
|
|
2020-01-02 06:56:53 +00:00
|
|
|
# Enable capturing stack traces for all exceptions.
|
2023-05-03 08:09:11 +00:00
|
|
|
target_compile_definitions(cxx PUBLIC -DSTD_EXCEPTION_HAS_STACK_TRACE=1)
|
2020-01-02 06:56:53 +00:00
|
|
|
|
2021-10-15 21:12:51 +00:00
|
|
|
if (USE_MUSL)
|
|
|
|
target_compile_definitions(cxx PUBLIC -D_LIBCPP_HAS_MUSL_LIBC=1)
|
|
|
|
endif ()
|
|
|
|
|
2019-12-20 00:35:35 +00:00
|
|
|
target_compile_options(cxx PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-nostdinc++>)
|
|
|
|
|
2020-02-22 19:45:53 +00:00
|
|
|
# Third party library may have substandard code.
|
2020-02-22 19:47:32 +00:00
|
|
|
target_compile_options(cxx PRIVATE -w)
|
2020-02-22 19:44:31 +00:00
|
|
|
|
2022-06-14 22:35:55 +00:00
|
|
|
# Enable support for Clang-Thread-Safety-Analysis in libcxx
|
|
|
|
target_compile_definitions(cxx PUBLIC -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS)
|
|
|
|
|
2019-08-28 20:49:37 +00:00
|
|
|
target_link_libraries(cxx PUBLIC cxxabi)
|
2019-07-08 23:33:32 +00:00
|
|
|
|
2019-08-28 20:49:37 +00:00
|
|
|
install(
|
|
|
|
TARGETS cxx
|
|
|
|
EXPORT global
|
|
|
|
ARCHIVE DESTINATION lib
|
|
|
|
RUNTIME DESTINATION lib
|
2019-08-29 13:38:18 +00:00
|
|
|
LIBRARY DESTINATION lib
|
2019-08-28 20:49:37 +00:00
|
|
|
)
|