-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconanfile.py
62 lines (54 loc) · 2.28 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
from conan import ConanFile, tools
from conan.tools.cmake import CMakeDeps, CMakeToolchain, cmake_layout, CMake
from conan.tools.system.package_manager import Apt
import os
class CppTeConan(ConanFile):
name = "cppte"
version = "1.0.0"
license = ""
author = "Olivia Quinet olivia.quinet@gmail.com"
description = "CPP-TypeErasure with visitor"
topics = ("cppte")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False], "ENABLE_COVERAGE": ["ON", "OFF"], "ENABLE_TESTING": ["ON", "OFF"]}
default_options = {"shared": True, "fPIC": True, "ENABLE_COVERAGE": "OFF", "ENABLE_TESTING": "ON", "fmt/*:shared": False}
generators = "VirtualBuildEnv", "VirtualRunEnv"
build_policy = "missing"
exports_sources = "CMakeLists.txt", "src/*", "include/*", "tests/*", "conanfile.py", "cmake/*"
package_type = "shared-library"
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def layout(self):
cmake_layout(self)
def generate(self):
tc = CMakeToolchain(self)
tc.cache_variables["ENABLE_COVERAGE"] = self.options.ENABLE_COVERAGE
tc.cache_variables["ENABLE_TESTING"] = self.options.ENABLE_TESTING
tc.extra_cflags.append('-DRCPP_NO_UNWIND_PROTECT')
tc.absolute_paths = True
tc.generate()
deps = CMakeDeps(self)
deps.generate()
def requirements(self):
self.test_requires("catch2/3.4.0")
self.requires("spdlog/1.9.2", visible=True, transitive_libs=True)
self.requires("fmt/8.0.1")
def build(self):
cmake = CMake(self)
cmake.verbose = True
cmake.configure(variables={'CMAKE_EXPORT_COMPILE_COMMANDS': 'ON'})
cmake.build()
cmake.test()
#cmake.ctest(cli_args=["--output-on-failure"])
def package(self):
cmake = CMake(self)
#cmake.configure()
cmake.install()
def package_info(self):
# These are default values and doesn't need to be adjusted
self.cpp_info.includedirs = ["include"]
self.cpp_info.libdirs = ["lib"]
self.cpp_info.bindirs = ["bin"]
self.cpp_info.libs = ["cppte"]
self.env_info.LD_LIBRARY_PATH.append(os.path.join(self.package_folder, "lib"))