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 Build Conan package on CI service
- Add Travis support for Conan package - Add Appveyor file to build on Windows Signed-off-by: Uilian Ries <uilianries@gmail.com>
- Loading branch information
1 parent
e05ad94
commit c6341ab
Showing
7 changed files
with
194 additions
and
6 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
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,20 @@ | ||
build: false | ||
|
||
environment: | ||
PYTHON: "C:\\Python37" | ||
|
||
matrix: | ||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
CONAN_VISUAL_VERSIONS: 12 | ||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
CONAN_VISUAL_VERSIONS: 14 | ||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 | ||
CONAN_VISUAL_VERSIONS: 15 | ||
|
||
install: | ||
- set PATH=%PATH%;%PYTHON%/Scripts/ | ||
- pip.exe install conan --upgrade | ||
- pip.exe install conan_package_tools bincrafters_package_tools | ||
|
||
test_script: | ||
- python conan/build.py |
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,9 @@ | ||
project(test_package CXX) | ||
cmake_minimum_required(VERSION 2.8.11) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) | ||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) |
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,19 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
import os | ||
from conans import ConanFile, CMake | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
assert os.path.isfile(os.path.join(self.deps_cpp_info["BehaviorTree.CPP"].rootpath, "licenses", "LICENSE")) | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
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,68 @@ | ||
#include "behaviortree_cpp/behavior_tree.h" | ||
#include "behaviortree_cpp/bt_factory.h" | ||
|
||
using namespace BT; | ||
|
||
NodeStatus SayHello() | ||
{ | ||
printf("hello\n"); | ||
return NodeStatus::SUCCESS; | ||
} | ||
|
||
class ActionTestNode : public ActionNode | ||
{ | ||
public: | ||
ActionTestNode(const std::string& name) : ActionNode(name) | ||
{ | ||
} | ||
|
||
NodeStatus tick() override | ||
{ | ||
time_ = 5; | ||
stop_loop_ = false; | ||
int i = 0; | ||
while (!stop_loop_ && i++ < time_) | ||
{ | ||
std::this_thread::sleep_for(std::chrono::milliseconds(100)); | ||
} | ||
return NodeStatus::SUCCESS; | ||
} | ||
|
||
virtual void halt() override | ||
{ | ||
stop_loop_ = true; | ||
setStatus(NodeStatus::IDLE); | ||
} | ||
|
||
private: | ||
int time_; | ||
std::atomic_bool stop_loop_; | ||
}; | ||
|
||
int main() | ||
{ | ||
BT::SequenceNode root("root"); | ||
BT::SimpleActionNode action1("say_hello", std::bind(SayHello)); | ||
ActionTestNode action2("async_action"); | ||
|
||
root.addChild(&action1); | ||
root.addChild(&action2); | ||
|
||
int count = 0; | ||
|
||
NodeStatus status = NodeStatus::RUNNING; | ||
|
||
while (status == NodeStatus::RUNNING) | ||
{ | ||
status = root.executeTick(); | ||
|
||
std::cout << count++ << " : " << root.status() << " / " << action1.status() << " / " | ||
<< action2.status() << std::endl; | ||
|
||
std::this_thread::sleep_for(std::chrono::milliseconds(100)); | ||
} | ||
|
||
haltAllActions(&root); | ||
|
||
return 0; | ||
} |
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,22 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
if [[ "$(uname -s)" == 'Darwin' ]]; then | ||
brew update || brew update | ||
brew outdated pyenv || brew upgrade pyenv | ||
brew install pyenv-virtualenv | ||
brew install cmake || true | ||
|
||
if which pyenv > /dev/null; then | ||
eval "$(pyenv init -)" | ||
fi | ||
|
||
pyenv install 3.7.1 | ||
pyenv virtualenv 3.7.1 conan | ||
pyenv rehash | ||
pyenv activate conan | ||
fi | ||
|
||
pip install -U conan_package_tools conan |
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