[CMake] Add support for selecting which c++ abi library to use.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@169036 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
53008d8b0c
commit
a358fbe504
@ -39,6 +39,11 @@ option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
|||||||
option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON)
|
option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON)
|
||||||
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
||||||
|
|
||||||
|
set(CXXABIS none libcxxabi libcxxrt libsupc++)
|
||||||
|
set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING
|
||||||
|
"Specify C++ ABI library to use." FORCE)
|
||||||
|
set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS "";${CXXABIS})
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Configure System
|
# Configure System
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
@ -58,6 +63,54 @@ get_target_triple(LIBCXX_TARGET_TRIPLE
|
|||||||
)
|
)
|
||||||
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
|
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
|
||||||
|
|
||||||
|
if (${LIBCXX_CXX_ABI} STREQUAL "libsupc++")
|
||||||
|
set(LIBCXX_LIBSUPCXX_INCLUDE_PATHS "" CACHE STRINGS
|
||||||
|
"Paths to libsupc++ include directories. Separate by system separator")
|
||||||
|
set(LIBCXX_CXX_ABI_LIBRARIES stdc++)
|
||||||
|
set(LIBCXX_LIBSUPCXX_FILES
|
||||||
|
cxxabi.h
|
||||||
|
bits/c++config.h
|
||||||
|
bits/os_defines.h
|
||||||
|
bits/cpu_defines.h
|
||||||
|
bits/cxxabi_tweaks.h
|
||||||
|
bits/cxxabi_forced.h
|
||||||
|
)
|
||||||
|
set(LIBCXX_LIBSUPCXX_FILE_PATHS)
|
||||||
|
foreach(path ${LIBCXX_LIBSUPCXX_FILES})
|
||||||
|
set(found FALSE)
|
||||||
|
foreach(incpath ${LIBCXX_LIBSUPCXX_INCLUDE_PATHS})
|
||||||
|
if (EXISTS "${incpath}/${path}")
|
||||||
|
set(found TRUE)
|
||||||
|
get_filename_component(dstdir ${path} PATH)
|
||||||
|
get_filename_component(file ${path} NAME)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${CMAKE_BINARY_DIR}/include/${dstdir}/${file}"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
"${incpath}/${path}"
|
||||||
|
"${CMAKE_BINARY_DIR}/include/${dstdir}"
|
||||||
|
MAIN_DEPENDENCY "${incpath}/${path}"
|
||||||
|
)
|
||||||
|
list(APPEND LIBCXX_CXX_ABI_DEPS
|
||||||
|
"${CMAKE_BINARY_DIR}/include/${dstdir}/${file}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if (NOT found)
|
||||||
|
message(FATAL_ERROR "Failed to find ${path}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
add_custom_target(supcxx_headers DEPENDS ${LIBCXX_CXX_ABI_DEPS})
|
||||||
|
set(LIBCXX_CXX_ABI_DEPS supcxx_headers)
|
||||||
|
include_directories("${CMAKE_BINARY_DIR}/include")
|
||||||
|
install(DIRECTORY "${CMAKE_BINARY_DIR}/include/"
|
||||||
|
DESTINATION include/c++/v1
|
||||||
|
FILES_MATCHING
|
||||||
|
PATTERN "*"
|
||||||
|
)
|
||||||
|
elseif (${LIBCXX_CXX_ABI} NOT STREQUAL "none")
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Currently only none and libsupc++ are supported for c++ abi.")
|
||||||
|
endif ()
|
||||||
|
|
||||||
# Configure compiler.
|
# Configure compiler.
|
||||||
include(config-ix)
|
include(config-ix)
|
||||||
|
|
||||||
|
@ -31,7 +31,10 @@ else()
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_dependencies(cxx ${LIBCXX_CXX_ABI_DEPS})
|
||||||
|
|
||||||
# Generate library list.
|
# Generate library list.
|
||||||
|
set(libraries ${LIBCXX_CXX_ABI_LIBRARIES})
|
||||||
append_if(libraries LIBCXX_HAS_PTHREAD_LIB pthread)
|
append_if(libraries LIBCXX_HAS_PTHREAD_LIB pthread)
|
||||||
append_if(libraries LIBCXX_HAS_C_LIB c)
|
append_if(libraries LIBCXX_HAS_C_LIB c)
|
||||||
append_if(libraries LIBCXX_HAS_M_LIB m)
|
append_if(libraries LIBCXX_HAS_M_LIB m)
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
|
|
||||||
#if !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
|
#if !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__)
|
||||||
|
|
||||||
// libcxxrt provides implementations of these functions itself.
|
// libcxxrt provides implementations of these functions itself.
|
||||||
unexpected_handler
|
unexpected_handler
|
||||||
@ -99,7 +99,7 @@ terminate() _NOEXCEPT
|
|||||||
}
|
}
|
||||||
#endif // !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
|
#endif // !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
|
||||||
|
|
||||||
#ifndef LIBCXXRT
|
#if !defined(LIBCXXRT) && !defined(__GLIBCXX__)
|
||||||
bool uncaught_exception() _NOEXCEPT
|
bool uncaught_exception() _NOEXCEPT
|
||||||
{
|
{
|
||||||
#if __APPLE__ || defined(_LIBCPPABI_VERSION)
|
#if __APPLE__ || defined(_LIBCPPABI_VERSION)
|
||||||
@ -124,7 +124,7 @@ const char* exception::what() const _NOEXCEPT
|
|||||||
|
|
||||||
#endif // _LIBCPPABI_VERSION
|
#endif // _LIBCPPABI_VERSION
|
||||||
#endif //LIBCXXRT
|
#endif //LIBCXXRT
|
||||||
#ifndef _LIBCPPABI_VERSION
|
#if !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__)
|
||||||
|
|
||||||
bad_exception::~bad_exception() _NOEXCEPT
|
bad_exception::~bad_exception() _NOEXCEPT
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user