diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -5785,4 +5785,14 @@ _LIBCPP_POP_MACROS +// If has already been included, pull in implementations, +// otherwise just pull in forward declarations. +#include +#if defined(__PSTL_EXECUTION_POLICIES_DEFINED) +# include +#else +# include +# define __PSTL_ALGORITHM_FORWARD_DECLARED 1 +#endif + #endif // _LIBCPP_ALGORITHM diff --git a/libcxx/include/execution b/libcxx/include/execution new file mode 100644 --- /dev/null +++ b/libcxx/include/execution @@ -0,0 +1,32 @@ +// -*- C++ -*- +//===------------------------- execution ---------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_EXECUTION +#define _LIBCPP_EXECUTION + +#include +#include + +#define __PSTL_EXECUTION_POLICIES_DEFINED 1 + +#if defined(__PSTL_ALGORITHM_FORWARD_DECLARED) +# include +#endif + +#if defined(__PSTL_MEMORY_FORWARD_DECLARED) +# include +#endif + +#if defined(__PSTL_NUMERIC_FORWARD_DECLARED) +# include +#endif + +#include + +#endif /* _LIBCPP_EXECUTION */ diff --git a/libcxx/include/memory b/libcxx/include/memory --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -5672,4 +5672,14 @@ _LIBCPP_POP_MACROS +// If has already been included, pull in implementations, +// otherwise just pull in forward declarations. +#include +#if defined(__PSTL_EXECUTION_POLICIES_DEFINED) +# include +#else +# include +# define __PSTL_MEMORY_FORWARD_DECLARED 1 +#endif + #endif // _LIBCPP_MEMORY diff --git a/libcxx/include/numeric b/libcxx/include/numeric --- a/libcxx/include/numeric +++ b/libcxx/include/numeric @@ -558,4 +558,14 @@ _LIBCPP_POP_MACROS +// If has already been included, pull in implementations, +// otherwise just pull in forward declarations. +#include +#if defined(__PSTL_EXECUTION_POLICIES_DEFINED) +# include +#else +# include +# define __PSTL_NUMERIC_FORWARD_DECLARED 1 +#endif + #endif // _LIBCPP_NUMERIC diff --git a/libcxx/lib/CMakeLists.txt b/libcxx/lib/CMakeLists.txt --- a/libcxx/lib/CMakeLists.txt +++ b/libcxx/lib/CMakeLists.txt @@ -122,6 +122,11 @@ add_library_flags(iso_stdio_wide_specifiers) endif() +find_package(ParallelSTL) +if (NOT TARGET pstl::ParallelSTL) + message(FATAL_ERROR "Could not find ParallelSTL") +endif() + function(cxx_set_common_defines name) if(LIBCXX_CXX_ABI_HEADER_TARGET) add_dependencies(${name} ${LIBCXX_CXX_ABI_HEADER_TARGET}) @@ -148,6 +153,10 @@ # in printf, scanf. _CRT_STDIO_ISO_WIDE_SPECIFIERS) endif() + + if (TARGET pstl::ParallelSTL) + target_link_libraries(${name} PUBLIC pstl::ParallelSTL) + endif() endfunction() split_list(LIBCXX_COMPILE_FLAGS)