From 52dbba896bb55ebb81a1eb21126516579d444361 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 5 Dec 2023 23:41:24 +0100 Subject: [PATCH 01/10] disable autodiscovery of ccache --- recipes/ginkgo/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/ginkgo/all/conanfile.py b/recipes/ginkgo/all/conanfile.py index 89bbd2a608d1e..c099d9f4d6b08 100644 --- a/recipes/ginkgo/all/conanfile.py +++ b/recipes/ginkgo/all/conanfile.py @@ -117,6 +117,8 @@ def generate(self): tc.variables["GINKGO_BUILD_DPCPP"] = False tc.variables["GINKGO_BUILD_HWLOC"] = False tc.variables["GINKGO_BUILD_MPI"] = False + if Version(self.version) >= "1.4.0": + tc.variables["GINKGO_WITH_CCACHE"] = False tc.generate() def build(self): From 7739e379e351656c85123604429d2afc0ec77f8a 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 02/10] fix compilation of ginkgo 1.7.0 with msvc & C++20 --- recipes/ginkgo/all/conandata.yml | 12 ++++++++---- ...make-fixes.patch => 1.3.0-0001-cmake-fixes.patch} | 0 ...ymbols.patch => 1.3.0-0002-windows-symbols.patch} | 0 ...rator.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 | 12 ++++++++++++ 6 files changed, 20 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 8927c006e472b..5f82d6f746212 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 0000000000000..77e127224438d --- /dev/null +++ b/recipes/ginkgo/all/patches/1.7.0-0002-msvc-c++20.patch @@ -0,0 +1,12 @@ +--- 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(); From 81cc722b74c2b9ce026e3b6da74cf2e8403bf861 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 6 Dec 2023 01:56:00 +0100 Subject: [PATCH 03/10] typo --- ...1-windows-iterator.patch => 1.3.0-0002-windows-iterator.patch} | 0 ...002-windows-symbols.patch => 1.4.0-0001-windows-symbols.patch} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename recipes/ginkgo/all/patches/{1.4.0-0001-windows-iterator.patch => 1.3.0-0002-windows-iterator.patch} (100%) rename recipes/ginkgo/all/patches/{1.3.0-0002-windows-symbols.patch => 1.4.0-0001-windows-symbols.patch} (100%) diff --git a/recipes/ginkgo/all/patches/1.4.0-0001-windows-iterator.patch b/recipes/ginkgo/all/patches/1.3.0-0002-windows-iterator.patch similarity index 100% rename from recipes/ginkgo/all/patches/1.4.0-0001-windows-iterator.patch rename to recipes/ginkgo/all/patches/1.3.0-0002-windows-iterator.patch diff --git a/recipes/ginkgo/all/patches/1.3.0-0002-windows-symbols.patch b/recipes/ginkgo/all/patches/1.4.0-0001-windows-symbols.patch similarity index 100% rename from recipes/ginkgo/all/patches/1.3.0-0002-windows-symbols.patch rename to recipes/ginkgo/all/patches/1.4.0-0001-windows-symbols.patch From cda67433a14a6a8911d442ed54916a7e8224f4db Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 6 Dec 2023 10:12:34 +0100 Subject: [PATCH 04/10] workaround for msvc shared if Ninja generator set by user --- recipes/ginkgo/all/conanfile.py | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/recipes/ginkgo/all/conanfile.py b/recipes/ginkgo/all/conanfile.py index c099d9f4d6b08..3be0567358767 100644 --- a/recipes/ginkgo/all/conanfile.py +++ b/recipes/ginkgo/all/conanfile.py @@ -101,8 +101,45 @@ def build_requirements(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) + def _get_visual_generator(self): + compiler_version = str(self.settings.compiler.version) + if self.settings.compiler == "msvc": + compiler_version = { + "170": "11", + "180": "12", + "190": "14", + "191": "15", + "192": "16", + "193": "17", + }[compiler_version] + + visual_gen_suffix = { + "8": "8 2005", + "9": "9 2008", + "10": "10 2010", + "11": "11 2012", + "12": "12 2013", + "14": "14 2015", + "15": "15 2017", + "16": "16 2019", + "17": "17 2022", + }[compiler_version] + + return f"Visual Studio {visual_gen_suffix}" + def generate(self): tc = CMakeToolchain(self) + + # Since 1.5.0, force MSBuild generator if: + # - msvc & shared + # - user has set tools.cmake.cmaketoolchain:generator to Ninja + # It's a workaround for LINK : fatal error LNK1189: library limit of 65535 objects exceeded + # See https://github.com/ginkgo-project/ginkgo/issues/1495#issuecomment-1841983036 + # and https://github.com/microsoft/vcpkg/pull/34280#discussion_r1351515284 + if Version(self.version) >= "1.5.0" and is_msvc(self) and self.options.shared: + if self.conf.get("tools.cmake.cmaketoolchain:generator") == "Ninja": + tc.generator = self._get_visual_generator() + tc.variables["GINKGO_BUILD_TESTS"] = False tc.variables["GINKGO_BUILD_EXAMPLES"] = False tc.variables["GINKGO_BUILD_BENCHMARKS"] = False From dfaad281fec3f3f85d41a84d6e31cd8445a2e0a6 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 6 Dec 2023 10:34:30 +0100 Subject: [PATCH 05/10] add warning message --- recipes/ginkgo/all/conanfile.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/recipes/ginkgo/all/conanfile.py b/recipes/ginkgo/all/conanfile.py index 3be0567358767..761702ebc9e6b 100644 --- a/recipes/ginkgo/all/conanfile.py +++ b/recipes/ginkgo/all/conanfile.py @@ -138,7 +138,13 @@ def generate(self): # and https://github.com/microsoft/vcpkg/pull/34280#discussion_r1351515284 if Version(self.version) >= "1.5.0" and is_msvc(self) and self.options.shared: if self.conf.get("tools.cmake.cmaketoolchain:generator") == "Ninja": - tc.generator = self._get_visual_generator() + visual_generator = self._get_visual_generator() + self.output.warning( + f"You asked for Ninja generator, but fallback to {visual_generator}, " + "otherwise it will fail during creation of DLL with " + "LINK : fatal error LNK1189: library limit of 65535 objects exceeded" + ) + tc.generator = visual_generator tc.variables["GINKGO_BUILD_TESTS"] = False tc.variables["GINKGO_BUILD_EXAMPLES"] = False From 834a4a782bd38902ef89cad333e873485fdb2c6a Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 6 Dec 2023 10:35:23 +0100 Subject: [PATCH 06/10] update patch_source of 1.7.0-0002-msvc-c++20.patch --- recipes/ginkgo/all/conandata.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/ginkgo/all/conandata.yml b/recipes/ginkgo/all/conandata.yml index 5f82d6f746212..8b505ebf72bd6 100644 --- a/recipes/ginkgo/all/conandata.yml +++ b/recipes/ginkgo/all/conandata.yml @@ -17,7 +17,7 @@ patches: - 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" + patch_source: "https://github.com/ginkgo-project/ginkgo/pull/1496" "1.4.0": - patch_file: "patches/1.4.0-0001-windows-symbols.patch" patch_type: "official" From e7eeec9e39e15c0d1244eceed0c259be5cb0ae58 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 6 Dec 2023 11:04:27 +0100 Subject: [PATCH 07/10] improve _get_visual_generator --- recipes/ginkgo/all/conanfile.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/recipes/ginkgo/all/conanfile.py b/recipes/ginkgo/all/conanfile.py index 761702ebc9e6b..8328c753a591f 100644 --- a/recipes/ginkgo/all/conanfile.py +++ b/recipes/ginkgo/all/conanfile.py @@ -103,15 +103,22 @@ def source(self): def _get_visual_generator(self): compiler_version = str(self.settings.compiler.version) + if self.settings.compiler == "msvc": - compiler_version = { - "170": "11", - "180": "12", - "190": "14", - "191": "15", - "192": "16", - "193": "17", - }[compiler_version] + toolset_override = self.conf.get("tools.microsoft.msbuild:vs_version", check_type=str) + if toolset_override: + visual_version = toolset_override + else: + visual_version = { + "170": "11", + "180": "12", + "190": "14", + "191": "15", + "192": "16", + "193": "17", + }[compiler_version] + else: + visual_version = compiler_version visual_gen_suffix = { "8": "8 2005", @@ -123,7 +130,7 @@ def _get_visual_generator(self): "15": "15 2017", "16": "16 2019", "17": "17 2022", - }[compiler_version] + }[visual_version] return f"Visual Studio {visual_gen_suffix}" From 234dc7a3a124bdf4ff893fbc2bbb7073a013eace Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 11 Dec 2023 18:56:26 +0100 Subject: [PATCH 08/10] add system_libs --- recipes/ginkgo/all/conanfile.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/recipes/ginkgo/all/conanfile.py b/recipes/ginkgo/all/conanfile.py index 8328c753a591f..546fc503d8752 100644 --- a/recipes/ginkgo/all/conanfile.py +++ b/recipes/ginkgo/all/conanfile.py @@ -219,6 +219,13 @@ def package_info(self): self.cpp_info.components["ginkgo_reference"].libs = [ "ginkgo_reference" + debug_suffix] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["ginkgo_core"].system_libs.append("m") + self.cpp_info.components["ginkgo_cuda"].system_libs.append("m") + self.cpp_info.components["ginkgo_omp"].system_libs.append("m") + self.cpp_info.components["ginkgo_hip"].system_libs.append("m") + self.cpp_info.components["ginkgo_reference"].system_libs.append("m") + if has_dpcpp_device: # Always add these components # See https://github.com/conan-io/conan-center-index/pull/7044#discussion_r698181588 self.cpp_info.components["ginkgo_core"].requires += ["ginkgo_dpcpp"] @@ -232,6 +239,10 @@ def package_info(self): self.cpp_info.components["ginkgo_device"].libs = [ "ginkgo_device" + debug_suffix] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["ginkgo_dpcpp"].system_libs.append("m") + self.cpp_info.components["ginkgo_device"].system_libs.append("m") + self.cpp_info.components["ginkgo_omp"].requires += [ "ginkgo_dpcpp", "ginkgo_device"] self.cpp_info.components["ginkgo_reference"].requires += ["ginkgo_device"] From 7f4b637a0ede5ffd4333d450fffe49a22338b4d1 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 29 Aug 2024 18:06:57 +0200 Subject: [PATCH 09/10] Empty commit From 2450c7398f4ce963b5cd527a87ec07dd103a186c Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sun, 22 Sep 2024 19:58:03 +0200 Subject: [PATCH 10/10] handle compiler.version=194 for msvc --- recipes/ginkgo/all/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/ginkgo/all/conanfile.py b/recipes/ginkgo/all/conanfile.py index 616e2c91d621e..202c6597abe94 100644 --- a/recipes/ginkgo/all/conanfile.py +++ b/recipes/ginkgo/all/conanfile.py @@ -122,6 +122,7 @@ def _get_visual_generator(self): "191": "15", "192": "16", "193": "17", + "194": "17", }[compiler_version] else: visual_version = compiler_version @@ -281,7 +282,7 @@ def package_info(self): self.cpp_info.components["ginkgo_hip"].requires += ["ginkgo_device"] self.cpp_info.components["ginkgo_cuda"].requires += ["ginkgo_device"] self.cpp_info.components["ginkgo_dpcpp"].requires += ["ginkgo_device"] - + if has_config_library: self.cpp_info.components["ginkgo_core"].requires += ["ginkgo_config"]