From 9d17a6991e2506f69d4d5e2a3c6a6bab7caef693 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 6 Dec 2023 01:23:24 +0100 Subject: [PATCH] fix compilation of ginkgo 1.7.0 with msvc & C++20 --- recipes/ginkgo/all/conandata.yml | 12 ++++++++---- ...ke-fixes.patch => 1.3.0-0001-cmake-fixes.patch} | 0 ...bols.patch => 1.3.0-0002-windows-symbols.patch} | 0 ...tor.patch => 1.4.0-0001-windows-iterator.patch} | 0 ...chrono.patch => 1.7.0-0001-libc++-chrono.patch} | 0 .../ginkgo/all/patches/1.7.0-0002-msvc-c++20.patch | 14 ++++++++++++++ 6 files changed, 22 insertions(+), 4 deletions(-) rename recipes/ginkgo/all/patches/{cmake-fixes.patch => 1.3.0-0001-cmake-fixes.patch} (100%) rename recipes/ginkgo/all/patches/{windows-symbols.patch => 1.3.0-0002-windows-symbols.patch} (100%) rename recipes/ginkgo/all/patches/{windows-iterator.patch => 1.4.0-0001-windows-iterator.patch} (100%) rename recipes/ginkgo/all/patches/{libc++-chrono.patch => 1.7.0-0001-libc++-chrono.patch} (100%) create mode 100644 recipes/ginkgo/all/patches/1.7.0-0002-msvc-c++20.patch diff --git a/recipes/ginkgo/all/conandata.yml b/recipes/ginkgo/all/conandata.yml index 8927c006e472b3..5f82d6f7462123 100644 --- a/recipes/ginkgo/all/conandata.yml +++ b/recipes/ginkgo/all/conandata.yml @@ -10,21 +10,25 @@ sources: sha256: "1b0e907b4046cdf7cef16d1730c12ba812b38f2764f49f74f454239a27f63596" patches: "1.7.0": - - patch_file: "patches/libc++-chrono.patch" + - patch_file: "patches/1.7.0-0001-libc++-chrono.patch" patch_type: "official" patch_description: "Fix for std::chrono incompatibility with libc++" patch_source: "https://github.com/ginkgo-project/ginkgo/pull/1463" + - patch_file: "patches/1.7.0-0002-msvc-c++20.patch" + patch_type: "portability" + patch_description: "Fix compilation with Visual Studio and C++20" + patch_source: "https://github.com/ginkgo-project/ginkgo/commit/876d8ffb8a632862899de446c694526a89a79863" "1.4.0": - - patch_file: "patches/windows-symbols.patch" + - patch_file: "patches/1.4.0-0001-windows-symbols.patch" patch_type: "official" patch_description: "Fix for excessive link symbol count with MSVC" patch_source: "https://github.com/ginkgo-project/ginkgo/pull/868" "1.3.0": - - patch_file: "patches/cmake-fixes.patch" + - patch_file: "patches/1.3.0-0001-cmake-fixes.patch" patch_type: "official" patch_description: "Fixes for CMake issues" patch_source: "https://github.com/ginkgo-project/ginkgo/pull/713, https://github.com/ginkgo-project/ginkgo/pull/720" - - patch_file: "patches/windows-iterator.patch" + - patch_file: "patches/1.3.0-0002-windows-iterator.patch" patch_type: "official" patch_description: "Fixes for MSVC compatibility" patch_source: "https://github.com/ginkgo-project/ginkgo/pull/665" diff --git a/recipes/ginkgo/all/patches/cmake-fixes.patch b/recipes/ginkgo/all/patches/1.3.0-0001-cmake-fixes.patch similarity index 100% rename from recipes/ginkgo/all/patches/cmake-fixes.patch rename to recipes/ginkgo/all/patches/1.3.0-0001-cmake-fixes.patch diff --git a/recipes/ginkgo/all/patches/windows-symbols.patch b/recipes/ginkgo/all/patches/1.3.0-0002-windows-symbols.patch similarity index 100% rename from recipes/ginkgo/all/patches/windows-symbols.patch rename to recipes/ginkgo/all/patches/1.3.0-0002-windows-symbols.patch diff --git a/recipes/ginkgo/all/patches/windows-iterator.patch b/recipes/ginkgo/all/patches/1.4.0-0001-windows-iterator.patch similarity index 100% rename from recipes/ginkgo/all/patches/windows-iterator.patch rename to recipes/ginkgo/all/patches/1.4.0-0001-windows-iterator.patch diff --git a/recipes/ginkgo/all/patches/libc++-chrono.patch b/recipes/ginkgo/all/patches/1.7.0-0001-libc++-chrono.patch similarity index 100% rename from recipes/ginkgo/all/patches/libc++-chrono.patch rename to recipes/ginkgo/all/patches/1.7.0-0001-libc++-chrono.patch diff --git a/recipes/ginkgo/all/patches/1.7.0-0002-msvc-c++20.patch b/recipes/ginkgo/all/patches/1.7.0-0002-msvc-c++20.patch new file mode 100644 index 00000000000000..e71b3bd5466343 --- /dev/null +++ b/recipes/ginkgo/all/patches/1.7.0-0002-msvc-c++20.patch @@ -0,0 +1,14 @@ +diff --git a/include/ginkgo/core/base/std_extensions.hpp b/include/ginkgo/core/base/std_extensions.hpp +index 1064ae464..d9966c058 100644 +--- a/include/ginkgo/core/base/std_extensions.hpp ++++ b/include/ginkgo/core/base/std_extensions.hpp +@@ -73,7 +73,8 @@ using void_t = typename detail::make_void::type; + // Disable deprecation warnings when using standard > C++14 + inline bool uncaught_exception() noexcept + { +-#if __cplusplus > 201402L ++// MSVC uses _MSVC_LANG as __cplusplus ++#if (defined(_MSVC_LANG) && _MSVC_LANG > 201402L) || __cplusplus > 201402L + return std::uncaught_exceptions() > 0; + #else + return std::uncaught_exception();