Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into crossdoor_plugin_ex…
Browse files Browse the repository at this point in the history
…port
  • Loading branch information
MarqRazz committed Apr 12, 2024
2 parents 6e3ba41 + 3cc7b4e commit 6b3528f
Show file tree
Hide file tree
Showing 19 changed files with 2,036 additions and 928 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/cmake_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ jobs:
os: [windows-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
with:
version: 1.59.0

- name: Create default profile
run: conan profile new default --detect
run: conan profile detect

- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
Expand Down
46 changes: 7 additions & 39 deletions .github/workflows/pixi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,21 @@ name: Pixi (conda)

on: [push, pull_request]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
# Note if this value is changed, has to be manually updated in the `windows-latest` tests_command
BUILD_TYPE: Release

jobs:
pixi_conda_build:
strategy:
matrix:
include:
- os: windows-latest
build_depend: vs2022_win-64=19.*
tests_command: "'PATH=\\\"$PATH;build/Release\\\" build/tests/Release/behaviortree_cpp_test.exe'"
- os: ubuntu-latest
build_depend: "gxx=12.2.*"
tests_command: "./build/tests/behaviortree_cpp_test"
os:
- windows-latest
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
# Pixi is the tool used to create/manage conda environment
- uses: prefix-dev/[email protected]
with:
pixi-version: v0.7.0
locked: false
frozen: false
run-install: false
manifest-path: build-env/pixi.yaml
- name: Make pixi workspace
run: |
pixi init build-env
- name: Install dependencies
working-directory: ${{github.workspace}}/build-env
run: |
pixi add cmake zeromq=4.3.4 gtest=1.12.* gmock=1.12.* sqlite=3.40.* ${{ matrix.build-depend }}
pixi install
- name: Create Build Directory
working-directory: ${{github.workspace}}/build-env
run: mkdir build
- uses: actions/checkout@v3
- uses: prefix-dev/[email protected]
with:
path: build-env/BehaviorTree.CPP
pixi-version: v0.16.1
- name: Build
working-directory: ${{github.workspace}}/build-env
run: |
pixi task add build "cd build; cmake ../BehaviorTree.CPP -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}; cmake --build . --parallel --config ${{env.BUILD_TYPE}}"
pixi run build
run: pixi run build
- name: Run tests
working-directory: ${{github.workspace}}/build-env
run: |
pixi task add tests ${{ matrix.tests_command }}
pixi run tests
run: pixi run test
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ CMakeSettings.json

# OSX junk
.DS_Store

# pixi environments
.pixi

CMakeUserPresets.json
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ target_link_libraries(${BTCPP_LIBRARY}
Threads::Threads
${CMAKE_DL_LIBS}
$<BUILD_INTERFACE:foonathan::lexy>
PUBLIC
${BTCPP_EXTRA_LIBRARIES}
)

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[![conan Windows](https://github.com/BehaviorTree/BehaviorTree.CPP/actions/workflows/cmake_windows.yml/badge.svg)](https://github.com/BehaviorTree/BehaviorTree.CPP/actions/workflows/cmake_windows.yml)
[![ros1](https://github.com/BehaviorTree/BehaviorTree.CPP/workflows/ros1/badge.svg?branch=master)](https://github.com/BehaviorTree/BehaviorTree.CPP/actions?query=workflow%3Aros1)
[![ros2](https://github.com/BehaviorTree/BehaviorTree.CPP/workflows/ros2/badge.svg?branch=master)](https://github.com/BehaviorTree/BehaviorTree.CPP/actions?query=workflow%3Aros2)
[![pixi (Conda)](https://github.com/BehaviorTree/BehaviorTree.CPP/actions/workflows/pixi.yaml/badge.svg)](https://github.com/BehaviorTree/BehaviorTree.CPP/actions/workflows/pixi.yaml)

# BehaviorTree.CPP 4.5

Expand Down Expand Up @@ -87,6 +88,11 @@ cmake ../BehaviorTree.CPP
cmake --build . --parallel
```

If you want to build in a [pixi](https://pixi.sh/) project (conda virtual environment).
```
pixi run build
```

If you want to use BT.CPP in your application, please refer to the
example here: https://github.com/BehaviorTree/btcpp_sample .

Expand Down
27 changes: 23 additions & 4 deletions include/behaviortree_cpp/basic_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ using StringView = std::string_view;

bool StartWith(StringView str, StringView prefix);

bool StartWith(StringView str, char prefix);

// vector of key/value pairs
using KeyValueVector = std::vector<std::pair<std::string, std::string>>;

Expand Down Expand Up @@ -144,16 +146,28 @@ template <>
[[nodiscard]] const char* convertFromString<const char*>(StringView str);

template <>
[[nodiscard]] int convertFromString<int>(StringView str);
[[nodiscard]] int8_t convertFromString<int8_t>(StringView str);

template <>
[[nodiscard]] int16_t convertFromString<int16_t>(StringView str);

template <>
[[nodiscard]] unsigned convertFromString<unsigned>(StringView str);
[[nodiscard]] int32_t convertFromString<int32_t>(StringView str);

template <>
[[nodiscard]] long convertFromString<long>(StringView str);
[[nodiscard]] int64_t convertFromString<int64_t>(StringView str);

template <>
[[nodiscard]] unsigned long convertFromString<unsigned long>(StringView str);
[[nodiscard]] uint8_t convertFromString<uint8_t>(StringView str);

template <>
[[nodiscard]] uint16_t convertFromString<uint16_t>(StringView str);

template <>
[[nodiscard]] uint32_t convertFromString<uint32_t>(StringView str);

template <>
[[nodiscard]] uint64_t convertFromString<uint64_t>(StringView str);

template <>
[[nodiscard]] float convertFromString<float>(StringView str);
Expand All @@ -169,6 +183,11 @@ template <>
template <>
[[nodiscard]] std::vector<double> convertFromString<std::vector<double>>(StringView str);

// Strings separated by the character ";"
template <>
[[nodiscard]] std::vector<std::string>
convertFromString<std::vector<std::string>>(StringView str);

// This recognizes either 0/1, true/false, TRUE/FALSE
template <>
[[nodiscard]] bool convertFromString<bool>(StringView str);
Expand Down
Loading

0 comments on commit 6b3528f

Please sign in to comment.