From b48be63f2eff4783f11adc8096f35ab38a39197f Mon Sep 17 00:00:00 2001 From: Philipp Dittmann Date: Thu, 1 Jun 2023 19:04:53 +0200 Subject: [PATCH] Fix clang compile; fix Windows, macOS packaging Credits go to peetonn: https://github.com/peetonn/ROSBridge2Unreal/commit/cfe4a89451039a4f680fc41c722cf85afd62b131 https://github.com/peetonn/ROSBridge2Unreal/commit/89530259b36c6fbfe5d02bd8fb6482bbc413f7ef --- Source/Rosbridge2Unreal/Public/DataHelpers.h | 13 ++++++------- Source/Rosbridge2Unreal/Rosbridge2Unreal.Build.cs | 2 ++ .../jsoncons/include/jsoncons/basic_json.hpp | 6 ------ .../include/jsoncons/config/compiler_support.hpp | 8 ++++---- .../jsoncons/include/jsoncons/staj_iterator.hpp | 8 -------- 5 files changed, 12 insertions(+), 25 deletions(-) diff --git a/Source/Rosbridge2Unreal/Public/DataHelpers.h b/Source/Rosbridge2Unreal/Public/DataHelpers.h index 49cde44..652943f 100644 --- a/Source/Rosbridge2Unreal/Public/DataHelpers.h +++ b/Source/Rosbridge2Unreal/Public/DataHelpers.h @@ -138,7 +138,7 @@ namespace DataHelpers { ROSData Data; Message->ToData(Data); - DataHelpers::Append(OutMessage, Key, Data); + Internal::DataConverter::Append(OutMessage, Key, Data); } static inline bool Extract(const ROSData& Message, const char* Key, T*& OutMessageInstance) @@ -174,17 +174,16 @@ namespace DataHelpers for (const auto& Value : Array) { const std::string Path = "/" + std::to_string(ArrayData.size()); - DataHelpers::Append(ArrayData, Path.c_str(), Value); + Internal::DataConverter::Append(ArrayData, Path.c_str(), Value); } - DataHelpers::Append(OutMessage, Key, ArrayData); + Internal::DataConverter::Append(OutMessage, Key, ArrayData); } - template static inline bool Extract(const ROSData& Message, const char* Key, TArray& Array) { ROSData ArrayData; - if (!DataHelpers::Extract(Message, Key, ArrayData) || !ArrayData.is_array()) + if (!Internal::DataConverter::Extract(Message, Key, ArrayData) || !ArrayData.is_array()) { return false; } @@ -193,7 +192,7 @@ namespace DataHelpers for (uint64 i = 0; i < ArrayData.size(); i++) { const std::string Path = "/" + std::to_string(i); - if (!DataHelpers::Extract(ArrayData, Path.c_str(), Array[i])) + if (!Internal::DataConverter::Extract(ArrayData, Path.c_str(), Array[i])) { return false; } @@ -251,4 +250,4 @@ namespace DataHelpers Message.insert_or_assign(Key, Data); } } -} // namespace DataHelpers \ No newline at end of file +} // namespace DataHelpers diff --git a/Source/Rosbridge2Unreal/Rosbridge2Unreal.Build.cs b/Source/Rosbridge2Unreal/Rosbridge2Unreal.Build.cs index 6c34046..00292eb 100644 --- a/Source/Rosbridge2Unreal/Rosbridge2Unreal.Build.cs +++ b/Source/Rosbridge2Unreal/Rosbridge2Unreal.Build.cs @@ -10,6 +10,8 @@ public Rosbridge2Unreal(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; + bEnableExceptions = true; + PublicDefinitions.AddRange( new string[]{} ); diff --git a/Source/ThirdParty/jsoncons/include/jsoncons/basic_json.hpp b/Source/ThirdParty/jsoncons/include/jsoncons/basic_json.hpp index 474fe71..8848bde 100644 --- a/Source/ThirdParty/jsoncons/include/jsoncons/basic_json.hpp +++ b/Source/ThirdParty/jsoncons/include/jsoncons/basic_json.hpp @@ -3390,7 +3390,6 @@ class basic_json indenting line_indent, std::error_code& ec) const { - using string_type = std::basic_string; if (line_indent == indenting::indent) { basic_json_encoder> encoder(s, options); @@ -3408,7 +3407,6 @@ class basic_json indenting line_indent, std::error_code& ec) const { - using string_type = std::basic_string; if (line_indent == indenting::indent) { basic_json_encoder> encoder(s); @@ -3902,8 +3900,6 @@ class basic_json template > std::basic_string as_string(const SAllocator& alloc) const { - using string_type = std::basic_string; - converter convert(alloc); std::error_code ec; switch (var_.storage()) @@ -4686,7 +4682,6 @@ class basic_json std::basic_string to_string() const noexcept { - using string_type = std::basic_string; string_type s; basic_compact_json_encoder> encoder(s); dump(encoder); @@ -4700,7 +4695,6 @@ class basic_json std::basic_string to_string(const basic_json_encode_options& options, const SAllocator& alloc = SAllocator()) const { - using string_type = std::basic_string; string_type s(alloc); basic_compact_json_encoder> encoder(s, options); dump(encoder); diff --git a/Source/ThirdParty/jsoncons/include/jsoncons/config/compiler_support.hpp b/Source/ThirdParty/jsoncons/include/jsoncons/config/compiler_support.hpp index 69dcd74..65dacdf 100644 --- a/Source/ThirdParty/jsoncons/include/jsoncons/config/compiler_support.hpp +++ b/Source/ThirdParty/jsoncons/include/jsoncons/config/compiler_support.hpp @@ -165,9 +165,9 @@ #if !defined(JSONCONS_NO_EXCEPTIONS) -#if __GNUC__ && !__EXCEPTIONS +#if __GNUC__ && !defined(__EXCEPTIONS) # define JSONCONS_NO_EXCEPTIONS 1 -#elif _MSC_VER +#elif defined(_MSC_VER) #if defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS == 0 # define JSONCONS_NO_EXCEPTIONS 1 #elif !defined(_CPPUNWIND) @@ -192,10 +192,10 @@ #if !defined(JSONCONS_HAS_STD_MAKE_UNIQUE) #if defined(__clang__) #if defined(__APPLE__) - #if __clang_major__ >= 6 && _cplusplus >= 201103L // Xcode 6 + #if __clang_major__ >= 6 && __cplusplus >= 201103L // Xcode 6 #define JSONCONS_HAS_STD_MAKE_UNIQUE #endif - #elif ((__clang_major__*100 +__clang_minor__) >= 340) && _cplusplus > 201103L + #elif ((__clang_major__*100 +__clang_minor__) >= 340) && __cplusplus > 201103L #define JSONCONS_HAS_STD_MAKE_UNIQUE #endif #elif defined(__GNUC__) diff --git a/Source/ThirdParty/jsoncons/include/jsoncons/staj_iterator.hpp b/Source/ThirdParty/jsoncons/include/jsoncons/staj_iterator.hpp index 11e84d1..df69408 100644 --- a/Source/ThirdParty/jsoncons/include/jsoncons/staj_iterator.hpp +++ b/Source/ThirdParty/jsoncons/include/jsoncons/staj_iterator.hpp @@ -126,8 +126,6 @@ namespace jsoncons { void next() { - using char_type = typename Json::char_type; - if (!done()) { view_->cursor_->next(); @@ -145,8 +143,6 @@ namespace jsoncons { void next(std::error_code& ec) { - using char_type = typename Json::char_type; - if (!done()) { view_->cursor_->next(ec); @@ -272,8 +268,6 @@ namespace jsoncons { void next() { - using char_type = typename Json::char_type; - view_->cursor_->next(); if (!done()) { @@ -294,8 +288,6 @@ namespace jsoncons { void next(std::error_code& ec) { - using char_type = typename Json::char_type; - view_->cursor_->next(ec); if (ec) {