From 67e9d057931102d1931a4285fccda26ce93d0a6b Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Tue, 18 Jun 2024 16:46:54 -0700 Subject: [PATCH] try to get PSTL working with libc++ --- CMakeLists.txt | 2 +- src/utilities/include/par.h | 40 +++++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a2af1a33d..2e2edc77c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,7 @@ else() else() set(WARNING_FLAGS -Werror -Wall -Wno-sign-compare -Wno-unused) endif() - set(MANIFOLD_FLAGS ${MANIFOLD_FLAGS} ${WARNING_FLAGS}) + set(MANIFOLD_FLAGS ${MANIFOLD_FLAGS} ${WARNING_FLAGS} -fexperimental-library) endif() if(CODE_COVERAGE AND NOT MSVC) diff --git a/src/utilities/include/par.h b/src/utilities/include/par.h index 71f06a40e..4a7ed8b39 100644 --- a/src/utilities/include/par.h +++ b/src/utilities/include/par.h @@ -24,8 +24,7 @@ #include "thrust/transform_reduce.h" #if MANIFOLD_PAR == 'T' -#if MANIFOLD_PAR == 'T' && TBB_INTERFACE_VERSION >= 10000 && \ - __has_include() +#if MANIFOLD_PAR == 'T' && TBB_INTERFACE_VERSION >= 10000 && __has_include() #include #endif @@ -79,7 +78,7 @@ inline constexpr ExecutionPolicy autoPolicy(size_t size) { return thrust::NAME(thrust::cpp::par, args...); \ } -#if MANIFOLD_PAR == 'T' && __has_include() +#if MANIFOLD_PAR == 'T' && __has_include() #define STL_DYNAMIC_BACKEND(NAME, RET) \ template \ Ret NAME(ExecutionPolicy policy, Args... args) { \ @@ -139,15 +138,14 @@ template @@ -188,8 +186,6 @@ void sequence(ExecutionPolicy policy, Iterator first, Iterator last) { STL_DYNAMIC_BACKEND_VOID(for_each) STL_DYNAMIC_BACKEND_VOID(for_each_n) STL_DYNAMIC_BACKEND_VOID(transform) -STL_DYNAMIC_BACKEND_VOID(uninitialized_fill) -STL_DYNAMIC_BACKEND_VOID(uninitialized_copy) STL_DYNAMIC_BACKEND_VOID(stable_sort) STL_DYNAMIC_BACKEND_VOID(fill) STL_DYNAMIC_BACKEND_VOID(copy) @@ -206,6 +202,24 @@ STL_DYNAMIC_BACKEND(all_of, bool) STL_DYNAMIC_BACKEND(is_sorted, bool) STL_DYNAMIC_BACKEND(reduce, void) STL_DYNAMIC_BACKEND(count_if, int) + +#ifdef _LIBCPP_VERSION +template +void uninitialized_fill(ExecutionPolicy policy, Args... args) { + std::uninitialized_fill(args...); +} +template +void uninitialized_copy(ExecutionPolicy policy, Args... args) { + std::uninitialized_copy(args...); +} +template +Ret remove_if(ExecutionPolicy policy, Args... args) { + return std::remove_if(args...); +} +#else +STL_DYNAMIC_BACKEND_VOID(uninitialized_fill) +STL_DYNAMIC_BACKEND_VOID(uninitialized_copy) STL_DYNAMIC_BACKEND(remove_if, void) +#endif } // namespace manifold