Skip to content

Commit 4f90bf1

Browse files
author
ldionne
committed
[libc++] 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. Reviewers: rodgert, EricWF Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF Tags: #libc Differential Revision: https://reviews.llvm.org/D60480 git-svn-id: http://llvm.org/svn/llvm-project/libcxxabi/trunk@366593 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 4ab355f commit 4f90bf1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/CMakeLists.txt

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

150+
find_package(ParallelSTL QUIET)
151+
if (NOT TARGET pstl::ParallelSTL)
152+
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.")
153+
endif()
154+
150155
if ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "^(armv6|armv7|armv7s)$")
151156
set(LIBCXXABI_USE_SJLJ_EXCEPTIONS ON)
152157
else()
@@ -160,6 +165,9 @@ if (LIBCXXABI_ENABLE_SHARED)
160165
llvm_setup_rpath(cxxabi_shared)
161166
endif()
162167
target_link_libraries(cxxabi_shared PRIVATE ${LIBCXXABI_SHARED_LIBRARIES} ${LIBCXXABI_LIBRARIES})
168+
if (TARGET pstl::ParallelSTL)
169+
target_link_libraries(cxxabi_shared PUBLIC pstl::ParallelSTL)
170+
endif()
163171
set_target_properties(cxxabi_shared
164172
PROPERTIES
165173
CXX_EXTENSIONS
@@ -208,6 +216,9 @@ endif()
208216
if (LIBCXXABI_ENABLE_STATIC)
209217
add_library(cxxabi_static STATIC ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
210218
target_link_libraries(cxxabi_static PRIVATE ${LIBCXXABI_STATIC_LIBRARIES} ${LIBCXXABI_LIBRARIES})
219+
if (TARGET pstl::ParallelSTL)
220+
target_link_libraries(cxxabi_static PUBLIC pstl::ParallelSTL)
221+
endif()
211222
set_target_properties(cxxabi_static
212223
PROPERTIES
213224
CXX_EXTENSIONS

0 commit comments

Comments
 (0)