forked from OSchip/llvm-project
[libc++] Fix the runtimes build after making __config_site mandatory
The runtimes build includes libcxx/include/CMakeLists.txt directly instead
of going through the top-level CMake file. This not-very-hygienic inclusion
caused some variables like LIBCXX_BINARY_DIR not to be defined properly,
and the config_site generation logic to fail after landing 53623d4aa7
.
This patch works around this issue by defining the missing variables.
However, the proper fix for this would be for the runtimes build to
always go through libc++'s top-level CMakeLists.txt. Doing otherwise
is unsupported.
This commit is contained in:
parent
70165bb7e9
commit
05c552ad05
|
@ -873,16 +873,13 @@ if (DEFINED WIN32 AND LIBCXX_ENABLE_STATIC AND NOT LIBCXX_ENABLE_SHARED)
|
|||
config_define(ON _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
endif()
|
||||
|
||||
set(site_config_path "${LIBCXX_BINARY_DIR}/__config_site")
|
||||
configure_file("include/__config_site.in"
|
||||
"${site_config_path}"
|
||||
@ONLY)
|
||||
|
||||
# We generate a __config_site header (see libcxx/include/CMakeLists.txt) and
|
||||
# we make sure to include it when building the library.
|
||||
function(cxx_add_config_site target)
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
|
||||
target_compile_options(${target} PUBLIC /FI "${site_config_path}")
|
||||
target_compile_options(${target} PUBLIC /FI "${LIBCXX_BINARY_DIR}/__config_site")
|
||||
else()
|
||||
target_compile_options(${target} PUBLIC -include "${site_config_path}")
|
||||
target_compile_options(${target} PUBLIC -include "${LIBCXX_BINARY_DIR}/__config_site")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
|
|
@ -184,6 +184,10 @@ if(LIBCXX_INSTALL_SUPPORT_HEADERS)
|
|||
)
|
||||
endif()
|
||||
|
||||
configure_file("__config_site.in"
|
||||
"${LIBCXX_BINARY_DIR}/__config_site"
|
||||
@ONLY)
|
||||
|
||||
# Generate a custom __config header. The new header is created
|
||||
# by prepending __config_site to the current __config header.
|
||||
add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config
|
||||
|
|
|
@ -222,6 +222,8 @@ else() # if this is included from LLVM's CMake
|
|||
if (LLVM_EXTERNAL_LIBCXX_SOURCE_DIR AND "libcxx" IN_LIST LLVM_ENABLE_RUNTIMES)
|
||||
# This looks wrong, but libcxx's build actually wants the header dir to be
|
||||
# the root build dir, not the include directory.
|
||||
set(LIBCXX_BINARY_DIR ${LLVM_BINARY_DIR})
|
||||
set(LIBCXX_SOURCE_DIR ${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR})
|
||||
set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
|
||||
set(CXX_HEADER_TARGET runtime-libcxx-headers)
|
||||
add_subdirectory(${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR}/include ${CXX_HEADER_TARGET})
|
||||
|
|
Loading…
Reference in New Issue