Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions recipes/libpqxx/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
42 changes: 32 additions & 10 deletions recipes/libpqxx/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
15 changes: 13 additions & 2 deletions recipes/libpqxx/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
2 changes: 2 additions & 0 deletions recipes/libpqxx/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"8.0.0":
folder: all
"7.10.5":
folder: all
"6.4.8":
Expand Down