Skip to content

Commit

Permalink
Merge branch 'master' of github.com:BehaviorTree/BehaviorTree.CPP
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Sep 13, 2024
2 parents 957a7f8 + 4f66447 commit 28267ff
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ else()
include(cmake/conan_build.cmake)
endif()


#############################################################
# LIBRARY

Expand Down Expand Up @@ -187,6 +186,7 @@ target_compile_definitions(${BTCPP_LIBRARY} PUBLIC BTCPP_LIBRARY_VERSION="${CMAK
target_compile_features(${BTCPP_LIBRARY} PUBLIC cxx_std_17)

if(MSVC)
target_compile_options(${BTCPP_LIBRARY} PRIVATE "/source-charset:utf-8")
else()
target_compile_options(${BTCPP_LIBRARY} PRIVATE -Wall -Wextra)
endif()
Expand Down
12 changes: 12 additions & 0 deletions sample_nodes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,15 @@ target_link_libraries(movebase_node_dyn PRIVATE ${BTCPP_LIBRARY})
target_compile_definitions(movebase_node_dyn PRIVATE BT_PLUGIN_EXPORT )
set_target_properties(movebase_node_dyn PROPERTIES LIBRARY_OUTPUT_DIRECTORY
${BTCPP_BIN_DESTINATION} )

######################################################
# INSTALL plugins for other packages to load

INSTALL(TARGETS
crossdoor_nodes_dyn
dummy_nodes_dyn
movebase_node_dyn
LIBRARY DESTINATION share/${PROJECT_NAME}/bt_plugins
ARCHIVE DESTINATION share/${PROJECT_NAME}/bt_plugins
RUNTIME DESTINATION share/${PROJECT_NAME}/bt_plugins
)
8 changes: 8 additions & 0 deletions sample_nodes/crossdoor_nodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,11 @@ void CrossDoor::reset()
_door_locked = true;
_pick_attempts = 0;
}

// This function must be implemented in the .cpp file to create
// a plugin that can be loaded at run-time
BT_REGISTER_NODES(factory)
{
static CrossDoor cross_door;
cross_door.registerNodes(factory);
}
13 changes: 12 additions & 1 deletion src/xml_parsing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
#include <string>
#include <typeindex>

#if defined(_MSVC_LANG) && !defined(__clang__)
#define __bt_cplusplus (_MSC_VER == 1900 ? 201103L : _MSVC_LANG)
#else
#define __bt_cplusplus __cplusplus
#endif

#if defined(__linux) || defined(__linux__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattributes"
Expand Down Expand Up @@ -254,7 +260,12 @@ void XMLParser::PImpl::loadDocImpl(XMLDocument* doc, bool add_includes)
break;
}

std::filesystem::path file_path(incl_node->Attribute("path"));
#if __bt_cplusplus >= 202002L
auto file_path(std::filesystem::path(incl_node->Attribute("path")));
#else
auto file_path(std::filesystem::u8path(incl_node->Attribute("path")));
#endif

const char* ros_pkg_relative_path = incl_node->Attribute("ros_pkg");

if(ros_pkg_relative_path)
Expand Down

0 comments on commit 28267ff

Please sign in to comment.