|
| 1 | +from conan import ConanFile |
| 2 | +from conan.tools.build import check_min_cppstd |
| 3 | +from conan.tools.files import get, copy, rmdir |
| 4 | +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout |
| 5 | +import os |
| 6 | + |
| 7 | +required_conan_version = ">=2.0" |
| 8 | + |
| 9 | +class KDAlgorithmsConan(ConanFile): |
| 10 | + name = "kdalgorithms" |
| 11 | + license = "MIT" |
| 12 | + description = "C++ Algorithm wrappers" |
| 13 | + url = "https://github.com/conan-io/conan-center-index" |
| 14 | + homepage = "https://github.com/KDAB/KDAlgorithms" |
| 15 | + topics = ("c++14", "algorithmns", "kdab", "header-only") |
| 16 | + package_type = "header-library" |
| 17 | + settings = "os", "arch", "compiler", "build_type" |
| 18 | + |
| 19 | + def layout(self): |
| 20 | + cmake_layout(self, src_folder="src") |
| 21 | + |
| 22 | + def package_id(self): |
| 23 | + self.info.clear() |
| 24 | + |
| 25 | + def source(self): |
| 26 | + get(self, **self.conan_data["sources"][self.version], strip_root=True) |
| 27 | + |
| 28 | + def validate(self): |
| 29 | + check_min_cppstd(self, "14") |
| 30 | + |
| 31 | + def generate(self): |
| 32 | + tc = CMakeToolchain(self) |
| 33 | + tc.cache_variables["BUILD_TESTING"] = False |
| 34 | + tc.generate() |
| 35 | + |
| 36 | + def package(self): |
| 37 | + copy(self, "LICENSES/*", dst=os.path.join(self.package_folder,"licenses"), src=self.source_folder) |
| 38 | + cmake = CMake(self) |
| 39 | + cmake.configure() |
| 40 | + cmake.install() |
| 41 | + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) |
| 42 | + |
| 43 | + |
| 44 | + def package_info(self): |
| 45 | + self.cpp_info.bindirs = [] |
| 46 | + self.cpp_info.libdirs = [] |
| 47 | + self.cpp_info.set_property("cmake_file_name", "KDAlgorithms") |
| 48 | + self.cpp_info.set_property("cmake_target_name", "KDAB::kdalgorithms") |
0 commit comments