forked from BehaviorTree/BehaviorTree.CPP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BehaviorTree#2 Conan package support
- Add conan recipe for BehaviorTree.CPP Signed-off-by: Uilian Ries <uilianries@gmail.com>
- Loading branch information
1 parent
af22b2a
commit 46180f2
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
"""Conan recipe package for Google FlatBuffers | ||
""" | ||
from conans import ConanFile, CMake, tools | ||
|
||
|
||
class FlatbuffersConan(ConanFile): | ||
name = "BehaviorTree.CPP" | ||
license = "MIT" | ||
url = "https://github.com/BehaviorTree/BehaviorTree.CPP" | ||
author = "Davide Faconti <davide.faconti@gmail.com>" | ||
topics = ("conan", "behaviortree", "ai", "robotics", "games", "coordination") | ||
description = "This C++ library provides a framework to create BehaviorTrees. It was designed to be flexible, easy to use and fast." | ||
settings = "os", "compiler", "build_type", "arch" | ||
options = {"shared": [True, False], "zmq": [True, False]} | ||
default_options = {"shared": False, "zmq": True} | ||
generators = "cmake" | ||
exports = "LICENSE" | ||
exports_sources = ("cmake/*", "include/*", "src/*", "3rdparty/*", "CMakeLists.txt") | ||
|
||
def requirements(self): | ||
"""Install ZMQ when required | ||
""" | ||
if self.options.zmq: | ||
self.requires("cppzmq/4.3.0@bincrafters/stable") | ||
|
||
def _configure_cmake(self): | ||
"""Create CMake instance and execute configure step | ||
""" | ||
cmake = CMake(self) | ||
cmake.definitions["BUILD_EXAMPLES"] = False | ||
cmake.definitions["BUILD_UNIT_TESTS"] = False | ||
cmake.configure() | ||
return cmake | ||
|
||
def build(self): | ||
"""Configure, build and install FlatBuffers using CMake. | ||
""" | ||
tools.replace_in_file("CMakeLists.txt", | ||
"project(behaviortree_cpp)", | ||
"""project(behaviortree_cpp) | ||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup()""") | ||
cmake = self._configure_cmake() | ||
cmake.build() | ||
|
||
def package(self): | ||
"""Copy Flatbuffers' artifacts to package folder | ||
""" | ||
self.copy(pattern="LICENSE", dst="licenses") | ||
cmake = self._configure_cmake() | ||
cmake.install() | ||
|
||
def package_info(self): | ||
"""Collect built libraries names and solve flatc path. | ||
""" | ||
self.cpp_info.libs = tools.collect_libs(self) | ||
if self.settings.os == "Linux": | ||
self.cpp_info.libs.append("pthread") |