mirror of
https://github.com/darlinghq/darling-libcxx.git
synced 2024-11-23 11:59:52 +00:00
Add check-cxx-abilist target when supported.
This patch adds a `check-cxx-abilist` target which verifies the libc++.so ABI when the current build configuration matches the configuration used to generate the ABI lists. In order to make this change `HandleOutOfTreeLLVM.cmake` needed to be modified to include `LLVMConfig.cmake` so that `TARGET_TRIPLE` is defined. Hopefully the changes needed to accommodate this won't break existing build configurations. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286789 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
763984ea8d
commit
5e000c6a82
@ -19,16 +19,17 @@ set(CMAKE_MODULE_PATH
|
||||
${CMAKE_MODULE_PATH}
|
||||
)
|
||||
|
||||
# Find the LLVM sources and simulate LLVM CMake options.
|
||||
include(HandleOutOfTreeLLVM)
|
||||
|
||||
if (LIBCXX_STANDALONE_BUILD)
|
||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
project(libcxx CXX C)
|
||||
|
||||
set(PACKAGE_NAME libcxx)
|
||||
set(PACKAGE_VERSION 4.0.0svn)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org")
|
||||
|
||||
# Find the LLVM sources and simulate LLVM CMake options.
|
||||
include(HandleOutOfTreeLLVM)
|
||||
endif()
|
||||
|
||||
if (LIBCXX_STANDALONE_BUILD AND NOT LLVM_FOUND)
|
||||
@ -59,7 +60,6 @@ option(LIBCXX_ENABLE_FILESYSTEM
|
||||
"Build filesystem as part of libc++experimental.a" ${LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY})
|
||||
option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS})
|
||||
|
||||
|
||||
# Benchmark options -----------------------------------------------------------
|
||||
option(LIBCXX_INCLUDE_BENCHMARKS "Build the libc++ benchmarks and their dependancies" ON)
|
||||
set(LIBCXX_BENCHMARK_NATIVE_STDLIB "" CACHE STRING
|
||||
@ -535,11 +535,13 @@ include_directories(include)
|
||||
add_subdirectory(include)
|
||||
add_subdirectory(lib)
|
||||
|
||||
|
||||
if (LIBCXX_INCLUDE_BENCHMARKS)
|
||||
add_subdirectory(benchmarks)
|
||||
endif()
|
||||
if (LIBCXX_INCLUDE_TESTS)
|
||||
add_subdirectory(test)
|
||||
add_subdirectory(lib/abi)
|
||||
endif()
|
||||
if (LIBCXX_INCLUDE_DOCS)
|
||||
add_subdirectory(docs)
|
||||
|
@ -11,6 +11,7 @@ macro(find_llvm_parts)
|
||||
set(LLVM_CMAKE_PATH "${LLVM_PATH}/cmake/modules")
|
||||
elseif(LLVM_CONFIG_PATH)
|
||||
message(STATUS "Found LLVM_CONFIG_PATH as ${LLVM_CONFIG_PATH}")
|
||||
set(LIBCXX_USING_INSTALLED_LLVM 1)
|
||||
set(CONFIG_COMMAND ${LLVM_CONFIG_PATH}
|
||||
"--includedir"
|
||||
"--prefix"
|
||||
@ -56,21 +57,28 @@ macro(find_llvm_parts)
|
||||
set(LLVM_FOUND ON)
|
||||
endmacro(find_llvm_parts)
|
||||
|
||||
# If this is a standalone build not running as an external project of LLVM
|
||||
# we need to later make some decisions differently.
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
# The intent is that this doesn't necessarily mean the LLVM is installed (it
|
||||
# could be a build directory), but it means we need to treat the LLVM
|
||||
# directory as read-only.
|
||||
set(LIBCXX_USING_INSTALLED_LLVM 1)
|
||||
endif()
|
||||
|
||||
if (LIBCXX_USING_INSTALLED_LLVM OR LIBCXX_STANDALONE_BUILD)
|
||||
set(LIBCXX_STANDALONE_BUILD 1)
|
||||
macro(configure_out_of_tree_llvm)
|
||||
message(STATUS "Configuring for standalone build.")
|
||||
set(LIBCXX_STANDALONE_BUILD 1)
|
||||
|
||||
find_llvm_parts()
|
||||
|
||||
# Add LLVM Functions --------------------------------------------------------
|
||||
if (LLVM_FOUND AND LIBCXX_USING_INSTALLED_LLVM)
|
||||
include(LLVMConfig) # For TARGET_TRIPLE
|
||||
else()
|
||||
if (WIN32)
|
||||
set(LLVM_ON_UNIX 0)
|
||||
set(LLVM_ON_WIN32 1)
|
||||
else()
|
||||
set(LLVM_ON_UNIX 1)
|
||||
set(LLVM_ON_WIN32 0)
|
||||
endif()
|
||||
endif()
|
||||
if (LLVM_FOUND)
|
||||
include(AddLLVM OPTIONAL)
|
||||
endif()
|
||||
|
||||
# LLVM Options --------------------------------------------------------------
|
||||
include(FindPythonInterp)
|
||||
if( NOT PYTHONINTERP_FOUND )
|
||||
@ -103,30 +111,11 @@ if (LIBCXX_USING_INSTALLED_LLVM OR LIBCXX_STANDALONE_BUILD)
|
||||
find_package(Sphinx REQUIRED)
|
||||
endif()
|
||||
|
||||
# FIXME - This is cribbed from HandleLLVMOptions.cmake.
|
||||
if(WIN32)
|
||||
if (LLVM_ON_UNIX AND NOT APPLE)
|
||||
set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
|
||||
else()
|
||||
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
|
||||
if(CYGWIN)
|
||||
set(LLVM_ON_WIN32 0)
|
||||
set(LLVM_ON_UNIX 1)
|
||||
else(CYGWIN)
|
||||
set(LLVM_ON_WIN32 1)
|
||||
set(LLVM_ON_UNIX 0)
|
||||
endif(CYGWIN)
|
||||
else(WIN32)
|
||||
if(UNIX)
|
||||
set(LLVM_ON_WIN32 0)
|
||||
set(LLVM_ON_UNIX 1)
|
||||
if(APPLE)
|
||||
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
|
||||
else(APPLE)
|
||||
set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
|
||||
endif(APPLE)
|
||||
else(UNIX)
|
||||
MESSAGE(SEND_ERROR "Unable to determine platform")
|
||||
endif(UNIX)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
endmacro(configure_out_of_tree_llvm)
|
||||
|
||||
# Add LLVM Functions --------------------------------------------------------
|
||||
include(AddLLVM OPTIONAL)
|
||||
endif()
|
||||
configure_out_of_tree_llvm()
|
||||
|
@ -10,14 +10,18 @@ set(LIBCXX_HEADER_PATTERN
|
||||
${LIBCXX_SUPPORT_HEADER_PATTERN}
|
||||
)
|
||||
|
||||
if(NOT LIBCXX_USING_INSTALLED_LLVM)
|
||||
file(COPY .
|
||||
DESTINATION "${LLVM_BINARY_DIR}/include/c++/v1"
|
||||
FILES_MATCHING
|
||||
${LIBCXX_HEADER_PATTERN}
|
||||
)
|
||||
if (LIBCXX_STANDALONE_BUILD)
|
||||
set(LIBCXX_BUILD_ROOT "${LIBCXX_BINARY_DIR}")
|
||||
else()
|
||||
set(LIBCXX_BUILD_ROOT "${LLVM_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
file(COPY .
|
||||
DESTINATION "${LIBCXX_BUILD_ROOT}/include/c++/v1"
|
||||
FILES_MATCHING
|
||||
${LIBCXX_HEADER_PATTERN}
|
||||
)
|
||||
|
||||
if (LIBCXX_INSTALL_HEADERS)
|
||||
install(DIRECTORY .
|
||||
DESTINATION include/c++/v1
|
||||
|
26
lib/abi/CMakeLists.txt
Normal file
26
lib/abi/CMakeLists.txt
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
# Detect if we are building in the same configuration used to generate
|
||||
# the abilist files.
|
||||
if (DEFINED TARGET_TRIPLE
|
||||
AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/${TARGET_TRIPLE}.abilist"
|
||||
AND TARGET cxx_shared
|
||||
AND "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi"
|
||||
AND NOT LIBCXX_ABI_UNSTABLE
|
||||
AND LIBCXX_ABI_VERSION EQUAL "1")
|
||||
set(LIBCXX_HAS_ABILIST_CONFIGURATION 1 CACHE "")
|
||||
else()
|
||||
if (NOT DEFINED LIBCXX_HAS_ABILIST_CONFIGURATION)
|
||||
message(STATUS "libc++ configuration differs from the abilist configuration. check-cxx-abilist target is not supported")
|
||||
endif()
|
||||
set(LIBCXX_HAS_ABILIST_CONFIGURATION 0 CACHE "")
|
||||
endif()
|
||||
|
||||
|
||||
if (LIBCXX_HAS_ABILIST_CONFIGURATION)
|
||||
set(ABILIST_FILE "${CMAKE_CURRENT_LIST_DIR}/${TARGET_TRIPLE}.abilist")
|
||||
set(SYMDIFF_EXE "${LIBCXX_SOURCE_DIR}/utils/sym_check/sym_diff.py")
|
||||
add_custom_target(check-cxx-abilist
|
||||
${SYMDIFF_EXE} ${ABILIST_FILE} $<TARGET_SONAME_FILE:cxx_shared>
|
||||
DEPENDS cxx_shared
|
||||
COMMENT "Testing ABI compatibility...")
|
||||
endif()
|
Loading…
Reference in New Issue
Block a user