-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconanfile.py
75 lines (54 loc) · 1.93 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
from conan import ConanFile
from conan.tools.files import copy
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
from typing import List
import os
class Recipe(ConanFile):
name = 'serial-plotter'
version = '0.0.2'
description = 'Interactive tool for plotting data received via a serial port'
settings = 'os', 'arch', 'compiler', 'build_type'
requires = [
'boost/1.80.0',
'sdl/2.26.1',
'imgui/1.89.8',
'implot/0.16',
'glad/0.1.36'
]
keep_imports = True
def configure(self):
# UI Tool settings
self.options['glad'].spec = 'gl'
self.options['glad'].gl_profile = 'core'
self.options['glad'].gl_version = '3.2'
# Turn off the Pulse Audio support for non-windows OSs
if self.settings.os != 'Windows':
self.options['sdl'].pulse = False
if self.settings.os == 'Macos':
self.options['boost'].with_stacktrace_backtrace = False
def layout(self):
cmake_layout(self)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def _import_bindings(self, target_dir):
if not os.path.exists(target_dir):
os.makedirs(target_dir)
for dep in self.dependencies.values():
srcdirs = dep.cpp_info.srcdirs # type: List[str]
if len(srcdirs) == 0:
continue
for src_dir in srcdirs:
print(src_dir)
copy(self, pattern='*.h', dst=target_dir, src=src_dir)
copy(self, pattern='*.cpp', dst=target_dir, src=src_dir)
def generate(self):
tc = CMakeToolchain(self)
tc.generate()
cmake_deps = CMakeDeps(self)
cmake_deps.generate()
self._import_bindings(target_dir=os.path.join(self.build_folder, 'bindings'))
def package(self):
cmake = CMake(self)
cmake.install()