optimize implementation
[liba.git] / conanfile.py
blob18036cefd81b5f7fdd1e8424d47c4dae907f6b25
1 from conan import ConanFile
2 from conan.tools.cmake import CMakeToolchain, CMake
5 class aConan(ConanFile):
6 name = "liba"
7 version = "0.1.8"
8 license = "MPL-2.0"
9 topics = ("algorithm",)
10 author = "tqfx tqfx@tqfx.org"
11 homepage = url = "https://github.com/tqfx/liba.git"
12 description = "An algorithm library based on C/C++ language"
13 settings = "os", "compiler", "build_type", "arch"
14 options = {
15 "shared": [0, 1],
16 "fPIC": [0, 1],
17 "ipo": [0, 1],
18 "symlink": [0, 1],
19 "pkgconfig": [0, 1],
21 default_options = {
22 "shared": 0,
23 "fPIC": 1,
24 "ipo": 0,
25 "symlink": 0,
26 "pkgconfig": 1,
28 exports_sources = (
29 "CMakeLists.txt",
30 "LICENSE.txt",
31 "README.md",
32 "include/*",
33 "cmake/*",
34 "src/*",
37 def config_options(self):
38 if self.settings.os == "Windows": # type: ignore
39 del self.options.fPIC # type: ignore
41 def generate(self):
42 cmake = CMakeToolchain(self)
43 cmake.variables["BUILD_TESTING"] = 0
44 cmake.variables["LIBA_SYMLINK"] = self.options.symlink # type: ignore
45 cmake.variables["LIBA_PKGCONFIG"] = self.options.pkgconfig # type: ignore
46 if self.settings.build_type != "Debug": # type: ignore
47 cmake.variables["LIBA_IPO"] = self.options.ipo # type: ignore
48 else:
49 cmake.variables["LIBA_IPO"] = 0
50 cmake.generate()
52 def build(self):
53 cmake = CMake(self)
54 cmake.configure()
55 cmake.build()
57 def package(self):
58 cmake = CMake(self)
59 cmake.install()