diff --git a/CMakeLists.txt b/CMakeLists.txt index b5b9bbea..03f24e0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ add_library(${PROJECT_NAME} INTERFACE) # Download the cpp-peglib header file needed file(DOWNLOAD - https://raw.githubusercontent.com/yhirose/cpp-peglib/master/peglib.h + https://raw.githubusercontent.com/yhirose/cpp-peglib/v1.8.2/peglib.h ${PROJECT_SOURCE_DIR}/thirdparty/cpp-peglib/peglib.h ) @@ -40,7 +40,7 @@ target_include_directories(${PROJECT_NAME} $ $ $ - $ + # $ ) target_compile_features(${PROJECT_NAME} @@ -231,12 +231,13 @@ set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Installation dir set(DATA_INSTALL_DIR ${CMAKE_INSTALL_DATADIR} CACHE PATH "Installation directory for data") include(CMakePackageConfigHelpers) +string(REPLACE "/${CMAKE_LIBRARY_ARCHITECTURE}" "" CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}") configure_package_config_file( ${PROJECT_SOURCE_DIR}/cmake/config.cmake.in ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-config.cmake INSTALL_DESTINATION - ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake + ${CMAKE_INSTALL_LIBDIR_ARCHIND}/cmake/${PROJECT_NAME} PATH_VARS BIN_INSTALL_DIR INCLUDE_INSTALL_DIR @@ -278,7 +279,7 @@ install( DIRECTORY ${PROJECT_SOURCE_DIR}/thirdparty/cpp-peglib/ DESTINATION - thirdparty/cpp-peglib/include + ${INCLUDE_INSTALL_DIR} # this is a hack, but it's still more appropriate than thirdparty FILES_MATCHING PATTERN "*.h" ) @@ -295,5 +296,5 @@ install( ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-config.cmake ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-config-version.cmake DESTINATION - ${DATA_INSTALL_DIR}/${PROJECT_NAME}/cmake + ${CMAKE_INSTALL_LIBDIR_ARCHIND}/cmake/${PROJECT_NAME} ) diff --git a/include/xtypes/DynamicDataImpl.hpp b/include/xtypes/DynamicDataImpl.hpp index 61c92054..2411eb34 100644 --- a/include/xtypes/DynamicDataImpl.hpp +++ b/include/xtypes/DynamicDataImpl.hpp @@ -142,16 +142,16 @@ inline std::string ReadableDynamicDataRef::to_string() const ss << "<" << type_name << "> " << node.data().value(); break; case TypeKind::CHAR_16_TYPE: - ss << "<" << type_name << "> " << node.data().value(); + ss << "<" << type_name << "> " << static_cast(node.data().value()); break; case TypeKind::WIDE_CHAR_TYPE: - ss << "<" << type_name << "> " << node.data().value(); + ss << "<" << type_name << "> " << static_cast(node.data().value()); break; case TypeKind::INT_8_TYPE: - ss << "<" << type_name << "> " << node.data().value(); + ss << "<" << type_name << "> " << static_cast(node.data().value()); break; case TypeKind::UINT_8_TYPE: - ss << "<" << type_name << "> " << node.data().value(); + ss << "<" << type_name << "> " << static_cast(node.data().value()); break; case TypeKind::INT_16_TYPE: ss << "<" << type_name << "> " << node.data().value(); diff --git a/include/xtypes/StringType.hpp b/include/xtypes/StringType.hpp index 7fe289ef..9407b509 100644 --- a/include/xtypes/StringType.hpp +++ b/include/xtypes/StringType.hpp @@ -109,7 +109,7 @@ class TStringType : public MutableCollectionType virtual void destroy_instance( uint8_t* instance) const override { - reinterpret_cast*>(instance)->std::basic_string::~basic_string(); + reinterpret_cast*>(instance)->std::template basic_string::~basic_string(); } virtual bool compare_instance( diff --git a/include/xtypes/UnionType.hpp b/include/xtypes/UnionType.hpp index bb4e239a..1f051515 100644 --- a/include/xtypes/UnionType.hpp +++ b/include/xtypes/UnionType.hpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace eprosima { namespace xtypes { diff --git a/include/xtypes/idl/generator.hpp b/include/xtypes/idl/generator.hpp index cb4f1d24..696f7e1a 100644 --- a/include/xtypes/idl/generator.hpp +++ b/include/xtypes/idl/generator.hpp @@ -242,14 +242,14 @@ inline std::string label_value( { char16_t temp = static_cast(value); std::stringstream ss; - ss << "L'" << temp << "'"; + ss << "L'" << static_cast(temp) << "'"; return ss.str(); } case TypeKind::WIDE_CHAR_TYPE: { wchar_t temp = static_cast(value); std::stringstream ss; - ss << "L'" << temp << "'"; + ss << "L'" << static_cast(temp) << "'"; return ss.str(); } case TypeKind::INT_8_TYPE: diff --git a/include/xtypes/idl/parser.hpp b/include/xtypes/idl/parser.hpp index 618acd48..d78f924e 100644 --- a/include/xtypes/idl/parser.hpp +++ b/include/xtypes/idl/parser.hpp @@ -284,8 +284,9 @@ class Parser , context_(nullptr) { parser_.enable_ast(); - parser_.log = std::bind(&Parser::parser_log_cb_, this, std::placeholders::_1, + peg::Log log = std::bind(&Parser::parser_log_cb_, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); + parser_.set_logger(log); } Context parse( @@ -675,8 +676,9 @@ class Parser to_lower(aux_id); } - for (const std::string& name : parser_.get_rule_names()) + for (const auto &item : parser_.get_grammar()) { + const auto &name = item.first; if (name.find("KW_") == 0) // If it starts with "KW_", is a reserved word. You are welcome. { if (parser_[name.c_str()].parse(aux_id.c_str()).ret)