diff --git a/CMakeLists.txt b/CMakeLists.txt index 38d820bb2..2b6445045 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,8 @@ else() include(cmake/conan_build.cmake) endif() +add_compile_options("$<$:/utf-8>") +add_compile_options("$<$:/utf-8>") ############################################################# # LIBRARY diff --git a/src/xml_parsing.cpp b/src/xml_parsing.cpp index adb8c8247..9bcfac08d 100644 --- a/src/xml_parsing.cpp +++ b/src/xml_parsing.cpp @@ -19,11 +19,17 @@ #include #include +#define __bt_cplusplus __cplusplus +#if defined(_MSVC_LANG) && !defined(__clang__) +#define __bt_cplusplus (_MSC_VER == 1900 ? 201103L : _MSVC_LANG) +#endif + #if defined(__linux) || defined(__linux__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wattributes" #endif + #include #include "behaviortree_cpp/xml_parsing.h" #include "tinyxml2/tinyxml2.h" @@ -37,6 +43,8 @@ #include #endif +#include + #include "behaviortree_cpp/blackboard.h" #include "behaviortree_cpp/tree_node.h" #include "behaviortree_cpp/utils/demangle_util.h" @@ -254,7 +262,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(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)