From eac98bd8210ec626a089049e35387e1f9245bac7 Mon Sep 17 00:00:00 2001 From: Guillaume Egles Date: Tue, 7 Jan 2025 04:12:20 -0800 Subject: [PATCH] catch2: add version `3.8.0` (#26312) * catch2: add version `3.8.0` * catch2: maintenance changes --------- Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com> --- recipes/catch2/3.x.x/conandata.yml | 58 +------------- recipes/catch2/3.x.x/conanfile.py | 44 ++--------- .../patches/3.0.1-0001-allow-shared.patch | 64 --------------- ...1-0002-dllimport-global-symbols-msvc.patch | 77 ------------------- .../patches/3.1.0-0001-fix-dll-install.patch | 16 ---- ...0-0002-dllimport-global-symbols-msvc.patch | 77 ------------------- recipes/catch2/config.yml | 26 +------ 7 files changed, 12 insertions(+), 350 deletions(-) delete mode 100644 recipes/catch2/3.x.x/patches/3.0.1-0001-allow-shared.patch delete mode 100644 recipes/catch2/3.x.x/patches/3.0.1-0002-dllimport-global-symbols-msvc.patch delete mode 100644 recipes/catch2/3.x.x/patches/3.1.0-0001-fix-dll-install.patch delete mode 100644 recipes/catch2/3.x.x/patches/3.1.0-0002-dllimport-global-symbols-msvc.patch diff --git a/recipes/catch2/3.x.x/conandata.yml b/recipes/catch2/3.x.x/conandata.yml index 21b5c183917cb..43dc0c04cb22f 100644 --- a/recipes/catch2/3.x.x/conandata.yml +++ b/recipes/catch2/3.x.x/conandata.yml @@ -1,68 +1,16 @@ sources: + "3.8.0": + url: "https://github.com/catchorg/Catch2/archive/v3.8.0.tar.gz" + sha256: "1ab2de20460d4641553addfdfe6acd4109d871d5531f8f519a52ea4926303087" "3.7.1": url: "https://github.com/catchorg/Catch2/archive/v3.7.1.tar.gz" sha256: "c991b247a1a0d7bb9c39aa35faf0fe9e19764213f28ffba3109388e62ee0269c" - "3.7.0": - url: "https://github.com/catchorg/Catch2/archive/v3.7.0.tar.gz" - sha256: "5b10cd536fa3818112a82820ce0787bd9f2a906c618429e7c4dea639983c8e88" "3.6.0": url: "https://github.com/catchorg/Catch2/archive/v3.6.0.tar.gz" sha256: "485932259a75c7c6b72d4b874242c489ea5155d17efa345eb8cc72159f49f356" "3.5.4": url: "https://github.com/catchorg/Catch2/archive/v3.5.4.tar.gz" sha256: "b7754b711242c167d8f60b890695347f90a1ebc95949a045385114165d606dbb" - "3.5.3": - url: "https://github.com/catchorg/Catch2/archive/v3.5.3.tar.gz" - sha256: "8d723b0535c94860ef8cf6231580fa47d67a3416757ecb10639e40d748ab6c71" - "3.5.2": - url: "https://github.com/catchorg/Catch2/archive/v3.5.2.tar.gz" - sha256: "269543a49eb76f40b3f93ff231d4c24c27a7e16c90e47d2e45bcc564de470c6e" - "3.5.1": - url: "https://github.com/catchorg/Catch2/archive/v3.5.1.tar.gz" - sha256: "49c3ca7a68f1c8ec71307736bc6ed14fec21631707e1be9af45daf4037e75a08" - "3.5.0": - url: "https://github.com/catchorg/Catch2/archive/v3.5.0.tar.gz" - sha256: "f6d4f8d78a9b59ec72a81d49f58d18eb317372ac07f8d9432710a079e69fd66a" "3.4.0": url: "https://github.com/catchorg/Catch2/archive/v3.4.0.tar.gz" sha256: "122928b814b75717316c71af69bd2b43387643ba076a6ec16e7882bfb2dfacbb" - "3.3.2": - url: "https://github.com/catchorg/Catch2/archive/v3.3.2.tar.gz" - sha256: "8361907f4d9bff3ae7c1edb027f813659f793053c99b67837a0c0375f065bae2" - "3.3.1": - url: "https://github.com/catchorg/Catch2/archive/v3.3.1.tar.gz" - sha256: "d90351cdc55421f640c553cfc0875a8c834428679444e8062e9187d05b18aace" - "3.3.0": - url: "https://github.com/catchorg/Catch2/archive/v3.3.0.tar.gz" - sha256: "fe2f29a54ca775c2dd04bb97ffb79d398e6210e3caa174348b5cd3b7e4ca887d" - "3.2.1": - url: "https://github.com/catchorg/Catch2/archive/v3.2.1.tar.gz" - sha256: "4613d3e8142b672159fcae252a4860d72c8cf8e2df5043b1ae3541db9ef5d73c" - "3.2.0": - url: "https://github.com/catchorg/Catch2/archive/v3.2.0.tar.gz" - sha256: "feee04647e28ac3cbeff46cb42abc8ee2d8d5f646d36e3fb3ba274b8c69a58ea" - "3.1.0": - url: "https://github.com/catchorg/Catch2/archive/v3.1.0.tar.gz" - sha256: "c252b2d9537e18046d8b82535069d2567f77043f8e644acf9a9fffc22ea6e6f7" - "3.0.1": - url: "https://github.com/catchorg/Catch2/archive/v3.0.1.tar.gz" - sha256: "8c4173c68ae7da1b5b505194a0c2d6f1b2aef4ec1e3e7463bde451f26bbaf4e7" -patches: - "3.1.0": - - patch_file: "patches/3.1.0-0001-fix-dll-install.patch" - patch_description: "Install dll in bin folder" - patch_type: "portability" - patch_source: "https://github.com/catchorg/Catch2/pull/2485" - - patch_file: "patches/3.1.0-0002-dllimport-global-symbols-msvc.patch" - patch_description: "Fix import of global symbols for msvc shared" - patch_type: "portability" - patch_source: "https://github.com/catchorg/Catch2/pull/2527" - "3.0.1": - - patch_file: "patches/3.0.1-0001-allow-shared.patch" - patch_description: "Allow to build catch2 as a shared library" - patch_type: "portability" - patch_source: "https://github.com/catchorg/Catch2/commit/bea58bf8bbfca887f871c3aa2d720ba62c01f855" - - patch_file: "patches/3.0.1-0002-dllimport-global-symbols-msvc.patch" - patch_description: "Fix import of global symbols for msvc shared" - patch_type: "portability" - patch_source: "https://github.com/catchorg/Catch2/pull/2527" diff --git a/recipes/catch2/3.x.x/conanfile.py b/recipes/catch2/3.x.x/conanfile.py index 5bc8657f4ad30..22692ccc62115 100644 --- a/recipes/catch2/3.x.x/conanfile.py +++ b/recipes/catch2/3.x.x/conanfile.py @@ -2,12 +2,12 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save +from conan.tools.files import copy, get, rmdir, save from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.54.0" +required_conan_version = ">=2.0" class Catch2Conan(ConanFile): @@ -39,32 +39,15 @@ class Catch2Conan(ConanFile): # see https://github.com/conan-io/conan-center-index/issues/19008 extension_properties = {"compatibility_cppstd": False} - @property - def _min_cppstd(self): - return "14" - @property def _min_console_width(self): # Catch2 doesn't build if less than this value return 46 - @property - def _compilers_minimum_version(self): - return { - "gcc": "7", - "Visual Studio": "15", - "msvc": "191", - "clang": "5", - "apple-clang": "10", - } - @property def _default_reporter_str(self): return str(self.options.default_reporter).strip('"') - def export_sources(self): - export_conandata_patches(self) - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -76,14 +59,12 @@ def configure(self): def layout(self): cmake_layout(self, src_folder="src") + def build_requirements(self): + if Version(self.version) >= "3.8.0": + self.tool_requires("cmake/[>=3.16 <4]") + def validate(self): - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, self._min_cppstd) - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if minimum_version and Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration( - f"{self.ref} requires C++{self._min_cppstd}, which your compiler doesn't support", - ) + check_min_cppstd(self, 14) try: if int(self.options.console_width) < self._min_console_width: @@ -111,7 +92,6 @@ def generate(self): tc.generate() def build(self): - apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() @@ -178,13 +158,3 @@ def package_info(self): if self.options.default_reporter: defines.append(f"CATCH_CONFIG_DEFAULT_REPORTER={self._default_reporter_str}") self.cpp_info.components["catch2_with_main"].defines = defines - - # TODO: to remove in conan v2 once legacy generators removed - self.cpp_info.filenames["cmake_find_package"] = "Catch2" - self.cpp_info.filenames["cmake_find_package_multi"] = "Catch2" - self.cpp_info.names["cmake_find_package"] = "catch2" - self.cpp_info.names["cmake_find_package_multi"] = "catch2" - self.cpp_info.components["_catch2"].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components["_catch2"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - self.cpp_info.components["catch2_with_main"].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components["catch2_with_main"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/catch2/3.x.x/patches/3.0.1-0001-allow-shared.patch b/recipes/catch2/3.x.x/patches/3.0.1-0001-allow-shared.patch deleted file mode 100644 index 38c31d266b121..0000000000000 --- a/recipes/catch2/3.x.x/patches/3.0.1-0001-allow-shared.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -263,9 +263,7 @@ set(REPORTER_SOURCES - ) - set(REPORTER_FILES ${REPORTER_HEADERS} ${REPORTER_SOURCES}) - --# Fixme: STATIC because for dynamic, we would need to handle visibility --# and I don't want to do the annotations right now --add_library(Catch2 STATIC -+add_library(Catch2 - ${REPORTER_FILES} - ${INTERNAL_FILES} - ${BENCHMARK_HEADERS} -@@ -318,7 +316,7 @@ target_include_directories(Catch2 - ) - - --add_library(Catch2WithMain STATIC -+add_library(Catch2WithMain - ${SOURCES_DIR}/internal/catch_main.cpp - ) - add_build_reproducibility_settings(Catch2WithMain) -@@ -338,8 +336,12 @@ if (NOT_SUBPROJECT) - Catch2WithMain - EXPORT - Catch2Targets -- DESTINATION -+ LIBRARY DESTINATION -+ ${CMAKE_INSTALL_LIBDIR} -+ ARCHIVE DESTINATION - ${CMAKE_INSTALL_LIBDIR} -+ RUNTIME DESTINATION -+ ${CMAKE_INSTALL_BINDIR} - ) - - -@@ -409,3 +411,27 @@ endif() - - list(APPEND CATCH_WARNING_TARGETS Catch2 Catch2WithMain) - set(CATCH_WARNING_TARGETS ${CATCH_WARNING_TARGETS} PARENT_SCOPE) -+ -+ -+# We still do not support building dynamic library with hidden visibility -+# so we want to check & warn users if they do this. However, we won't abort -+# the configuration step so that we don't have to also provide an override. -+if (BUILD_SHARED_LIBS) -+ if (MSVC) -+ set_target_properties(Catch2 Catch2WithMain -+ PROPERTIES -+ WINDOWS_EXPORT_ALL_SYMBOLS ON -+ ) -+ endif() -+ -+ get_target_property(_VisPreset Catch2 CXX_VISIBILITY_PRESET) -+ if (NOT MSVC AND _VisPreset STREQUAL "hidden") -+ set_target_properties(Catch2 Catch2WithMain -+ PROPERTIES -+ CXX_VISIBILITY_PRESET "default" -+ VISIBILITY_INLINES_HIDDEN OFF -+ ) -+ message(WARNING "Setting Catch2's visibility to default." -+ " Hidden visibility is not supported.") -+ endif() -+endif() diff --git a/recipes/catch2/3.x.x/patches/3.0.1-0002-dllimport-global-symbols-msvc.patch b/recipes/catch2/3.x.x/patches/3.0.1-0002-dllimport-global-symbols-msvc.patch deleted file mode 100644 index c797f9d544f0c..0000000000000 --- a/recipes/catch2/3.x.x/patches/3.0.1-0002-dllimport-global-symbols-msvc.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- a/CMake/CatchConfigOptions.cmake -+++ b/CMake/CatchConfigOptions.cmake -@@ -45,6 +45,7 @@ set(_OverridableOptions - foreach(OptionName ${_OverridableOptions}) - AddOverridableConfigOption(${OptionName}) - endforeach() -+set(CATCH_CONFIG_SHARED_LIBRARY ${BUILD_SHARED_LIBS}) - - set(_OtherConfigOptions - "DISABLE_EXCEPTIONS" ---- a/src/catch2/catch_tostring.hpp -+++ b/src/catch2/catch_tostring.hpp -@@ -296,13 +296,13 @@ namespace Catch { - template<> - struct StringMaker { - static std::string convert(float value); -- static int precision; -+ CATCH_EXPORT static int precision; - }; - - template<> - struct StringMaker { - static std::string convert(double value); -- static int precision; -+ CATCH_EXPORT static int precision; - }; - - template ---- a/src/catch2/catch_user_config.hpp.in -+++ b/src/catch2/catch_user_config.hpp.in -@@ -181,6 +181,8 @@ - #cmakedefine CATCH_CONFIG_PREFIX_ALL - #cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG - -+#cmakedefine CATCH_CONFIG_SHARED_LIBRARY -+ - - // ------ - // "Variable" defines, these have actual values ---- a/src/catch2/internal/catch_compiler_capabilities.hpp -+++ b/src/catch2/internal/catch_compiler_capabilities.hpp -@@ -364,5 +364,15 @@ - # define CATCH_CONFIG_COLOUR_WIN32 - #endif - -+#if defined( CATCH_CONFIG_SHARED_LIBRARY ) && defined( _MSC_VER ) && \ -+ !defined( CATCH_CONFIG_STATIC ) -+# ifdef Catch2_EXPORTS -+# define CATCH_EXPORT //__declspec( dllexport ) // not needed -+# else -+# define CATCH_EXPORT __declspec( dllimport ) -+# endif -+#else -+# define CATCH_EXPORT -+#endif - - #endif // CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED ---- a/src/catch2/internal/catch_context.hpp -+++ b/src/catch2/internal/catch_context.hpp -@@ -8,6 +8,8 @@ - #ifndef CATCH_CONTEXT_HPP_INCLUDED - #define CATCH_CONTEXT_HPP_INCLUDED - -+#include -+ - namespace Catch { - - class IResultCapture; -@@ -28,7 +30,7 @@ namespace Catch { - virtual void setConfig( IConfig const* config ) = 0; - - private: -- static IMutableContext *currentContext; -+ CATCH_EXPORT static IMutableContext *currentContext; - friend IMutableContext& getCurrentMutableContext(); - friend void cleanUpContext(); - static void createContext(); diff --git a/recipes/catch2/3.x.x/patches/3.1.0-0001-fix-dll-install.patch b/recipes/catch2/3.x.x/patches/3.1.0-0001-fix-dll-install.patch deleted file mode 100644 index c7027940432a6..0000000000000 --- a/recipes/catch2/3.x.x/patches/3.1.0-0001-fix-dll-install.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -359,8 +359,12 @@ if (NOT_SUBPROJECT) - Catch2WithMain - EXPORT - Catch2Targets -- DESTINATION -+ LIBRARY DESTINATION -+ ${CMAKE_INSTALL_LIBDIR} -+ ARCHIVE DESTINATION - ${CMAKE_INSTALL_LIBDIR} -+ RUNTIME DESTINATION -+ ${CMAKE_INSTALL_BINDIR} - ) - - diff --git a/recipes/catch2/3.x.x/patches/3.1.0-0002-dllimport-global-symbols-msvc.patch b/recipes/catch2/3.x.x/patches/3.1.0-0002-dllimport-global-symbols-msvc.patch deleted file mode 100644 index 63e221c1fb44c..0000000000000 --- a/recipes/catch2/3.x.x/patches/3.1.0-0002-dllimport-global-symbols-msvc.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- a/CMake/CatchConfigOptions.cmake -+++ b/CMake/CatchConfigOptions.cmake -@@ -45,6 +45,7 @@ set(_OverridableOptions - foreach(OptionName ${_OverridableOptions}) - AddOverridableConfigOption(${OptionName}) - endforeach() -+set(CATCH_CONFIG_SHARED_LIBRARY ${BUILD_SHARED_LIBS}) - - set(_OtherConfigOptions - "DISABLE_EXCEPTIONS" ---- a/src/catch2/catch_tostring.hpp -+++ b/src/catch2/catch_tostring.hpp -@@ -296,13 +296,13 @@ namespace Catch { - template<> - struct StringMaker { - static std::string convert(float value); -- static int precision; -+ CATCH_EXPORT static int precision; - }; - - template<> - struct StringMaker { - static std::string convert(double value); -- static int precision; -+ CATCH_EXPORT static int precision; - }; - - template ---- a/src/catch2/catch_user_config.hpp.in -+++ b/src/catch2/catch_user_config.hpp.in -@@ -181,6 +181,8 @@ - #cmakedefine CATCH_CONFIG_PREFIX_ALL - #cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG - -+#cmakedefine CATCH_CONFIG_SHARED_LIBRARY -+ - - // ------ - // "Variable" defines, these have actual values ---- a/src/catch2/internal/catch_compiler_capabilities.hpp -+++ b/src/catch2/internal/catch_compiler_capabilities.hpp -@@ -376,5 +376,15 @@ - # define CATCH_CONFIG_COLOUR_WIN32 - #endif - -+#if defined( CATCH_CONFIG_SHARED_LIBRARY ) && defined( _MSC_VER ) && \ -+ !defined( CATCH_CONFIG_STATIC ) -+# ifdef Catch2_EXPORTS -+# define CATCH_EXPORT //__declspec( dllexport ) // not needed -+# else -+# define CATCH_EXPORT __declspec( dllimport ) -+# endif -+#else -+# define CATCH_EXPORT -+#endif - - #endif // CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED ---- a/src/catch2/internal/catch_context.hpp -+++ b/src/catch2/internal/catch_context.hpp -@@ -8,6 +8,8 @@ - #ifndef CATCH_CONTEXT_HPP_INCLUDED - #define CATCH_CONTEXT_HPP_INCLUDED - -+#include -+ - namespace Catch { - - class IResultCapture; -@@ -28,7 +30,7 @@ namespace Catch { - virtual void setConfig( IConfig const* config ) = 0; - - private: -- static IMutableContext *currentContext; -+ CATCH_EXPORT static IMutableContext *currentContext; - friend IMutableContext& getCurrentMutableContext(); - friend void cleanUpContext(); - static void createContext(); diff --git a/recipes/catch2/config.yml b/recipes/catch2/config.yml index 0c81c16ccdbcb..a10c7ada64367 100644 --- a/recipes/catch2/config.yml +++ b/recipes/catch2/config.yml @@ -1,36 +1,14 @@ versions: - "3.7.1": + "3.8.0": folder: 3.x.x - "3.7.0": + "3.7.1": folder: 3.x.x "3.6.0": folder: 3.x.x "3.5.4": folder: 3.x.x - "3.5.3": - folder: 3.x.x - "3.5.2": - folder: 3.x.x - "3.5.1": - folder: 3.x.x - "3.5.0": - folder: 3.x.x "3.4.0": folder: 3.x.x - "3.3.2": - folder: 3.x.x - "3.3.1": - folder: 3.x.x - "3.3.0": - folder: 3.x.x - "3.2.1": - folder: 3.x.x - "3.2.0": - folder: 3.x.x - "3.1.0": - folder: 3.x.x - "3.0.1": - folder: 3.x.x "2.13.10": folder: 2.x.x "2.13.9":