Skip to content

Commit

Permalink
(#17090) mailio: add package_type + bump openssl & cmake + few improv…
Browse files Browse the repository at this point in the history
…ements

* bump openssl

* various improvements

- call VirtualBuildEnv since there is a build requirement
- bump cmake
- don't use self.output.warn, it's not compatible with conan v2
- cleanup unused imports
- add package_type

* boost headers are public

* use version range for openssl & cmake

* more elegant version range for cmake

* Revert "more elegant version range for cmake"

This reverts commit 36fcdfe.

* Revert "Revert "more elegant version range for cmake""

This reverts commit 7db1e63.

* no upper bound for cmake

* upper bound
  • Loading branch information
SpaceIm authored Apr 28, 2023
1 parent 5b38180 commit 095b305
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
42 changes: 22 additions & 20 deletions recipes/mailio/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime, is_msvc
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file
from conan.tools.build import check_min_cppstd
from conan.tools.scm import Version
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
from conan.tools.scm import Version
import os

required_conan_version = ">=1.53.0"

class mailioConan(ConanFile):
class MailioConan(ConanFile):
name = "mailio"
description = "mailio is a cross platform C++ library for MIME format and SMTP, POP3 and IMAP protocols."
license = "BSD-2-Clause"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/karastojko/mailio"
topics = ("smtp", "imap", "email", "mail", "libraries", "cpp")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"fPIC": [True, False],
"shared": [True, False]
"shared": [True, False],
}
default_options = {
"fPIC": True,
"shared": False
"shared": False,
}
short_paths = True

@property
def _min_cppstd(self):
return 17
return "17"

@property
def _compiler_required_cpp(self):
def _compilers_minimum_version(self):
return {
"gcc": "8.3",
"clang": "6",
Expand All @@ -57,35 +57,37 @@ def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
self.requires("boost/1.81.0")
self.requires("openssl/1.1.1s")
self.requires("boost/1.81.0", transitive_headers=True)
self.requires("openssl/[>=1.1 <4]")

def validate(self):
if self.settings.get_safe("compiler.cppstd"):
check_min_cppstd(self, self._min_cppstd)
try:
minimum_required_compiler_version = self._compiler_required_cpp[str(self.settings.compiler)]
if Version(self.settings.compiler.version) < minimum_required_compiler_version:
raise ConanInvalidConfiguration(f"{self.ref} requires c++{self._min_cppstd} support. The current compiler does not support it.")
except KeyError:
self.output.warn(f"{self.ref} has no support for the current compiler. Please consider adding it.")

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 does not support."
)

def build_requirements(self):
# mailio requires cmake >= 3.16.3
self.tool_requires("cmake/3.25.0")
self.tool_requires("cmake/[>=3.16.3 <4]")

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

def generate(self):
env = VirtualBuildEnv(self)
env.generate()

tc = CMakeToolchain(self)
tc.variables["MAILIO_BUILD_SHARED_LIBRARY"] = self.options.shared
tc.variables["MAILIO_BUILD_DOCUMENTATION"] = False
tc.variables["MAILIO_BUILD_EXAMPLES"] = False
tc.generate()

dpes = CMakeDeps(self)
dpes.generate()
deps = CMakeDeps(self)
deps.generate()

def build(self):
apply_conandata_patches(self)
Expand Down
1 change: 0 additions & 1 deletion recipes/mailio/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import os


# It will become the standard on Conan 2.x
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
Expand Down

0 comments on commit 095b305

Please sign in to comment.