diff options
-rw-r--r-- | CMakeLists.txt | 65 | ||||
-rw-r--r-- | include/llfio/revision.hpp | 6 | ||||
m--------- | include/llfio/v2.0/outcome | 0 | ||||
m--------- | include/llfio/v2.0/quickcpplib | 0 | ||||
m--------- | test/kerneltest | 0 |
5 files changed, 53 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c1420f33..5e382ab7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,30 +119,65 @@ endif() include(QuickCppLibMakeDoxygen) # Set the standard definitions for these libraries and bring in the all_* helper functions include(QuickCppLibApplyDefaultDefinitions) + # Do we have the Coroutines TS? -function(CheckCXXHasCoroutines iter flags) - set(CMAKE_REQUIRED_FLAGS "${flags}") +function(CheckCXXHasCoroutines iter) + set(CMAKE_REQUIRED_FLAGS ${ARGN}) check_cxx_source_compiles(" -#include <future> -std::future<int> g() { co_return 0; } +#if __has_include(<coroutine>) +#include <coroutine> +using std::suspend_never; +#elif __has_include(<experimental/coroutine>) +#include <experimental/coroutine> +using std::experimental::suspend_never; +#endif +class resumable{ +public: + struct promise_type + { + resumable get_return_object() { return {}; } + auto initial_suspend() { return suspend_never(); } + auto final_suspend() { return suspend_never(); } + int return_value(int x) { return x; } + void unhandled_exception(); + }; + bool resume() { return true; } + int get() { return 0; } +}; +resumable g() { co_return 0; } int main() { return g().get(); } " CXX_HAS_COROUTINES${iter}) set(CXX_HAS_COROUTINES${iter} ${CXX_HAS_COROUTINES${iter}} PARENT_SCOPE) endfunction() include(CheckCXXSourceCompiles) -if(MSVC) - CheckCXXHasCoroutines(_MSVC "/await") - if(CXX_HAS_COROUTINES_MSVC) - all_compile_options(PUBLIC "/await") - all_compile_definitions(PUBLIC "LLFIO_HAVE_COROUTINES=1") - endif() +set(HAVE_COROUTINES 0) +CheckCXXHasCoroutines(_BY_DEFAULT) +if(CXX_HAS_COROUTINES_BY_DEFAULT) + set(HAVE_COROUTINES 1) endif() -if(CLANG OR GCC) - CheckCXXHasCoroutines(_CLANG_GCC "-fcoroutines-ts") - if(CXX_HAS_COROUTINES_CLANG_GCC) - all_compile_options(PUBLIC "-fcoroutines-ts") - all_compile_definitions(PUBLIC "LLFIO_HAVE_COROUTINES=1") +if(NOT HAVE_COROUTINES) + if(MSVC) + CheckCXXHasCoroutines(_MSVC "/await") + if(CXX_HAS_COROUTINES_MSVC) + add_compile_options("/await") + set(HAVE_COROUTINES 1) + endif() endif() + if(CLANG OR GCC) + CheckCXXHasCoroutines(_CLANG_GCC "-fcoroutines-ts") + if(CXX_HAS_COROUTINES_CLANG_GCC) + add_compile_options("-fcoroutines-ts") + set(HAVE_COROUTINES 1) + endif() + CheckCXXHasCoroutines(_CLANG_GCC_LIBCXX "-stdlib=libc++ -fcoroutines-ts") + if(CXX_HAS_COROUTINES_CLANG_GCC_LIBCXX) + add_compile_options("-stdlib=libc++ -fcoroutines-ts") + set(HAVE_COROUTINES 1) + endif() + endif() +endif() +if(HAVE_COROUTINES) + all_compile_definitions(PUBLIC "LLFIO_HAVE_COROUTINES=1") endif() # Set the C++ features this library requires diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp index 399796fa..08b07ba9 100644 --- a/include/llfio/revision.hpp +++ b/include/llfio/revision.hpp @@ -1,4 +1,4 @@ // Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time -#define LLFIO_PREVIOUS_COMMIT_REF a3942420524c91179009e06b9d77cfb4326dcf7f -#define LLFIO_PREVIOUS_COMMIT_DATE "2019-09-19 09:51:59 +00:00" -#define LLFIO_PREVIOUS_COMMIT_UNIQUE a3942420 +#define LLFIO_PREVIOUS_COMMIT_REF aea9a0bda5ffc7aac4ba5e8c6582893b7aad7d90 +#define LLFIO_PREVIOUS_COMMIT_DATE "2019-09-25 15:31:53 +00:00" +#define LLFIO_PREVIOUS_COMMIT_UNIQUE aea9a0bd diff --git a/include/llfio/v2.0/outcome b/include/llfio/v2.0/outcome -Subproject 90769c82ee9c1c11eef83d700108dfe3685a1cd +Subproject d50803be3e01d38bbeb91e9c6a0ae0fb86b7c68 diff --git a/include/llfio/v2.0/quickcpplib b/include/llfio/v2.0/quickcpplib -Subproject c035910c060880c9391ceb6af414bdef632df0c +Subproject 6541411a0d0fc4b4609ad70b803d59b82c33c81 diff --git a/test/kerneltest b/test/kerneltest -Subproject 489ff59aa243c748126961ed9f7fb237af6d4ca +Subproject 75783829f711cd348edb6157149aa50f2c52b64 |