-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconanfile.py
75 lines (62 loc) · 2.86 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from conans import ConanFile, CMake, tools
from conans.model.version import Version
class Tf2Conan(ConanFile):
name = 'tf2'
version = 'melodic'
license = 'Creative Commons Attribution 3.0'
url = 'http://wiki.ros.org/tf2'
description = 'ROS-independent build of tf2, built by grabbing TF2 files from ros/geometry2/tf2, and supplying the dependencies with files normally installed by the ROS ppa'
settings = 'os', 'compiler', 'build_type', 'arch'
options = {'shared': [True, False]}
default_options = 'shared=True'
generators = 'cmake'
requires = (
'boost/[>=1.60,<1.69]@conan/stable',
'console_bridge/0.4.2@ntc/stable',
'helpers/0.3@ntc/stable',
)
options = {
'shared': [True, False],
}
default_options = ('shared=True')
exports_sources = 'include*', 'src*', 'CMakeLists.txt', 'patches*'
def config_options(self):
if 'Visual Studio' == self.settings.compiler:
# When shared, VS trips over a bunch of undeclared symbols. This
# is because that despite rostime_decl.h defining a ROSTIME_DELC to
# defined the proper import/export macros defined in macros.h, the
# macros aren't actually well distributed (e.g. buffer_core.h,
# geometry_msgs, etc.) This is still true for melodic.
self.options.remove('shared')
def source(self):
# Suppress the NO_ERROR conflict, as it appears that ROS doesn't want
# to https://github.com/ros/geometry2/issues/172
if 'Visual Studio' == self.settings.compiler:
if Version(str(self.settings.compiler.version)) < '14':
tools.replace_in_file(
file_path=os.path.join('include', 'tf2_msgs', 'TF2Error.h'),
search=' enum',
replace='#undef NO_ERROR\n enum'
)
else:
tools.patch(patch_file='patches/suppress_NO_ERROR.patch')
def _setup_cmake(self):
cmake = CMake(self)
cmake.definitions['BOOST_ROOT:PATH'] = self.deps_cpp_info['boost'].rootpath
cmake.definitions['BUILD_SHARED_LIBS:BOOL'] = 'TRUE' if 'shared' in self.options and self.options.shared else 'FALSE'
cmake.definitions['console_bridge_DIR:PATH'] = os.path.join(self.deps_cpp_info['console_bridge'].rootpath, 'lib', 'console_bridge', 'cmake')
return cmake
def build(self):
cmake = self._setup_cmake()
cmake.configure()
cmake.build()
def package(self):
cmake = self._setup_cmake()
cmake.configure()
cmake.install()
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
# vim: ts=4 sw=4 expandtab ffs=unix ft=python foldmethod=marker :