Skip to content

Commit 00efa17

Browse files
committed
fixed:
1. cmake add msvc option /utf-8 2. xml_parsing using filesystem u8path at c++17
1 parent 1aa02f2 commit 00efa17

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ else()
7474
include(cmake/conan_build.cmake)
7575
endif()
7676

77+
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
78+
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
7779

7880
#############################################################
7981
# LIBRARY

src/xml_parsing.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,17 @@
1919
#include <string>
2020
#include <typeindex>
2121

22+
#define __bt_cplusplus __cplusplus
23+
#if defined(_MSVC_LANG) && !defined(__clang__)
24+
#define __bt_cplusplus (_MSC_VER == 1900 ? 201103L : _MSVC_LANG)
25+
#endif
26+
2227
#if defined(__linux) || defined(__linux__)
2328
#pragma GCC diagnostic push
2429
#pragma GCC diagnostic ignored "-Wattributes"
2530
#endif
2631

32+
2733
#include <map>
2834
#include "behaviortree_cpp/xml_parsing.h"
2935
#include "tinyxml2/tinyxml2.h"
@@ -37,6 +43,8 @@
3743
#include <ament_index_cpp/get_package_share_directory.hpp>
3844
#endif
3945

46+
#include <iso646.h>
47+
4048
#include "behaviortree_cpp/blackboard.h"
4149
#include "behaviortree_cpp/tree_node.h"
4250
#include "behaviortree_cpp/utils/demangle_util.h"
@@ -254,7 +262,12 @@ void XMLParser::PImpl::loadDocImpl(XMLDocument* doc, bool add_includes)
254262
break;
255263
}
256264

257-
std::filesystem::path file_path(incl_node->Attribute("path"));
265+
#if __xx_cplusplus >= 202002L
266+
auto file_path(incl_node->Attribute("path"));
267+
#else
268+
auto file_path(std::filesystem::u8path(incl_node->Attribute("path")));
269+
#endif
270+
258271
const char* ros_pkg_relative_path = incl_node->Attribute("ros_pkg");
259272

260273
if(ros_pkg_relative_path)

0 commit comments

Comments
 (0)