Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add local conanfile.py #48

Merged
merged 1 commit into from
Sep 2, 2022
Merged
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
80 changes: 80 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
from conan import ConanFile
from conan.tools.files import get, copy
from conan.tools.layout import basic_layout
from conan.tools.build import check_min_cppstd
from conan.errors import ConanInvalidConfiguration
import os


required_conan_version = ">=1.50.0"


class BoostLEAFConan(ConanFile):
name = "boost-leaf"
version = "0.4.0"
license = "BSL-1.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/boostorg/leaf"
description = ("Lightweight Error Augmentation Framework")
topics = ("multi-platform", "multi-threading", "cpp11", "error-handling",
"header-only", "low-latency", "no-dependencies", "single-header")
settings = "os", "compiler", "arch", "build_type"
exports_sources = "include/*", "LICENSE_1_0.txt"
no_copy_source = True

def package_id(self):
self.info.clear()

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

@property
def _compilers_minimum_version(self):
return {
"gcc": "4.8",
"Visual Studio": "17",
"msvc": "141",
"clang": "3.9",
"apple-clang": "10.0.0"
}

def requirements(self):
pass

def validate(self):
if self.settings.get_safe("compiler.cppstd"):
check_min_cppstd(self, self._min_cppstd)

def lazy_lt_semver(v1, v2):
lv1 = [int(v) for v in v1.split(".")]
lv2 = [int(v) for v in v2.split(".")]
min_length = min(len(lv1), len(lv2))
return lv1[:min_length] < lv2[:min_length]

compiler = str(self.settings.compiler)
version = str(self.settings.compiler.version)
minimum_version = self._compilers_minimum_version.get(compiler, False)

if minimum_version and lazy_lt_semver(version, minimum_version):
raise ConanInvalidConfiguration(
f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler ({compiler}-{version}) does not support")

def layout(self):
basic_layout(self)

def package(self):
copy(self, "LICENSE", dst=os.path.join(
self.package_folder, "licenses"), src=self.source_folder)
copy(self, "*.h", dst=os.path.join(self.package_folder, "include"),
src=os.path.join(self.source_folder, "include"))
copy(self, "*.hpp", dst=os.path.join(self.package_folder,
"include"), src=os.path.join(self.source_folder, "include"))

def package_info(self):
self.cpp_info.set_property("cmake_target_name", "boost::leaf")

self.cpp_info.bindirs = []
self.cpp_info.frameworkdirs = []
self.cpp_info.libdirs = []
self.cpp_info.resdirs = []