-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconanfile.py
78 lines (63 loc) · 2.4 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
from conan.tools.files import copy
from os.path import join
class ZTCppRecipe(ConanFile):
name = "ztcpp"
version = "3.0.3"
package_type = "library"
# Metadata
license = "MIT"
author = "Jovan Batnožić <[email protected]>"
url = "https://github.com/jbatnozic/ztcpp"
description = "User-friendly C++ wrapper over libzt's C interface"
# Binary configuration
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
"fPIC": [True, False]
}
default_options = {
"shared": True,
"fPIC": True
}
exports_sources = "CMakeLists.txt", "Include/*", "Source/*", "Examples/*"
def config_options(self):
if self.settings.os == "Windows":
self.options.rm_safe("fPIC")
def configure(self):
check_min_cppstd(self, "17")
if self.options.shared:
self.options.rm_safe("fPIC")
self.options["libzt"].shared = False
def requirements(self):
self.requires("libzt/3.0.3@jbatnozic/stable")
def layout(self):
cmake_layout(self)
def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
if not self.options.shared:
tc.variables["ZTCPP_STATIC"] = 1
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
copy(self, "*.dll", self.build_folder, join(self.package_folder, "bin"), keep_path=False)
copy(self, "*.a", self.build_folder, join(self.package_folder, "lib"), keep_path=False)
copy(self, "*.so", self.build_folder, join(self.package_folder, "lib"), keep_path=False)
copy(self, "*.lib", self.build_folder, join(self.package_folder, "lib"), keep_path=False)
copy(self, "*.dylib", self.build_folder, join(self.package_folder, "lib"), keep_path=False)
def package_info(self):
self.cpp_info.includedirs = ["Include"]
self.cpp_info.libs = ["ztcpp"]
self.cpp_info.libdirs = ["lib"]
self.cpp_info.bindirs = ["bin"]
if not self.options.shared:
self.cpp_info.defines = ["ZTCPP_STATIC"]