forked from ouster-lidar/ouster-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
112 lines (95 loc) · 3.69 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import os
from conans import ConanFile, CMake, tools
from pprint import pformat
class OusterSDKConan(ConanFile):
name = "ouster_sdk"
version = "0.4.0"
license = "BSD 3-Clause License"
author = "Ouster, Inc."
url = "https://github.com/ouster-lidar/ouster_example"
description = "Ouster SDK - tools for working with Ouster Lidars"
topics = ("lidar", "driver", "hardware", "point cloud", "3d", "robotics", "automotive")
settings = "os", "compiler", "build_type", "arch"
options = {
"build_viz": [True, False],
"build_pcap": [True, False],
"shared": [True, False],
"fPIC": [True, False],
"ensure_cpp17": [True, False]
}
default_options = {
"build_viz": False,
"build_pcap": False,
"shared": False,
"fPIC": True,
"ensure_cpp17": False
}
generators = "cmake_paths", "cmake_find_package"
exports_sources = [
"cmake/*",
"conan/*",
"ouster_client/*",
"ouster_pcap/*",
"ouster_viz/*",
"tests/*",
"CMakeLists.txt",
"CMakeSettings.json",
"LICENSE",
"LICENSE-bin",
"README.rst"
]
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def requirements(self):
self.requires("eigen/3.4.0")
self.requires("jsoncpp/1.9.5")
if self.options.build_pcap:
self.requires("libtins/4.3")
if self.options.build_viz:
self.requires("glad/0.1.35")
# glew is optional, and probably will not be needed
# self.requires("glew/2.2.0")
self.requires("glfw/3.3.6")
# maybe needed for cpp examples, but not for the lib
# self.requires("tclap/1.2.4")
def configure_cmake(self):
cmake = CMake(self)
cmake.definitions["BUILD_VIZ"] = True if self.options.build_viz else False
cmake.definitions["BUILD_PCAP"] = True if self.options.build_pcap else False
# alt way, but we use CMAKE_TOOLCHAIN_FILE in other pipeline so avoid overwrite
# cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = os.path.join(self.build_folder, "conan_paths.cmake")
cmake.definitions[
"CMAKE_PROJECT_ouster_example_INCLUDE"] = os.path.join(
self.build_folder, "conan_paths.cmake")
cmake.definitions["BUILD_SHARED_LIBS"] = True if self.options.shared else False
cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = (
True if self.options.fPIC else False
)
# we use this option until we remove nonstd::optional from SDK codebase (soon)
if self.options.ensure_cpp17:
cmake.definitions["CMAKE_CXX_STANDARD"] = 17
self.output.info("Cmake definitions: ")
self.output.info(pformat(cmake.definitions))
cmake.configure()
return cmake
def build(self):
cmake = self.configure_cmake()
cmake.build()
def package(self):
cmake = self.configure_cmake()
cmake.install()
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.includedirs = [
"include",
"include/optional-lite"
]
self.cpp_info.build_modules["cmake_find_package"].append(
"lib/cmake/OusterSDK/OusterSDKConfig.cmake"
)
self.cpp_info.set_property("cmake_file_name", "OusterSDK")
self.cpp_info.filenames["cmake_find_package"] = "OusterSDK"
self.cpp_info.filenames["cmake_find_package_multi"] = "OusterSDK"
self.cpp_info.names["cmake_find_package"] = "OusterSDK"
self.cpp_info.names["cmake_find_package_multi"] = "OusterSDK"