Skip to content

Commit 2c97dd6

Browse files
ldionneliujinye-sys
authored andcommitted
[libc++] Take 2: Integrate the PSTL into libc++
Summary: This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when configuring libc++ in CMake. When that option is enabled, libc++ will assume that the PSTL can be found somewhere on the CMake module path, and it will provide the C++17 parallel algorithms based on the PSTL (that is assumed to be available). The commit also adds support for running the PSTL tests as part of the libc++ test suite. The first attempt to commit this failed because it exposed a bug in the tests for modules. Now that this has been fixed, it should be safe to commit this. Reviewers: EricWF Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF Tags: #libc Differential Revision: https://reviews.llvm.org/D60480 llvm-svn: 367903
1 parent 1d254fc commit 2c97dd6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ if (LLVM_ENABLE_MODULES)
147147
string(REPLACE "-Wl,-z,defs" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
148148
endif()
149149

150+
if (NOT TARGET pstl::ParallelSTL)
151+
message(STATUS "Could not find ParallelSTL, libc++abi will not attempt to use it but the build may fail if the libc++ in use needs it to be available.")
152+
endif()
153+
150154
if ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "^(armv6|armv7|armv7s)$")
151155
set(LIBCXXABI_USE_SJLJ_EXCEPTIONS ON)
152156
else()
@@ -160,6 +164,9 @@ if (LIBCXXABI_ENABLE_SHARED)
160164
llvm_setup_rpath(cxxabi_shared)
161165
endif()
162166
target_link_libraries(cxxabi_shared PRIVATE ${LIBCXXABI_SHARED_LIBRARIES} ${LIBCXXABI_LIBRARIES})
167+
if (TARGET pstl::ParallelSTL)
168+
target_link_libraries(cxxabi_shared PUBLIC pstl::ParallelSTL)
169+
endif()
163170
set_target_properties(cxxabi_shared
164171
PROPERTIES
165172
CXX_EXTENSIONS
@@ -208,6 +215,9 @@ endif()
208215
if (LIBCXXABI_ENABLE_STATIC)
209216
add_library(cxxabi_static STATIC ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
210217
target_link_libraries(cxxabi_static PRIVATE ${LIBCXXABI_STATIC_LIBRARIES} ${LIBCXXABI_LIBRARIES})
218+
if (TARGET pstl::ParallelSTL)
219+
target_link_libraries(cxxabi_static PUBLIC pstl::ParallelSTL)
220+
endif()
211221
set_target_properties(cxxabi_static
212222
PROPERTIES
213223
CXX_EXTENSIONS

0 commit comments

Comments
 (0)