diff --git a/apps/WorkerSleepExample.cpp b/apps/WorkerSleepExample.cpp index 3d1379de773174164816353667dbfe5c36445ed5..481dba4a9f0eda9561379285de24c6e81130d135 100644 --- a/apps/WorkerSleepExample.cpp +++ b/apps/WorkerSleepExample.cpp @@ -1,7 +1,6 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // Copyright © 2020 Florian Schmaus #include <chrono> // for milliseconds, operator+, hig... -#include <compare> // for operator<, strong_ordering #include <cstdlib> // for exit, EXIT_SUCCESS #include <iostream> // for operator<<, basic_ostream, endl #include <ratio> // for ratio @@ -12,7 +11,12 @@ #include "Fiber.hpp" // for Fiber #include "Runtime.hpp" // for Runtime #include "emper-common.h" // for UNUSED_ARG, workerid_t -#include "emper.hpp" // for spawn +#include "emper-config.h" +#include "emper.hpp" // for spawn + +#ifdef EMPER_HAS_COMPARE_H +#include <compare> // for operator>=, strong_ordering +#endif static unsigned int ITERATIONS = 10; diff --git a/apps/fsearch/meson.build b/apps/fsearch/meson.build index 9dc41f5cd371ce8b35e49e38a193e21a98c557d1..68a9fd104a57380a525bb2171d2fc5a071682cfc 100644 --- a/apps/fsearch/meson.build +++ b/apps/fsearch/meson.build @@ -1,11 +1,18 @@ -fsearch_exe = executable( - 'fsearch', - 'fsearch.cpp', - dependencies: emper_dep, -) +walk_dir_code = '''#include <filesystem> +int main() { auto it = std::filesystem::recursive_directory_iterator("."); } +''' -fsearch_callback_exe = executable( - 'fsearch_callback', - 'fsearch_callback.cpp', - dependencies: emper_dep, -) +does_link = cpp_compiler.links(walk_dir_code, args: '--std=c++2a', name : 'walk_dir') +if does_link + fsearch_exe = executable( + 'fsearch', + 'fsearch.cpp', + dependencies: emper_dep, + ) + + fsearch_callback_exe = executable( + 'fsearch_callback', + 'fsearch_callback.cpp', + dependencies: emper_dep, + ) +endif diff --git a/meson.build b/meson.build index 8385425d316dca6f19deee3b3187f5b0c04141df..f2038dac7de9b11085af0dbd61ebd85ea052d182 100644 --- a/meson.build +++ b/meson.build @@ -26,6 +26,11 @@ if option_urcu emper_dependencies += [liburcu_dep] endif +cpp_compiler = meson.get_compiler('cpp') +if cpp_compiler.has_header('compare') + conf_data.set('EMPER_HAS_COMPARE_H', true) +endif + conf_data.set('EMPER_WORKER_SLEEP', get_option('worker_sleep')) conf_data.set('EMPER_WORKER_WAKEUP_STRATEGY', get_option('worker_wakeup_strategy')) conf_data.set('EMPER_LOCKED_WS_QUEUE', get_option('locked_ws_queue')) diff --git a/tests/AlarmFutureTest.cpp b/tests/AlarmFutureTest.cpp index 11dcad1c6d6fff5702ead2149d7b35970fa4d12c..b14830a48c871b63470181f5b8c21e544e8c4267 100644 --- a/tests/AlarmFutureTest.cpp +++ b/tests/AlarmFutureTest.cpp @@ -3,12 +3,16 @@ #include <cassert> // for assert #include <cerrno> // for ETIME #include <chrono> // for microseconds, duration_cast, operator- -#include <compare> // for operator>=, strong_ordering #include <cstdint> // for int32_t #include <cstdlib> // for exit, EXIT_SUCCESS +#include "emper-config.h" #include "io/Future.hpp" // for AlarmFuture +#ifdef EMPER_HAS_COMPARE_H +#include <compare> // for operator>=, strong_ordering +#endif + using emper::io::AlarmFuture; void emperTest() {