Skip to content

Commit

Permalink
Add local conanfile.py
Browse files Browse the repository at this point in the history
- Bump version to 0.4.0
  • Loading branch information
kammce committed Aug 31, 2022
1 parent e16e0cf commit fc170d2
Showing 1 changed file with 80 additions and 0 deletions.
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 = []

0 comments on commit fc170d2

Please sign in to comment.