Skip to content

Commit

Permalink
BehaviorTree#2 Conan package support
Browse files Browse the repository at this point in the history
- Add conan recipe for BehaviorTree.CPP

Signed-off-by: Uilian Ries <uilianries@gmail.com>
  • Loading branch information
uilianries committed Nov 24, 2018
1 parent af22b2a commit 1a3d3d5
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions conanfile.py
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 BehaviorTree.CPP
"""
from conans import ConanFile, CMake, tools


class BehaviorTreeConan(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 BehaviorTree 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 BehaviorTree 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 pthread path.
"""
self.cpp_info.libs = tools.collect_libs(self)
if self.settings.os == "Linux":
self.cpp_info.libs.append("pthread")

0 comments on commit 1a3d3d5

Please sign in to comment.