diff --git a/recipes/libpqxx/all/conandata.yml b/recipes/libpqxx/all/conandata.yml index 6d8238150ae06..449594b86fc00 100644 --- a/recipes/libpqxx/all/conandata.yml +++ b/recipes/libpqxx/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "8.0.0": + url: "https://github.com/jtv/libpqxx/archive/refs/tags/8.0.0.tar.gz" + sha256: "f467c8133b31941324e40eb21f05db0b52e0fcfa070fd1a08490967c1f129977" "7.10.5": url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.10.5.tar.gz" sha256: "aa214df8b98672a43a39b68a37da87af1415a44965f6e484f85ca0eb4f151367" diff --git a/recipes/libpqxx/all/conanfile.py b/recipes/libpqxx/all/conanfile.py index 44d9898ef92f5..f8333ba736682 100644 --- a/recipes/libpqxx/all/conanfile.py +++ b/recipes/libpqxx/all/conanfile.py @@ -30,26 +30,46 @@ class LibpqxxConan(ConanFile): @property def _min_cppstd(self): - return 14 if Version(self.version) < "7.0" else "17" + version = Version(self.version) + if version >= "8.0": + return 20 + elif version >= "7.0": + return 17 + else: + return 14 @property def _compilers_minimum_version(self): - if Version(self.version) < "7.0": + version = Version(self.version) + if version >= "8.0": return { - "gcc": "7", + "gcc": "10", + "clang": "11", + # Apple Clang 15 supports C++20, but it has several bugs. + # One such bug causes `std::source_location` to return incorrect + # line numbers when used as a default argument. + # Since libpqxx 8 uses `std::source_location`, builds may + # succeed, but it will not be working correctly. + "apple-clang": "16", + } + elif version >= "7.0": + return { + "gcc": "7" if version < "7.5.0" else "8", "clang": "6", - "apple-clang": "10" + "apple-clang": "10", } else: return { - "gcc": "7" if Version(self.version) < "7.5.0" else "8", + "gcc": "7", "clang": "6", - "apple-clang": "10" + "apple-clang": "10", } @property def _mac_os_minimum_required_version(self): - return "10.15" + # libpqxx 8 requires C++20, and Apple Clang using C++20 requires Macos + # 13.3 or later. + return "13.3" if Version(self.version) >= "8.0" else "10.15" def export_sources(self): export_conandata_patches(self) @@ -72,9 +92,10 @@ def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - if Version(self.version) < "7.0": + version = Version(self.version) + if version < "7.0": check_min_vs(self, 190) - elif Version(self.version) < "7.6": + elif version < "7.6": check_min_vs(self, 191) else: check_min_vs(self, 192) @@ -93,7 +114,8 @@ def validate(self): os_version = self.settings.get_safe("os.version") if os_version and Version(os_version) < self._mac_os_minimum_required_version: raise ConanInvalidConfiguration( - "Macos Mojave (10.14) and earlier cannot to be built because C++ standard library too old.") + f"Macos {self._mac_os_minimum_required_version} and earlier cannot be built." + ) def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) diff --git a/recipes/libpqxx/all/test_package/conanfile.py b/recipes/libpqxx/all/test_package/conanfile.py index a9fbb7f543162..1508a2939442d 100644 --- a/recipes/libpqxx/all/test_package/conanfile.py +++ b/recipes/libpqxx/all/test_package/conanfile.py @@ -1,19 +1,30 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import cmake_layout, CMake +from conan.tools.cmake import cmake_layout, CMake, CMakeDeps, CMakeToolchain +from conan.tools.scm import Version import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + generators = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" + @property + def _mac_os_minimum_required_version(self): + version = Version(self.dependencies[self.tested_reference_str].ref.version) + return "13.3" if version >= "8.0" else "10.15" + def requirements(self): self.requires(self.tested_reference_str) def layout(self): cmake_layout(self) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_OSX_DEPLOYMENT_TARGET"] = self._mac_os_minimum_required_version + tc.generate() + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/libpqxx/config.yml b/recipes/libpqxx/config.yml index 05109bde3121c..5477191966c8d 100644 --- a/recipes/libpqxx/config.yml +++ b/recipes/libpqxx/config.yml @@ -1,4 +1,6 @@ versions: + "8.0.0": + folder: all "7.10.5": folder: all "6.4.8":