llvm-project/libcxx/include/CMakeLists.txt

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

267 lines
5.6 KiB
CMake
Raw Normal View History

set(files
__availability
__bit_reference
__bits
__bsd_locale_defaults.h
__bsd_locale_fallbacks.h
__config
__debug
__errc
__functional_03
__functional_base
__functional_base_03
__hash_table
__iterator/concepts.h
__iterator/incrementable_traits.h
__iterator/iter_move.h
__iterator/iterator_traits.h
__iterator/readable_traits.h
__libcpp_version
__locale
__memory/addressof.h
__memory/allocation_guard.h
__memory/allocator.h
__memory/allocator_traits.h
__memory/auto_ptr.h
__memory/compressed_pair.h
__memory/construct_at.h
__memory/pointer_safety.h
__memory/pointer_traits.h
__memory/raw_storage_iterator.h
__memory/shared_ptr.h
__memory/temporary_buffer.h
__memory/uninitialized_algorithms.h
__memory/unique_ptr.h
__mutex_base
__node_handle
__nullptr
__ranges/access.h
__ranges/concepts.h
__ranges/enable_borrowed_range.h
__split_buffer
__sso_allocator
__std_stream
__string
__threading_support
__tree
__tuple
__undef_macros
__utility/to_underlying.h
algorithm
any
array
atomic
barrier
bit
bitset
cassert
ccomplex
cctype
cerrno
cfenv
cfloat
charconv
chrono
cinttypes
ciso646
climits
clocale
cmath
codecvt
compare
complex
complex.h
concepts
condition_variable
csetjmp
csignal
cstdarg
cstdbool
cstddef
cstdint
cstdio
cstdlib
cstring
ctgmath
ctime
ctype.h
cwchar
cwctype
deque
errno.h
exception
execution
experimental/__config
experimental/__memory
experimental/algorithm
experimental/coroutine
experimental/deque
experimental/filesystem
experimental/forward_list
experimental/functional
experimental/iterator
experimental/list
experimental/map
experimental/memory_resource
experimental/propagate_const
experimental/regex
experimental/set
experimental/simd
experimental/string
experimental/type_traits
experimental/unordered_map
experimental/unordered_set
experimental/utility
experimental/vector
ext/__hash
ext/hash_map
ext/hash_set
fenv.h
filesystem
float.h
format
forward_list
fstream
functional
future
initializer_list
inttypes.h
iomanip
ios
iosfwd
iostream
istream
iterator
latch
limits
limits.h
list
locale
locale.h
map
math.h
memory
module.modulemap
mutex
new
numbers
numeric
optional
ostream
queue
random
ranges
ratio
ranges
regex
scoped_allocator
semaphore
set
setjmp.h
shared_mutex
span
sstream
stack
stdbool.h
stddef.h
stdexcept
stdint.h
stdio.h
stdlib.h
streambuf
string
string.h
string_view
strstream
__support/android/locale_bionic.h
__support/fuchsia/xlocale.h
__support/ibm/gettod_zos.h
__support/ibm/limits.h
__support/ibm/locale_mgmt_aix.h
__support/ibm/locale_mgmt_zos.h
__support/ibm/nanosleep.h
__support/ibm/support.h
__support/ibm/xlocale.h
__support/musl/xlocale.h
__support/newlib/xlocale.h
__support/nuttx/xlocale.h
__support/openbsd/xlocale.h
__support/solaris/floatingpoint.h
__support/solaris/wchar.h
__support/solaris/xlocale.h
__support/win32/limits_msvc_win32.h
__support/win32/locale_win32.h
__support/xlocale/__nop_locale_mgmt.h
__support/xlocale/__posix_l_fallback.h
__support/xlocale/__strtonum_fallback.h
system_error
tgmath.h
thread
tuple
type_traits
typeindex
typeinfo
unordered_map
unordered_set
utility
valarray
variant
vector
version
wchar.h
wctype.h
)
configure_file("__config_site.in" "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}/__config_site" @ONLY)
set(_all_includes "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}/__config_site")
foreach(f ${files})
set(src "${CMAKE_CURRENT_SOURCE_DIR}/${f}")
set(dst "${LIBCXX_GENERATED_INCLUDE_DIR}/${f}")
add_custom_command(OUTPUT ${dst}
DEPENDS ${src}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
COMMENT "Copying CXX header ${f}")
list(APPEND _all_includes "${dst}")
endforeach()
add_custom_target(generate-cxx-headers ALL DEPENDS ${_all_includes})
add_library(cxx-headers INTERFACE)
add_dependencies(cxx-headers generate-cxx-headers ${LIBCXX_CXX_ABI_HEADER_TARGET})
# TODO: Use target_include_directories once we figure out why that breaks the runtimes build
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
target_compile_options(cxx-headers INTERFACE /I${LIBCXX_GENERATED_INCLUDE_DIR}
INTERFACE /I${LIBCXX_GENERATED_INCLUDE_TARGET_DIR})
else()
target_compile_options(cxx-headers INTERFACE -I${LIBCXX_GENERATED_INCLUDE_DIR}
INTERFACE -I${LIBCXX_GENERATED_INCLUDE_TARGET_DIR})
endif()
if (LIBCXX_INSTALL_HEADERS)
foreach(file ${files})
get_filename_component(dir ${file} DIRECTORY)
install(FILES ${file}
DESTINATION ${LIBCXX_INSTALL_INCLUDE_DIR}/${dir}
COMPONENT cxx-headers
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endforeach()
# Install the generated __config_site.
install(FILES ${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}/__config_site
DESTINATION ${LIBCXX_INSTALL_INCLUDE_TARGET_DIR}
[libc++] Always generate a __config_site header Before this patch, the __config_site header was only generated when at least one __config_site macro needed to be defined. This lead to two different code paths in how libc++ is configured, depending on whether a __config_site header was generated or not. After this patch, the __config_site is always generated, but it can be empty in case there are no macros to define in it. More context on why this change is important -------------------------------------------- In addition to being confusing, this double-code-path situation lead to broken code being checked in undetected in 2405bd689815, which introduced the LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT CMake setting. Specifically, the _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT <__config_site> macro was supposed NOT to be defined unless LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT was specified explicitly on the CMake command line. Instead, what happened is that it was defined to 0 if it wasn't specified explicitly and a <__config_site> header was generated. And defining that macro to 0 had the important effect of using the non-unique RTTI comparison implementation, which changes the ABI. This change in behavior wasn't noticed because the <__config_site> header is not generated by default. However, the Apple configuration does cause a <__config_site> header to be generated, which lead to the wrong RTTI implementation being used, and to https://llvm.org/PR45549. We came close to an ABI break in the dylib, but were saved due to a downstream-only change that overrode the decision of the <__config_site> for the purpose of RTTI comparisons in libc++abi. This is an incredible luck that we should not rely on ever again. While the problem itself was fixed with 2464d8135e2a by setting LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT explicitly in the Apple CMake cache and then in d0fcdcd28f95 by making the setting less brittle, the point still is that we should have had a single code path from the beginning. Unlike most normal libraries, the macros that configure libc++ are really complex, there's a lot of them and they control important properties of the C++ runtime. There must be a single code path for that, and it must be simple and robust. Differential Revision: https://reviews.llvm.org/D80927
2020-05-16 02:54:27 +08:00
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
COMPONENT cxx-headers)
if (NOT CMAKE_CONFIGURATION_TYPES)
add_custom_target(install-cxx-headers
DEPENDS cxx-headers
COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_COMPONENT=cxx-headers
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
# Stripping is a no-op for headers
add_custom_target(install-cxx-headers-stripped DEPENDS install-cxx-headers)
endif()
endif()