From 679a2db566ba29d5acd55af2583ae8c398f07b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Gr=C3=B6n?= Date: Tue, 7 Feb 2023 16:25:43 +0100 Subject: [PATCH] Make the code build against libc++ on Linux `defined(__linux__)` does not imply that libstd++ is used. `#include ` does not define `std::ceil` in libc++. --- src/gausspoint/gpline.h | 2 +- src/mesh/gentools.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gausspoint/gpline.h b/src/gausspoint/gpline.h index f4afd9d6..b284b7d0 100755 --- a/src/gausspoint/gpline.h +++ b/src/gausspoint/gpline.h @@ -8,7 +8,7 @@ #define GPLINE_H #include -#include +#include #include #include "gausspoints.h" diff --git a/src/mesh/gentools.cpp b/src/mesh/gentools.cpp index 2278b707..33d1cba0 100755 --- a/src/mesh/gentools.cpp +++ b/src/mesh/gentools.cpp @@ -5,7 +5,7 @@ #include "lagrangeformfunction.h" #include "slmpi.h" -#if defined(__linux__) +#if defined(__linux__) && !defined(_LIBCPP_VERSION) #include #endif @@ -21,7 +21,7 @@ void gentools::stablecoordinatesort(std::vector noisethreshold, std::vec std::iota(reorderingvector.begin(), reorderingvector.end(), 0); // Sort 'reorderingvector' according to 'coordinates' with x > y > z priority order: // The < operator is overloaded by a lambda function. - #if defined(__linux__) + #if defined(__linux__) && !defined(_LIBCPP_VERSION) __gnu_parallel::sort(reorderingvector.begin(), reorderingvector.end(), [&](int elem1, int elem2) #else std::sort(reorderingvector.begin(), reorderingvector.end(), [&](int elem1, int elem2) @@ -276,7 +276,7 @@ void gentools::stablesort(std::vector& tosort, std::vector& reordering std::iota(reorderingvector.begin(), reorderingvector.end(), 0); // Sort 'reorderingvector' according to 'tosort': // The < operator is overloaded by a lambda function. - #if defined(__linux__) + #if defined(__linux__) && !defined(_LIBCPP_VERSION) __gnu_parallel::sort(reorderingvector.begin(), reorderingvector.end(), [&](int elem1, int elem2) #else std::sort(reorderingvector.begin(), reorderingvector.end(), [&](int elem1, int elem2) @@ -352,7 +352,7 @@ bool sortfun(const std::tuple& elem1, const std::tuple>& tosort) { // Parallel sort on Linux only for now: - #if defined(__linux__) + #if defined(__linux__) && !defined(_LIBCPP_VERSION) __gnu_parallel::sort(tosort.begin(), tosort.end(), sortfun); #else std::sort(tosort.begin(), tosort.end(), sortfun);