Skip to content

Commit

Permalink
(#15666) mongo-cxx-driver: fix source code url of 3.6.7 + modernize more
Browse files Browse the repository at this point in the history
* modernize more

* fix url of 3.6.7
  • Loading branch information
SpaceIm authored Feb 4, 2023
1 parent 672128a commit 796ed40
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
4 changes: 2 additions & 2 deletions recipes/mongo-cxx-driver/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ sources:
url: "https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.7.0/mongo-cxx-driver-r3.7.0.tar.gz"
sha256: "fb2da11178db728f63147fe4b0c7509eb49b1b02c5cb55f9bee5f927e451a0c7"
"3.6.7":
url: "https://github.com/mongodb/mongo-cxx-driver/archive/debian/3.6.7-1.tar.gz"
sha256: "62a0a16e4a35289e1692f60cf07a7f6957485446b7bc1d82306b731ad6763fb9"
url: "https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.7/mongo-cxx-driver-r3.6.7.tar.gz"
sha256: "2c58005d4fe46f1973352fba821f7bb37e818cefc922377ce979a9fd1bff38ac"
"3.6.6":
url: "https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.6/mongo-cxx-driver-r3.6.6.tar.gz"
sha256: "d5906b9e308a8a353a2ef92b699c9b27ae28ec6b34fdda94e15d2981b27e64ca"
Expand Down
25 changes: 11 additions & 14 deletions recipes/mongo-cxx-driver/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os
import shutil

required_conan_version = ">=1.51.1"
required_conan_version = ">=1.54.0"


class MongoCxxConan(ConanFile):
Expand Down Expand Up @@ -43,6 +43,9 @@ def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
self.requires("mongo-c-driver/1.23.2")
if self.options.polyfill == "boost":
Expand Down Expand Up @@ -89,33 +92,29 @@ def _compilers_minimum_version(self):
)

def validate(self):
if self.info.options.with_ssl and not bool(self.dependencies["mongo-c-driver"].options.with_ssl):
if self.options.with_ssl and not bool(self.dependencies["mongo-c-driver"].options.with_ssl):
raise ConanInvalidConfiguration("mongo-cxx-driver with_ssl=True requires mongo-c-driver with a ssl implementation")

if self.info.options.polyfill == "mnmlstc":
if self.options.polyfill == "mnmlstc":
# TODO: add mnmlstc polyfill support
# Cannot model mnmlstc (not packaged, is pulled dynamically) polyfill dependencies
raise ConanInvalidConfiguration("mnmlstc polyfill is not yet supported")

if self.info.settings.compiler.get_safe("cppstd"):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._minimal_std_version)

compiler = str(self.info.settings.compiler)
if self.info.options.polyfill == "experimental" and compiler == "apple-clang":
compiler = str(self.settings.compiler)
if self.options.polyfill == "experimental" and compiler == "apple-clang":
raise ConanInvalidConfiguration("experimental polyfill is not supported for apple-clang")

version = Version(self.info.settings.compiler.version)
version = Version(self.settings.compiler.version)
if compiler in self._compilers_minimum_version and version < self._compilers_minimum_version[compiler]:
raise ConanInvalidConfiguration(
f"{self.name} {self.version} requires a compiler that supports at least C++{self._minimal_std_version}",
)

def layout(self):
cmake_layout(self, src_folder="src")

def source(self):
get(self, **self.conan_data["sources"][self.version],
destination=self.source_folder, strip_root=True)
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
Expand All @@ -130,8 +129,6 @@ def generate(self):
if not valid_min_cppstd(self, self._minimal_std_version):
tc.variables["CMAKE_CXX_STANDARD"] = self._minimal_std_version
tc.variables["ENABLE_TESTS"] = False
# Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840)
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
tc.generate()

deps = CMakeDeps(self)
Expand Down
7 changes: 4 additions & 3 deletions recipes/mongo-cxx-driver/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "VirtualRunEnv"

def requirements(self):
self.requires(self.tested_reference_str)
test_type = "explicit"

def layout(self):
cmake_layout(self)

def requirements(self):
self.requires(self.tested_reference_str)

def generate(self):
tc = CMakeToolchain(self)
tc.variables["MONGO-CXX-DRIVER_POLYFILL"] = self.dependencies["mongo-cxx-driver"].options.polyfill
Expand Down

0 comments on commit 796ed40

Please sign in to comment.