Skip to content

Commit 3cc7b4e

Browse files
committed
Merge branch 'master' of github.com:BehaviorTree/BehaviorTree.CPP
2 parents 1ef1c4d + 26ea2de commit 3cc7b4e

File tree

12 files changed

+1758
-57
lines changed

12 files changed

+1758
-57
lines changed

.github/workflows/cmake_windows.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ jobs:
2323
- name: Install Conan
2424
id: conan
2525
uses: turtlebrowser/get-conan@main
26-
with:
27-
version: 1.59.0
2826

2927
- name: Create default profile
30-
run: conan profile new default --detect
28+
run: conan profile detect
3129

3230
- name: Create Build Environment
3331
# Some projects don't allow in-source building, so create a separate build directory

.github/workflows/pixi.yaml

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,21 @@ name: Pixi (conda)
22

33
on: [push, pull_request]
44

5-
env:
6-
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
7-
# Note if this value is changed, has to be manually updated in the `windows-latest` tests_command
8-
BUILD_TYPE: Release
9-
105
jobs:
116
pixi_conda_build:
127
strategy:
138
matrix:
14-
include:
15-
- os: windows-latest
16-
build_depend: vs2022_win-64=19.*
17-
tests_command: "'PATH=\\\"$PATH;build/Release\\\" build/tests/Release/behaviortree_cpp_test.exe'"
18-
- os: ubuntu-latest
19-
build_depend: "gxx=12.2.*"
20-
tests_command: "./build/tests/behaviortree_cpp_test"
9+
os:
10+
- windows-latest
11+
- ubuntu-latest
2112
runs-on: ${{ matrix.os }}
2213
steps:
2314
# Pixi is the tool used to create/manage conda environment
24-
- uses: prefix-dev/[email protected]
25-
with:
26-
pixi-version: v0.7.0
27-
locked: false
28-
frozen: false
29-
run-install: false
30-
manifest-path: build-env/pixi.yaml
31-
- name: Make pixi workspace
32-
run: |
33-
pixi init build-env
34-
- name: Install dependencies
35-
working-directory: ${{github.workspace}}/build-env
36-
run: |
37-
pixi add cmake zeromq=4.3.4 gtest=1.12.* gmock=1.12.* sqlite=3.40.* ${{ matrix.build-depend }}
38-
pixi install
39-
- name: Create Build Directory
40-
working-directory: ${{github.workspace}}/build-env
41-
run: mkdir build
4215
- uses: actions/checkout@v3
16+
- uses: prefix-dev/[email protected]
4317
with:
44-
path: build-env/BehaviorTree.CPP
18+
pixi-version: v0.16.1
4519
- name: Build
46-
working-directory: ${{github.workspace}}/build-env
47-
run: |
48-
pixi task add build "cd build; cmake ../BehaviorTree.CPP -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}; cmake --build . --parallel --config ${{env.BUILD_TYPE}}"
49-
pixi run build
20+
run: pixi run build
5021
- name: Run tests
51-
working-directory: ${{github.workspace}}/build-env
52-
run: |
53-
pixi task add tests ${{ matrix.tests_command }}
54-
pixi run tests
22+
run: pixi run test

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ CMakeSettings.json
1111

1212
# OSX junk
1313
.DS_Store
14+
15+
# pixi environments
16+
.pixi
17+
18+
CMakeUserPresets.json

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ target_link_libraries(${BTCPP_LIBRARY}
161161
Threads::Threads
162162
${CMAKE_DL_LIBS}
163163
$<BUILD_INTERFACE:foonathan::lexy>
164+
PUBLIC
164165
${BTCPP_EXTRA_LIBRARIES}
165166
)
166167

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![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)
55
[![ros1](https://github.com/BehaviorTree/BehaviorTree.CPP/workflows/ros1/badge.svg?branch=master)](https://github.com/BehaviorTree/BehaviorTree.CPP/actions?query=workflow%3Aros1)
66
[![ros2](https://github.com/BehaviorTree/BehaviorTree.CPP/workflows/ros2/badge.svg?branch=master)](https://github.com/BehaviorTree/BehaviorTree.CPP/actions?query=workflow%3Aros2)
7+
[![pixi (Conda)](https://github.com/BehaviorTree/BehaviorTree.CPP/actions/workflows/pixi.yaml/badge.svg)](https://github.com/BehaviorTree/BehaviorTree.CPP/actions/workflows/pixi.yaml)
78

89
# BehaviorTree.CPP 4.5
910

@@ -87,6 +88,11 @@ cmake ../BehaviorTree.CPP
8788
cmake --build . --parallel
8889
```
8990

91+
If you want to build in a [pixi](https://pixi.sh/) project (conda virtual environment).
92+
```
93+
pixi run build
94+
```
95+
9096
If you want to use BT.CPP in your application, please refer to the
9197
example here: https://github.com/BehaviorTree/btcpp_sample .
9298

include/behaviortree_cpp/json_export.h

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ namespace BT
4949
class JsonExporter
5050
{
5151
public:
52-
static JsonExporter& get()
53-
{
54-
static JsonExporter global_instance;
55-
return global_instance;
56-
}
52+
static JsonExporter& get();
5753

5854
/**
5955
* @brief toJson adds the content of "any" to the JSON "destination".
@@ -100,15 +96,12 @@ template <typename T>
10096
inline void JsonExporter::addConverter()
10197
{
10298
ToJonConverter to_converter = [](const BT::Any& entry, nlohmann::json& dst) {
103-
using namespace nlohmann;
104-
to_json(dst, *const_cast<BT::Any&>(entry).castPtr<T>());
99+
dst = *const_cast<BT::Any&>(entry).castPtr<T>();
105100
};
106101
to_json_converters_.insert({ typeid(T), to_converter });
107102

108-
FromJonConverter from_converter = [](const nlohmann::json& dst) -> Entry {
109-
T value;
110-
using namespace nlohmann;
111-
from_json(dst, value);
103+
FromJonConverter from_converter = [](const nlohmann::json& src) -> Entry {
104+
T value = src.get<T>();
112105
return { BT::Any(value), BT::TypeInfo::Create<T>() };
113106
};
114107

0 commit comments

Comments
 (0)