2015-03-31 12:15:45 +08:00
|
|
|
set(LIBCXX_LIB_CMAKEFILES_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}" PARENT_SCOPE)
|
|
|
|
|
2010-12-11 03:47:54 +08:00
|
|
|
# Get sources
|
2017-06-15 09:53:12 +08:00
|
|
|
# FIXME: Don't use glob here
|
2012-03-19 23:40:23 +08:00
|
|
|
file(GLOB LIBCXX_SOURCES ../src/*.cpp)
|
2011-09-23 03:10:18 +08:00
|
|
|
if(WIN32)
|
2012-03-19 23:40:23 +08:00
|
|
|
file(GLOB LIBCXX_WIN32_SOURCES ../src/support/win32/*.cpp)
|
|
|
|
list(APPEND LIBCXX_SOURCES ${LIBCXX_WIN32_SOURCES})
|
2014-11-26 05:57:41 +08:00
|
|
|
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
|
2016-10-19 00:54:59 +08:00
|
|
|
file(GLOB LIBCXX_SOLARIS_SOURCES ../src/support/solaris/*.cpp)
|
2014-11-26 05:57:41 +08:00
|
|
|
list(APPEND LIBCXX_SOURCES ${LIBCXX_SOLARIS_SOURCES})
|
2011-09-23 03:10:18 +08:00
|
|
|
endif()
|
2010-12-11 03:47:54 +08:00
|
|
|
|
|
|
|
# Add all the headers to the project for IDEs.
|
2015-12-17 07:41:05 +08:00
|
|
|
if (LIBCXX_CONFIGURE_IDE)
|
2012-03-19 23:40:23 +08:00
|
|
|
file(GLOB_RECURSE LIBCXX_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/*)
|
2011-09-23 03:10:18 +08:00
|
|
|
if(WIN32)
|
2012-03-19 23:40:23 +08:00
|
|
|
file( GLOB LIBCXX_WIN32_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/support/win32/*.h)
|
|
|
|
list(APPEND LIBCXX_HEADERS ${LIBCXX_WIN32_HEADERS})
|
2011-09-23 03:10:18 +08:00
|
|
|
endif()
|
2010-12-11 03:47:54 +08:00
|
|
|
# Force them all into the headers dir on MSVC, otherwise they end up at
|
|
|
|
# project scope because they don't have extensions.
|
|
|
|
if (MSVC_IDE)
|
2012-03-19 23:40:23 +08:00
|
|
|
source_group("Header Files" FILES ${LIBCXX_HEADERS})
|
2010-12-11 03:47:54 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2015-12-04 02:52:54 +08:00
|
|
|
if(NOT LIBCXX_INSTALL_LIBRARY)
|
|
|
|
set(exclude_from_all EXCLUDE_FROM_ALL)
|
|
|
|
endif()
|
|
|
|
|
2017-01-04 13:49:55 +08:00
|
|
|
# If LIBCXX_CXX_ABI_LIBRARY_PATH is defined we want to add it to the search path.
|
|
|
|
add_link_flags_if(LIBCXX_CXX_ABI_LIBRARY_PATH
|
|
|
|
"${CMAKE_LIBRARY_PATH_FLAG}${LIBCXX_CXX_ABI_LIBRARY_PATH}")
|
2015-07-30 05:07:28 +08:00
|
|
|
|
2017-03-11 11:24:18 +08:00
|
|
|
|
|
|
|
if (LIBCXX_GENERATE_COVERAGE AND NOT LIBCXX_COVERAGE_LIBRARY)
|
|
|
|
find_compiler_rt_library(profile LIBCXX_COVERAGE_LIBRARY)
|
|
|
|
endif()
|
2015-07-31 06:30:34 +08:00
|
|
|
add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
|
|
|
|
|
2016-10-10 05:34:03 +08:00
|
|
|
if (APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR
|
2017-01-03 09:18:48 +08:00
|
|
|
LIBCXX_CXX_ABI_LIBNAME STREQUAL "default"))
|
2018-11-28 04:59:47 +08:00
|
|
|
set(LIBCXX_OSX_REEXPORT_LIBCXXABI_SYMBOLS ON)
|
2016-10-10 05:34:03 +08:00
|
|
|
endif()
|
|
|
|
|
2018-07-24 15:06:17 +08:00
|
|
|
if (LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY)
|
2016-10-08 18:27:45 +08:00
|
|
|
add_library_flags("-Wl,--whole-archive" "-Wl,-Bstatic")
|
|
|
|
add_library_flags("${LIBCXX_CXX_ABI_LIBRARY}")
|
|
|
|
add_library_flags("-Wl,-Bdynamic" "-Wl,--no-whole-archive")
|
2018-11-28 04:59:47 +08:00
|
|
|
elseif (LIBCXX_OSX_REEXPORT_LIBCXXABI_SYMBOLS)
|
2016-10-08 18:27:45 +08:00
|
|
|
add_library_flags("${LIBCXX_CXX_ABI_LIBRARY}")
|
2016-10-10 05:34:03 +08:00
|
|
|
else ()
|
|
|
|
add_interface_library("${LIBCXX_CXX_ABI_LIBRARY}")
|
2016-10-08 18:27:45 +08:00
|
|
|
endif()
|
2010-12-11 03:47:54 +08:00
|
|
|
|
2015-07-22 08:33:36 +08:00
|
|
|
if (APPLE AND LLVM_USE_SANITIZER)
|
2016-09-15 19:04:53 +08:00
|
|
|
if (("${LLVM_USE_SANITIZER}" STREQUAL "Address") OR
|
|
|
|
("${LLVM_USE_SANITIZER}" STREQUAL "Address;Undefined") OR
|
|
|
|
("${LLVM_USE_SANITIZER}" STREQUAL "Undefined;Address"))
|
2015-07-22 08:33:36 +08:00
|
|
|
set(LIBFILE "libclang_rt.asan_osx_dynamic.dylib")
|
|
|
|
elseif("${LLVM_USE_SANITIZER}" STREQUAL "Undefined")
|
|
|
|
set(LIBFILE "libclang_rt.ubsan_osx_dynamic.dylib")
|
2016-09-14 22:12:50 +08:00
|
|
|
elseif("${LLVM_USE_SANITIZER}" STREQUAL "Thread")
|
|
|
|
set(LIBFILE "libclang_rt.tsan_osx_dynamic.dylib")
|
2015-07-22 08:33:36 +08:00
|
|
|
else()
|
|
|
|
message(WARNING "LLVM_USE_SANITIZER=${LLVM_USE_SANITIZER} is not supported on OS X")
|
|
|
|
endif()
|
|
|
|
if (LIBFILE)
|
2017-03-11 11:24:18 +08:00
|
|
|
find_compiler_rt_dir(LIBDIR)
|
2015-07-22 08:33:36 +08:00
|
|
|
if (NOT IS_DIRECTORY "${LIBDIR}")
|
|
|
|
message(FATAL_ERROR "Cannot find compiler-rt directory on OS X required for LLVM_USE_SANITIZER")
|
|
|
|
endif()
|
|
|
|
set(LIBCXX_SANITIZER_LIBRARY "${LIBDIR}/${LIBFILE}")
|
|
|
|
set(LIBCXX_SANITIZER_LIBRARY "${LIBCXX_SANITIZER_LIBRARY}" PARENT_SCOPE)
|
|
|
|
message(STATUS "Manually linking compiler-rt library: ${LIBCXX_SANITIZER_LIBRARY}")
|
2015-07-31 06:30:34 +08:00
|
|
|
add_library_flags("${LIBCXX_SANITIZER_LIBRARY}")
|
|
|
|
add_link_flags("-Wl,-rpath,${LIBDIR}")
|
2015-07-22 08:33:36 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2016-10-08 18:27:45 +08:00
|
|
|
# Generate private library list.
|
2015-07-31 06:30:34 +08:00
|
|
|
add_library_flags_if(LIBCXX_HAS_PTHREAD_LIB pthread)
|
|
|
|
add_library_flags_if(LIBCXX_HAS_C_LIB c)
|
|
|
|
add_library_flags_if(LIBCXX_HAS_M_LIB m)
|
|
|
|
add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
|
2017-04-06 06:53:05 +08:00
|
|
|
if (LIBCXX_USE_COMPILER_RT)
|
|
|
|
find_compiler_rt_library(builtins LIBCXX_BUILTINS_LIBRARY)
|
|
|
|
add_library_flags_if(LIBCXX_BUILTINS_LIBRARY "${LIBCXX_BUILTINS_LIBRARY}")
|
|
|
|
else()
|
|
|
|
add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
|
|
|
|
endif()
|
2016-07-18 14:01:50 +08:00
|
|
|
add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic)
|
2017-09-05 03:46:53 +08:00
|
|
|
add_library_flags_if(MINGW "${MINGW_LIBRARIES}")
|
2015-03-31 12:15:45 +08:00
|
|
|
|
2016-10-08 18:27:45 +08:00
|
|
|
# Add the unwinder library.
|
|
|
|
if (LIBCXXABI_USE_LLVM_UNWINDER)
|
2017-02-09 10:19:43 +08:00
|
|
|
if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
|
2016-10-10 05:34:03 +08:00
|
|
|
add_interface_library(unwind_shared)
|
2017-02-09 10:19:43 +08:00
|
|
|
elseif (LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_static OR HAVE_LIBUNWIND))
|
2016-10-10 05:34:03 +08:00
|
|
|
add_interface_library(unwind_static)
|
|
|
|
else()
|
|
|
|
add_interface_library(unwind)
|
|
|
|
endif()
|
2016-10-08 18:27:45 +08:00
|
|
|
endif()
|
|
|
|
|
2010-12-11 03:47:54 +08:00
|
|
|
# Setup flags.
|
2016-09-02 04:49:54 +08:00
|
|
|
if (NOT WIN32)
|
|
|
|
add_flags_if_supported(-fPIC)
|
|
|
|
endif()
|
2017-01-14 15:54:39 +08:00
|
|
|
|
2015-07-31 06:30:34 +08:00
|
|
|
add_link_flags_if_supported(-nodefaultlibs)
|
2010-12-11 03:47:54 +08:00
|
|
|
|
2017-01-14 14:06:47 +08:00
|
|
|
if (LIBCXX_TARGETING_MSVC)
|
2017-01-14 15:54:39 +08:00
|
|
|
if (LIBCXX_DEBUG_BUILD)
|
|
|
|
set(LIB_SUFFIX "d")
|
|
|
|
else()
|
|
|
|
set(LIB_SUFFIX "")
|
|
|
|
endif()
|
2017-01-14 14:06:47 +08:00
|
|
|
add_compile_flags(/Zl)
|
|
|
|
add_link_flags(/nodefaultlib)
|
2017-01-14 15:54:39 +08:00
|
|
|
|
|
|
|
add_library_flags(ucrt${LIB_SUFFIX}) # Universal C runtime
|
|
|
|
add_library_flags(vcruntime${LIB_SUFFIX}) # C++ runtime
|
|
|
|
add_library_flags(msvcrt${LIB_SUFFIX}) # C runtime startup files
|
[libc++] Implement exception_ptr on Windows
Summary:
This patch implements exception_ptr on Windows using the `__ExceptionPtrFoo` functions provided by MSVC.
The `__ExceptionPtrFoo` functions are defined inside the C++ standard library, `msvcprt`, which is unfortunate because it requires libc++ to link to the MSVC STL. However this doesn't seem to cause any immediate problems. However to be safe I kept all usages within the libc++ dylib so that user programs wouldn't have to link to MSVCPRT as well.
Note there are still 2 outstanding exception_ptr/nested_exception test failures.
* `current_exception.pass.cpp` needs to be rewritten for the Windows exception_ptr semantics which copy the exception every time.
* `rethrow_if_nested.pass.cpp` need investigation. It hits a stack overflow, likely from recursion.
This patch also gets most of the `<future>` tests passing as well.
Reviewers: mclow.lists, compnerd, bcraig, rmaprath, majnemer, BillyONeal, STL_MSFT
Subscribers: mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D32927
llvm-svn: 302393
2017-05-08 09:17:50 +08:00
|
|
|
add_library_flags(msvcprt${LIB_SUFFIX}) # C++ standard library. Required for exception_ptr internals.
|
2017-01-14 14:06:47 +08:00
|
|
|
# Required for standards-complaint wide character formatting functions
|
|
|
|
# (e.g. `printfw`/`scanfw`)
|
|
|
|
add_library_flags(iso_stdio_wide_specifiers)
|
|
|
|
endif()
|
|
|
|
|
2018-11-28 04:59:47 +08:00
|
|
|
if (LIBCXX_OSX_REEXPORT_LIBCXXABI_SYMBOLS)
|
2015-02-21 10:26:24 +08:00
|
|
|
if (NOT DEFINED LIBCXX_LIBCPPABI_VERSION)
|
2016-06-15 05:55:14 +08:00
|
|
|
set(LIBCXX_LIBCPPABI_VERSION "2") # Default value
|
|
|
|
execute_process(
|
|
|
|
COMMAND xcrun --show-sdk-version
|
|
|
|
OUTPUT_VARIABLE sdk_ver
|
|
|
|
RESULT_VARIABLE res
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
if (res EQUAL 0)
|
|
|
|
message(STATUS "Found SDK version ${sdk_ver}")
|
|
|
|
string(REPLACE "10." "" sdk_ver "${sdk_ver}")
|
|
|
|
if (sdk_ver LESS 9)
|
|
|
|
set(LIBCXX_LIBCPPABI_VERSION "")
|
|
|
|
else()
|
|
|
|
set(LIBCXX_LIBCPPABI_VERSION "2")
|
|
|
|
endif()
|
|
|
|
endif()
|
2015-02-21 10:26:24 +08:00
|
|
|
endif()
|
|
|
|
|
2013-09-02 15:28:03 +08:00
|
|
|
if ( CMAKE_OSX_DEPLOYMENT_TARGET STREQUAL "10.6" )
|
2018-10-16 08:31:32 +08:00
|
|
|
message(FATAL_ERROR "Mac OSX 10.6 is not supported anymore as a deployment "
|
|
|
|
"target. If you need support for this, please contact "
|
|
|
|
"the libc++ maintainers.")
|
2013-09-02 15:28:03 +08:00
|
|
|
else()
|
2018-11-28 04:59:47 +08:00
|
|
|
if ("armv7" IN_LIST CMAKE_OSX_ARCHITECTURES)
|
|
|
|
set(RE_EXPORT_LIST "${CMAKE_CURRENT_SOURCE_DIR}/libc++sjlj-abi.exp")
|
2013-09-02 15:28:03 +08:00
|
|
|
else()
|
2018-11-28 04:59:47 +08:00
|
|
|
set(RE_EXPORT_LIST "${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
|
2013-09-02 15:28:03 +08:00
|
|
|
endif()
|
2015-07-31 06:30:34 +08:00
|
|
|
add_link_flags(
|
2013-09-02 15:28:03 +08:00
|
|
|
"-compatibility_version 1"
|
|
|
|
"-install_name /usr/lib/libc++.1.dylib"
|
2018-11-28 05:13:31 +08:00
|
|
|
"-Wl,-unexported_symbols_list,\"${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp\""
|
|
|
|
"-Wl,-reexported_symbols_list,\"${RE_EXPORT_LIST}\""
|
|
|
|
"-Wl,-force_symbols_not_weak_list,\"${CMAKE_CURRENT_SOURCE_DIR}/notweak.exp\""
|
|
|
|
"-Wl,-force_symbols_weak_list,\"${CMAKE_CURRENT_SOURCE_DIR}/weak.exp\"")
|
2018-11-28 04:59:47 +08:00
|
|
|
|
|
|
|
if (NOT LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS)
|
2018-11-28 05:13:31 +08:00
|
|
|
add_link_flags("-Wl,-reexported_symbols_list,\"${CMAKE_CURRENT_SOURCE_DIR}/libc++abi-new-delete.exp\"")
|
2018-11-28 04:59:47 +08:00
|
|
|
endif()
|
2013-09-02 15:28:03 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2015-07-31 06:30:34 +08:00
|
|
|
split_list(LIBCXX_COMPILE_FLAGS)
|
|
|
|
split_list(LIBCXX_LINK_FLAGS)
|
2013-09-02 15:28:03 +08:00
|
|
|
|
2019-01-06 14:14:31 +08:00
|
|
|
macro(cxx_object_library name)
|
|
|
|
cmake_parse_arguments(ARGS "" "" "DEFINES;FLAGS" ${ARGN})
|
|
|
|
|
|
|
|
# Add an object library that contains the compiled source files.
|
|
|
|
add_library(${name} OBJECT ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
|
|
|
|
if(LIBCXX_CXX_ABI_HEADER_TARGET)
|
|
|
|
add_dependencies(${name} ${LIBCXX_CXX_ABI_HEADER_TARGET})
|
|
|
|
endif()
|
|
|
|
if(WIN32 AND NOT MINGW)
|
|
|
|
target_compile_definitions(${name}
|
|
|
|
PRIVATE
|
|
|
|
# Ignore the -MSC_VER mismatch, as we may build
|
|
|
|
# with a different compatibility version.
|
|
|
|
_ALLOW_MSC_VER_MISMATCH
|
|
|
|
# Don't check the msvcprt iterator debug levels
|
|
|
|
# as we will define the iterator types; libc++
|
|
|
|
# uses a different macro to identify the debug
|
|
|
|
# level.
|
|
|
|
_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH
|
|
|
|
# We are building the c++ runtime, don't pull in
|
|
|
|
# msvcprt.
|
|
|
|
_CRTBLD
|
|
|
|
# Don't warn on the use of "deprecated"
|
|
|
|
# "insecure" functions which are standards
|
|
|
|
# specified.
|
|
|
|
_CRT_SECURE_NO_WARNINGS
|
|
|
|
# Use the ISO conforming behaviour for conversion
|
|
|
|
# in printf, scanf.
|
|
|
|
_CRT_STDIO_ISO_WIDE_SPECIFIERS)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ARGS_DEFINES)
|
|
|
|
target_compile_definitions(${name} PRIVATE ${ARGS_DEFINES})
|
|
|
|
endif()
|
2016-08-09 06:57:25 +08:00
|
|
|
|
2019-01-06 14:14:31 +08:00
|
|
|
set_target_properties(${name}
|
|
|
|
PROPERTIES
|
|
|
|
COMPILE_FLAGS ${LIBCXX_COMPILE_FLAGS}
|
|
|
|
)
|
|
|
|
|
|
|
|
if(ARGS_FLAGS)
|
|
|
|
target_compile_options(${name} PRIVATE ${ARGS_FLAGS})
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
if(LIBCXX_HERMETIC_STATIC_LIBRARY)
|
|
|
|
append_flags_if_supported(CXX_STATIC_OBJECTS_FLAGS -fvisibility=hidden)
|
|
|
|
append_flags_if_supported(CXX_STATIC_OBJECTS_FLAGS -fvisibility-global-new-delete-hidden)
|
|
|
|
cxx_object_library(cxx_static_objects
|
|
|
|
DEFINES _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
|
|
|
|
FLAGS ${CXX_STATIC_OBJECTS_FLAGS})
|
|
|
|
cxx_object_library(cxx_shared_objects)
|
|
|
|
set(cxx_static_sources $<TARGET_OBJECTS:cxx_static_objects>)
|
|
|
|
set(cxx_shared_sources $<TARGET_OBJECTS:cxx_shared_objects>)
|
|
|
|
else()
|
|
|
|
cxx_object_library(cxx_objects)
|
|
|
|
set(cxx_static_sources $<TARGET_OBJECTS:cxx_objects>)
|
|
|
|
set(cxx_shared_sources $<TARGET_OBJECTS:cxx_objects>)
|
|
|
|
endif()
|
2016-08-09 06:57:25 +08:00
|
|
|
|
|
|
|
# Build the shared library.
|
|
|
|
if (LIBCXX_ENABLE_SHARED)
|
2019-01-06 14:14:31 +08:00
|
|
|
add_library(cxx_shared SHARED ${cxx_shared_sources})
|
2018-01-28 02:55:30 +08:00
|
|
|
if(COMMAND llvm_setup_rpath)
|
2018-01-26 09:34:51 +08:00
|
|
|
llvm_setup_rpath(cxx_shared)
|
|
|
|
endif()
|
2016-10-10 05:34:03 +08:00
|
|
|
target_link_libraries(cxx_shared ${LIBCXX_LIBRARIES})
|
2016-08-09 06:57:25 +08:00
|
|
|
set_target_properties(cxx_shared
|
|
|
|
PROPERTIES
|
|
|
|
LINK_FLAGS "${LIBCXX_LINK_FLAGS}"
|
|
|
|
OUTPUT_NAME "c++"
|
|
|
|
VERSION "${LIBCXX_ABI_VERSION}.0"
|
|
|
|
SOVERSION "${LIBCXX_ABI_VERSION}"
|
2010-12-11 03:47:54 +08:00
|
|
|
)
|
2018-07-25 07:27:51 +08:00
|
|
|
list(APPEND LIBCXX_BUILD_TARGETS "cxx_shared")
|
|
|
|
if (LIBCXX_INSTALL_SHARED_LIBRARY)
|
|
|
|
list(APPEND LIBCXX_INSTALL_TARGETS "cxx_shared")
|
|
|
|
endif()
|
2017-01-03 05:09:19 +08:00
|
|
|
if(WIN32 AND NOT MINGW AND NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
|
|
|
|
# Since we most likely do not have a mt.exe replacement, disable the
|
|
|
|
# manifest bundling. This allows a normal cmake invocation to pass which
|
|
|
|
# will attempt to use the manifest tool to generate the bundled manifest
|
|
|
|
set_target_properties(cxx_shared PROPERTIES
|
|
|
|
APPEND_STRING PROPERTY LINK_FLAGS " /MANIFEST:NO")
|
|
|
|
endif()
|
2016-08-09 06:57:25 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Build the static library.
|
|
|
|
if (LIBCXX_ENABLE_STATIC)
|
2019-01-06 14:14:31 +08:00
|
|
|
add_library(cxx_static STATIC ${cxx_static_sources})
|
2016-10-10 05:34:03 +08:00
|
|
|
target_link_libraries(cxx_static ${LIBCXX_LIBRARIES})
|
2017-05-26 06:37:15 +08:00
|
|
|
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
|
2016-08-09 06:57:25 +08:00
|
|
|
set_target_properties(cxx_static
|
|
|
|
PROPERTIES
|
|
|
|
LINK_FLAGS "${LIBCXX_LINK_FLAGS}"
|
2017-05-26 06:37:15 +08:00
|
|
|
OUTPUT_NAME "c++"
|
2016-08-09 06:57:25 +08:00
|
|
|
)
|
2018-07-25 07:27:51 +08:00
|
|
|
list(APPEND LIBCXX_BUILD_TARGETS "cxx_static")
|
|
|
|
if (LIBCXX_INSTALL_STATIC_LIBRARY)
|
|
|
|
list(APPEND LIBCXX_INSTALL_TARGETS "cxx_static")
|
|
|
|
endif()
|
2016-11-19 03:53:45 +08:00
|
|
|
# Attempt to merge the libc++.a archive and the ABI library archive into one.
|
2018-07-24 15:06:17 +08:00
|
|
|
if (LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY)
|
2016-11-19 03:53:45 +08:00
|
|
|
set(MERGE_ARCHIVES_SEARCH_PATHS "")
|
|
|
|
if (LIBCXX_CXX_ABI_LIBRARY_PATH)
|
|
|
|
set(MERGE_ARCHIVES_SEARCH_PATHS "-L${LIBCXX_CXX_ABI_LIBRARY_PATH}")
|
|
|
|
endif()
|
2017-01-16 08:33:09 +08:00
|
|
|
if ((TARGET ${LIBCXX_CXX_ABI_LIBRARY}) OR
|
2017-07-19 03:48:02 +08:00
|
|
|
(${LIBCXX_CXX_ABI_LIBRARY} MATCHES "cxxabi(_static|_shared)?" AND HAVE_LIBCXXABI))
|
2018-07-24 15:06:17 +08:00
|
|
|
set(MERGE_ARCHIVES_ABI_TARGET "$<TARGET_LINKER_FILE:cxxabi_static>")
|
2016-11-19 03:53:45 +08:00
|
|
|
else()
|
2017-01-04 13:49:57 +08:00
|
|
|
set(MERGE_ARCHIVES_ABI_TARGET
|
|
|
|
"${CMAKE_STATIC_LIBRARY_PREFIX}${LIBCXX_CXX_ABI_LIBRARY}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
2016-11-19 03:53:45 +08:00
|
|
|
endif()
|
|
|
|
add_custom_command(TARGET cxx_static POST_BUILD
|
|
|
|
COMMAND
|
|
|
|
${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/merge_archives.py
|
|
|
|
ARGS
|
|
|
|
-o $<TARGET_LINKER_FILE:cxx_static>
|
2017-09-13 14:55:44 +08:00
|
|
|
--ar "${CMAKE_AR}"
|
2016-11-19 03:53:45 +08:00
|
|
|
"$<TARGET_LINKER_FILE:cxx_static>"
|
|
|
|
"${MERGE_ARCHIVES_ABI_TARGET}"
|
|
|
|
"${MERGE_ARCHIVES_SEARCH_PATHS}"
|
|
|
|
WORKING_DIRECTORY ${LIBCXX_BUILD_DIR}
|
|
|
|
)
|
|
|
|
endif()
|
2016-08-09 06:57:25 +08:00
|
|
|
endif()
|
|
|
|
|
2018-07-27 11:47:46 +08:00
|
|
|
# Add a meta-target for both libraries.
|
|
|
|
add_custom_target(cxx DEPENDS cxx-headers ${LIBCXX_BUILD_TARGETS})
|
|
|
|
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
if (LIBCXX_ENABLE_FILESYSTEM)
|
|
|
|
set(LIBCXX_FILESYSTEM_SOURCES
|
|
|
|
../src/filesystem/operations.cpp
|
|
|
|
../src/filesystem/directory_iterator.cpp)
|
|
|
|
|
|
|
|
# Filesystem uses __int128_t, which requires a definition of __muloi4 when
|
|
|
|
# compiled with UBSAN. This definition is not provided by libgcc_s, but is
|
|
|
|
# provided by compiler-rt. So we need to disable it to avoid having multiple
|
|
|
|
# definitions. See filesystem/int128_builtins.cpp.
|
|
|
|
if (NOT LIBCXX_USE_COMPILER_RT)
|
|
|
|
list(APPEND LIBCXX_FILESYSTEM_SOURCES ../src/filesystem/int128_builtins.cpp)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(cxx_filesystem STATIC ${LIBCXX_FILESYSTEM_SOURCES})
|
|
|
|
if (LIBCXX_ENABLE_SHARED)
|
|
|
|
target_link_libraries(cxx_filesystem cxx_shared)
|
|
|
|
else()
|
|
|
|
target_link_libraries(cxx_filesystem cxx_static)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(filesystem_flags "${LIBCXX_COMPILE_FLAGS}")
|
|
|
|
check_flag_supported(-std=c++14)
|
|
|
|
if (NOT MSVC AND LIBCXX_SUPPORTS_STD_EQ_CXX14_FLAG)
|
|
|
|
string(REPLACE "-std=c++11" "-std=c++14" filesystem_flags "${LIBCXX_COMPILE_FLAGS}")
|
|
|
|
endif()
|
|
|
|
set_target_properties(cxx_filesystem
|
|
|
|
PROPERTIES
|
|
|
|
COMPILE_FLAGS "${filesystem_flags}"
|
|
|
|
OUTPUT_NAME "c++fs"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2016-05-04 05:30:18 +08:00
|
|
|
if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
|
|
|
|
file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp)
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
add_library(cxx_experimental STATIC ${LIBCXX_EXPERIMENTAL_SOURCES})
|
2016-08-09 06:57:25 +08:00
|
|
|
if (LIBCXX_ENABLE_SHARED)
|
|
|
|
target_link_libraries(cxx_experimental cxx_shared)
|
|
|
|
else()
|
|
|
|
target_link_libraries(cxx_experimental cxx_static)
|
|
|
|
endif()
|
2016-05-11 00:17:43 +08:00
|
|
|
|
|
|
|
set(experimental_flags "${LIBCXX_COMPILE_FLAGS}")
|
|
|
|
check_flag_supported(-std=c++14)
|
|
|
|
if (NOT MSVC AND LIBCXX_SUPPORTS_STD_EQ_CXX14_FLAG)
|
|
|
|
string(REPLACE "-std=c++11" "-std=c++14" experimental_flags "${LIBCXX_COMPILE_FLAGS}")
|
|
|
|
endif()
|
2016-05-04 05:30:18 +08:00
|
|
|
set_target_properties(cxx_experimental
|
|
|
|
PROPERTIES
|
2016-05-11 00:17:43 +08:00
|
|
|
COMPILE_FLAGS "${experimental_flags}"
|
2016-05-04 05:30:18 +08:00
|
|
|
OUTPUT_NAME "c++experimental"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2017-01-07 04:05:40 +08:00
|
|
|
if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
|
[libcxx] Introduce an externally-threaded libc++ variant.
This patch further decouples libc++ from pthread, allowing libc++ to be built
against other threading systems. There are two main use cases:
- Building libc++ against a thread library other than pthreads.
- Building libc++ with an "external" thread API, allowing a separate library to
provide the implementation of that API.
The two use cases are quite similar, the second one being sligtly more
de-coupled than the first. The cmake option LIBCXX_HAS_EXTERNAL_THREAD_API
enables both kinds of builds. One needs to place an <__external_threading>
header file containing an implementation of the "libc++ thread API" declared
in the <__threading_support> header.
For the second use case, the implementation of the libc++ thread API can
delegate to a custom "external" thread API where the implementation of this
external API is provided in a seperate library. This mechanism allows toolchain
vendors to distribute a build of libc++ with a custom thread-porting-layer API
(which is the "external" API above), platform vendors (recipients of the
toolchain/libc++) are then required to provide their implementation of this API
to be linked with (end-user) C++ programs.
Note that the second use case still requires establishing the basic types that
get passed between the external thread library and the libc++ library
(e.g. __libcpp_mutex_t). These cannot be opaque pointer types (libc++ sources
won't compile otherwise). It should also be noted that the second use case can
have a slight performance penalty; as all the thread constructs need to cross a
library boundary through an additional function call.
When the header <__external_threading> is omitted, libc++ is built with the
"libc++ thread API" (declared in <__threading_support>) as the "external" thread
API (basic types are pthread based). An implementation (pthread based) of this
API is provided in test/support/external_threads.cpp, which is built into a
separate DSO and linked in when running the libc++ test suite. A test run
therefore demonstrates the second use case (less the intermediate custom API).
Differential revision: https://reviews.llvm.org/D21968
Reviewers: bcraig, compnerd, EricWF, mclow.lists
llvm-svn: 281179
2016-09-12 05:46:40 +08:00
|
|
|
file(GLOB LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES ../test/support/external_threads.cpp)
|
|
|
|
|
|
|
|
if (LIBCXX_ENABLE_SHARED)
|
|
|
|
add_library(cxx_external_threads SHARED ${LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES})
|
|
|
|
else()
|
|
|
|
add_library(cxx_external_threads STATIC ${LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set_target_properties(cxx_external_threads
|
|
|
|
PROPERTIES
|
|
|
|
LINK_FLAGS "${LIBCXX_LINK_FLAGS}"
|
|
|
|
COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
|
|
|
|
OUTPUT_NAME "c++external_threads"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2015-10-15 03:54:03 +08:00
|
|
|
# Generate a linker script inplace of a libc++.so symlink. Rerun this command
|
|
|
|
# after cxx builds.
|
2016-08-09 06:57:25 +08:00
|
|
|
if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
|
2015-10-15 03:54:03 +08:00
|
|
|
# Get the name of the ABI library and handle the case where CXXABI_LIBNAME
|
|
|
|
# is a target name and not a library. Ex cxxabi_shared.
|
2016-10-10 05:34:03 +08:00
|
|
|
set(LIBCXX_INTERFACE_LIBRARY_NAMES)
|
|
|
|
foreach(lib ${LIBCXX_INTERFACE_LIBRARIES})
|
|
|
|
# FIXME: Handle cxxabi_static and unwind_static.
|
2017-01-16 08:33:09 +08:00
|
|
|
if (TARGET ${lib} OR
|
|
|
|
(${lib} MATCHES "cxxabi(_static|_shared)?" AND HAVE_LIBCXXABI) OR
|
|
|
|
(${lib} MATCHES "unwind(_static|_shared)?" AND HAVE_LIBUNWIND))
|
2016-10-10 05:34:03 +08:00
|
|
|
list(APPEND LIBCXX_INTERFACE_LIBRARY_NAMES "$<TARGET_PROPERTY:${lib},OUTPUT_NAME>")
|
2016-10-09 10:49:31 +08:00
|
|
|
else()
|
2016-10-10 05:34:03 +08:00
|
|
|
list(APPEND LIBCXX_INTERFACE_LIBRARY_NAMES "${lib}")
|
2016-10-09 10:49:31 +08:00
|
|
|
endif()
|
|
|
|
endforeach()
|
2016-10-10 05:34:03 +08:00
|
|
|
#split_list(LIBCXX_INTERFACE_LIBRARY_NAMES)
|
2015-10-15 03:54:03 +08:00
|
|
|
# Generate a linker script inplace of a libc++.so symlink. Rerun this command
|
|
|
|
# after cxx builds.
|
2016-08-09 06:57:25 +08:00
|
|
|
add_custom_command(TARGET cxx_shared POST_BUILD
|
2015-10-15 03:54:03 +08:00
|
|
|
COMMAND
|
2017-02-10 06:53:14 +08:00
|
|
|
${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/gen_link_script.py
|
2015-10-15 03:54:03 +08:00
|
|
|
ARGS
|
2016-08-09 06:57:25 +08:00
|
|
|
"$<TARGET_LINKER_FILE:cxx_shared>"
|
2016-10-10 05:34:03 +08:00
|
|
|
${LIBCXX_INTERFACE_LIBRARY_NAMES}
|
2015-10-15 03:54:03 +08:00
|
|
|
WORKING_DIRECTORY ${LIBCXX_BUILD_DIR}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2015-08-27 04:18:21 +08:00
|
|
|
if (LIBCXX_INSTALL_LIBRARY)
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
if (LIBCXX_INSTALL_FILESYSTEM_LIBRARY)
|
|
|
|
set(filesystem_lib cxx_filesystem)
|
|
|
|
endif()
|
2016-05-04 05:30:18 +08:00
|
|
|
if (LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
|
|
|
|
set(experimental_lib cxx_experimental)
|
|
|
|
endif()
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${filesystem_lib} ${experimental_lib}
|
2017-07-11 10:39:50 +08:00
|
|
|
LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
|
|
|
|
ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
|
2015-08-27 04:18:21 +08:00
|
|
|
)
|
2015-10-15 03:54:03 +08:00
|
|
|
# NOTE: This install command must go after the cxx install command otherwise
|
|
|
|
# it will not be executed after the library symlinks are installed.
|
2016-08-09 06:57:25 +08:00
|
|
|
if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
|
2015-10-23 05:24:01 +08:00
|
|
|
# Replace the libc++ filename with $<TARGET_LINKER_FILE:cxx>
|
|
|
|
# after we required CMake 3.0.
|
2015-10-23 15:04:24 +08:00
|
|
|
install(FILES "${LIBCXX_LIBRARY_DIR}/libc++${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
2017-07-11 10:39:50 +08:00
|
|
|
DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX}
|
2015-10-15 03:54:03 +08:00
|
|
|
COMPONENT libcxx)
|
|
|
|
endif()
|
2015-08-27 04:18:21 +08:00
|
|
|
endif()
|
2015-08-20 01:41:53 +08:00
|
|
|
|
2015-08-27 04:18:21 +08:00
|
|
|
if (NOT CMAKE_CONFIGURATION_TYPES AND (LIBCXX_INSTALL_LIBRARY OR
|
|
|
|
LIBCXX_INSTALL_HEADERS))
|
2015-12-04 02:52:54 +08:00
|
|
|
if(LIBCXX_INSTALL_LIBRARY)
|
2016-05-03 13:34:38 +08:00
|
|
|
set(lib_install_target cxx)
|
2015-12-04 02:52:54 +08:00
|
|
|
endif()
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
if (LIBCXX_INSTALL_FILESYSTEM_LIBRARY)
|
|
|
|
set(filesystem_lib_install_target cxx_filesystem)
|
|
|
|
endif()
|
2016-05-04 05:30:18 +08:00
|
|
|
if (LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
|
|
|
|
set(experimental_lib_install_target cxx_experimental)
|
|
|
|
endif()
|
2016-04-30 06:17:15 +08:00
|
|
|
if(LIBCXX_INSTALL_HEADERS)
|
2016-08-25 06:17:06 +08:00
|
|
|
set(header_install_target install-cxx-headers)
|
2016-04-30 06:17:15 +08:00
|
|
|
endif()
|
2016-08-25 06:17:06 +08:00
|
|
|
add_custom_target(install-cxx
|
2016-05-04 05:30:18 +08:00
|
|
|
DEPENDS ${lib_install_target}
|
|
|
|
${experimental_lib_install_target}
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
${filesystem_lib_install_target}
|
2016-05-04 05:30:18 +08:00
|
|
|
${header_install_target}
|
2015-08-27 04:18:21 +08:00
|
|
|
COMMAND "${CMAKE_COMMAND}"
|
2016-08-25 06:17:06 +08:00
|
|
|
-DCMAKE_INSTALL_COMPONENT=cxx
|
2015-08-27 04:18:21 +08:00
|
|
|
-P "${LIBCXX_BINARY_DIR}/cmake_install.cmake")
|
2017-12-07 05:03:42 +08:00
|
|
|
add_custom_target(install-cxx-stripped
|
|
|
|
DEPENDS ${lib_install_target}
|
|
|
|
${experimental_lib_install_target}
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
${filesystem_lib_install_target}
|
2017-12-07 05:03:42 +08:00
|
|
|
${header_install_target}
|
|
|
|
COMMAND "${CMAKE_COMMAND}"
|
|
|
|
-DCMAKE_INSTALL_COMPONENT=cxx
|
|
|
|
-DCMAKE_INSTALL_DO_STRIP=1
|
|
|
|
-P "${LIBCXX_BINARY_DIR}/cmake_install.cmake")
|
2016-08-25 06:17:06 +08:00
|
|
|
add_custom_target(install-libcxx DEPENDS install-cxx)
|
2015-08-20 01:41:53 +08:00
|
|
|
endif()
|