conanfile.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 
00004 """Conan recipe package for BehaviorTree.CPP
00005 """
00006 from conans import ConanFile, CMake, tools
00007 from conans.model.version import Version
00008 from conans.errors import ConanInvalidConfiguration
00009 
00010 
00011 class BehaviorTreeConan(ConanFile):
00012     name = "BehaviorTree.CPP"
00013     license = "MIT"
00014     url = "https://github.com/BehaviorTree/BehaviorTree.CPP"
00015     author = "Davide Faconti <davide.faconti@gmail.com>"
00016     topics = ("conan", "behaviortree", "ai", "robotics", "games", "coordination")
00017     description = "This C++ library provides a framework to create BehaviorTrees. It was designed to be flexible, easy to use and fast."
00018     settings = "os", "compiler", "build_type", "arch"
00019     options = {"shared": [True, False]}
00020     default_options = {"shared": False}
00021     generators = "cmake"
00022     exports = "LICENSE"
00023     exports_sources = ("cmake/*", "include/*", "src/*", "3rdparty/*", "CMakeLists.txt")
00024     requires = "cppzmq/4.3.0@bincrafters/stable"
00025 
00026     def configure(self):
00027         if self.settings.os == "Linux" and \
00028            self.settings.compiler == "gcc" and \
00029            Version(self.settings.compiler.version.value) < "5":
00030             raise ConanInvalidConfiguration("BehaviorTree.CPP can not be built by GCC < 5")
00031         if self.settings.os == "Windows":
00032             raise ConanInvalidConfiguration("BehaviorTree.CPP is not prepared to be built on Windows yet")
00033 
00034     def _configure_cmake(self):
00035         """Create CMake instance and execute configure step
00036         """
00037         cmake = CMake(self)
00038         cmake.definitions["BUILD_EXAMPLES"] = False
00039         cmake.definitions["BUILD_UNIT_TESTS"] = False
00040         cmake.configure()
00041         return cmake
00042 
00043     def build(self):
00044         """Configure, build and install BehaviorTree using CMake.
00045         """
00046         tools.replace_in_file("CMakeLists.txt",
00047                               "project(behaviortree_cpp)",
00048                               """project(behaviortree_cpp)
00049                               include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
00050                               conan_basic_setup()""")
00051         # INFO (uilian): zmq could require libsodium
00052         tools.replace_in_file("CMakeLists.txt",
00053                              "BEHAVIOR_TREE_EXTERNAL_LIBRARIES zmq",
00054                              "BEHAVIOR_TREE_EXTERNAL_LIBRARIES ${CONAN_LIBS}")
00055         cmake = self._configure_cmake()
00056         cmake.build()
00057 
00058     def package(self):
00059         """Copy BehaviorTree artifacts to package folder
00060         """
00061         self.copy(pattern="LICENSE", dst="licenses")
00062         cmake = self._configure_cmake()
00063         cmake.install()
00064 
00065     def package_info(self):
00066         """Collect built libraries names and solve pthread path.
00067         """
00068         self.cpp_info.libs = tools.collect_libs(self)
00069         if self.settings.os == "Linux":
00070             self.cpp_info.libs.append("pthread")


behaviortree_cpp
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Sat Feb 2 2019 03:50:10