-
Notifications
You must be signed in to change notification settings - Fork 2
/
conanfile.py
67 lines (56 loc) · 2.29 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
import os
from os.path import join
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
from conan.tools.files import copy
from conan.tools.scm import Git
from conan.tools.files import get, chdir, mkdir
class OBCSoftwareRecipe(ConanFile):
name = "obc-sw"
version = "1.0"
revision_mode = "scm"
# Optional metadata
license = "MIT"
author = "SpaceDot - AcubeSAT, [email protected]"
url = "gitlab.com/acubesat/obc/obc-software"
description = "Software for the OBC subsystem of the AcubeSAT nanosatellite."
topics = ("satellite", "acubesat", "obc", "obc-software", "embedded")
# Binary configuration
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": False, "ecss-services/*:platform_definitions_path": os.path.abspath("inc/Platform/")}
# Sources are located in the same place as this recipe, copy them to the recipe
exports_sources = "CMakeLists.txt", "src/*", "inc/*", "lib/*"
generators = "CMakeDeps"
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def source(self):
repos = [
{"url": "[email protected]:acubesat/obc/cross-platform-software.git", "path": "cross-platform-software"},
{"url": "[email protected]:acubesat/obc/atsam-component-drivers.git", "path": "atsam-component-drivers"}
]
for repo in repos:
repo_path = os.path.join(repo["path"])
git = Git(self, "lib")
if not repo_path in os.listdir("lib"):
git.clone(repo["url"])
else:
git = Git(self, "lib/"+repo_path)
git.run("pull")
git = Git(self, "lib/"+repo_path)
git.run("submodule update --init --recursive")
def layout(self):
cmake_layout(self)
def generate(self):
tc = CMakeToolchain(self)
tc.variables["NO_SYSTEM_INCLUDE"] = True
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def requirements(self):
self.requires("etl/20.37.2")
self.requires("logger/1.0")
self.requires("ecss-services/1.2")