conanfile.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 """Conan recipe package for BehaviorTree.CPP
5 """
6 from conans import ConanFile, CMake, tools
7 from conans.model.version import Version
8 from conans.errors import ConanInvalidConfiguration
9 
10 
11 class BehaviorTreeConan(ConanFile):
12  name = "BehaviorTree.CPP"
13  license = "MIT"
14  url = "https://github.com/BehaviorTree/BehaviorTree.CPP"
15  author = "Davide Faconti <davide.faconti@gmail.com>"
16  topics = ("conan", "behaviortree", "ai", "robotics", "games", "coordination")
17  description = "This C++ library provides a framework to create BehaviorTrees. It was designed to be flexible, easy to use and fast."
18  settings = "os", "compiler", "build_type", "arch"
19  options = {"shared": [True, False]}
20  default_options = {"shared": False}
21  generators = "cmake"
22  exports = "LICENSE"
23  exports_sources = ("cmake/*", "include/*", "src/*", "3rdparty/*", "CMakeLists.txt")
24  requires = "cppzmq/4.3.0@bincrafters/stable"
25 
26  def configure(self):
27  if self.settings.os == "Linux" and \
28  self.settings.compiler == "gcc" and \
29  Version(self.settings.compiler.version.value) < "5":
30  raise ConanInvalidConfiguration("BehaviorTree.CPP can not be built by GCC < 5")
31  if self.settings.os == "Windows":
32  raise ConanInvalidConfiguration("BehaviorTree.CPP is not prepared to be built on Windows yet")
33 
34  def _configure_cmake(self):
35  """Create CMake instance and execute configure step
36  """
37  cmake = CMake(self)
38  cmake.definitions["BUILD_EXAMPLES"] = False
39  cmake.definitions["BUILD_UNIT_TESTS"] = False
40  cmake.configure()
41  return cmake
42 
43  def build(self):
44  """Configure, build and install BehaviorTree using CMake.
45  """
46  tools.replace_in_file("CMakeLists.txt",
47  "project(behaviortree_cpp)",
48  """project(behaviortree_cpp)
49  include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
50  conan_basic_setup()""")
51  # INFO (uilian): zmq could require libsodium
52  tools.replace_in_file("CMakeLists.txt",
53  "BEHAVIOR_TREE_EXTERNAL_LIBRARIES zmq",
54  "BEHAVIOR_TREE_EXTERNAL_LIBRARIES ${CONAN_LIBS}")
55  cmake = self._configure_cmake()
56  cmake.build()
57 
58  def package(self):
59  """Copy BehaviorTree artifacts to package folder
60  """
61  self.copy(pattern="LICENSE", dst="licenses")
62  cmake = self._configure_cmake()
63  cmake.install()
64 
65  def package_info(self):
66  """Collect built libraries names and solve pthread path.
67  """
68  self.cpp_info.libs = tools.collect_libs(self)
69  if self.settings.os == "Linux":
70  self.cpp_info.libs.append("pthread")


behaviortree_cpp
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Sat Feb 2 2019 04:01:53