-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
64 lines (51 loc) · 1.64 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
from conan import ConanFile
from conan.tools.cmake import CMake
from conans.tools import load
import re
def get_version():
try:
content = load("CMakeLists.txt")
version = re.search(r"set\(REMODULE_VERSION (.*)\)", content).group(1)
return version.strip()
except Exception as e:
print(e)
return None
class Recipe(ConanFile):
name = "remodule"
version = get_version()
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {
"catch2/*:with_main": True,
"shared": False,
"fPIC": True
}
scm = {
"type": "git",
"url": "auto",
"revision": "auto"
}
exports_sources = ["source/*", "include/*", "cmake/*", "CMakeLists.txt", "test/*"]
def configure(self):
if self.options["shared"] and self.settings.os == "Linux":
self.options["*:fPIC"] = True
def layout(self):
self.folders.generators = "conan"
self.folders.build = "build"
def requirements(self):
# Testing only dependencies below
self.requires("catch2/2.13.9")
def _configure_cmake(self):
cmake = CMake(self)
cmake.configure()
return cmake
def build(self):
cmake = self._configure_cmake()
cmake.build()
def package(self):
self.copy(pattern="LICENSE.md", dst="licenses", src=self.source_folder)
cmake = self._configure_cmake()
cmake.install()
def package_info(self):
self.cpp_info.libs = ["remodule"]