-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconanfile.py
More file actions
65 lines (52 loc) · 1.66 KB
/
Copy pathconanfile.py
File metadata and controls
65 lines (52 loc) · 1.66 KB
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
import re
from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import load
class ViamCsi(ConanFile):
name = "viam-csi"
license = "Apache-2.0"
url = "https://github.com/viam-modules/csi-camera"
package_type = "application"
settings = "os", "compiler", "build_type", "arch"
options = {"with_tests": [True, False]}
default_options = {
"with_tests": False,
"viam-cpp-sdk/*:shared": False,
}
exports_sources = (
"CMakeLists.txt",
"LICENSE",
"main.cpp",
"csi_camera.cpp",
"csi_camera.h",
"utils.cpp",
"utils.h",
"constraints.h",
"tests/*",
)
version = "0.0.2"
def set_version(self):
content = load(self, "CMakeLists.txt")
match = re.search(r"project\([^\)]*VERSION\s+([0-9]+\.[0-9]+\.[0-9]+)", content, re.MULTILINE | re.DOTALL)
if match:
self.version = match.group(1).strip()
def validate(self):
check_min_cppstd(self, 17)
def requirements(self):
# Phase 1 scope: migrate viam-cpp-sdk sourcing to Conan.
self.requires("viam-cpp-sdk/0.33.1")
def layout(self):
cmake_layout(self, src_folder=".")
def generate(self):
tc = CMakeToolchain(self)
tc.variables["VIAM_CSI_ENABLE_TESTS"] = self.options.with_tests
tc.generate()
CMakeDeps(self).generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()