Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion external/boost/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2019-2020 HERE Europe B.V.
# Copyright (C) 2019-2026 HERE Europe B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,6 +32,8 @@ else()
set(B2_CMD ./b2)
endif()

set(PATCH_BOOST_CMD "git apply -v ${CMAKE_CURRENT_SOURCE_DIR}/boost_182_json_noexceptions.diff")

configure_file(CMakeLists.txt.boost.in download/CMakeLists.txt @ONLY)

set(CMAKE_VERBOSE_MAKEFILE ON)
Expand Down
11 changes: 9 additions & 2 deletions external/boost/CMakeLists.txt.boost.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2019-2020 HERE Europe B.V.
# Copyright (C) 2019-2026 HERE Europe B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -24,9 +24,11 @@ include(ExternalProject)
ExternalProject_Add(boost-download
GIT_REPOSITORY @OLP_SDK_CPP_BOOST_URL@
GIT_TAG @OLP_SDK_CPP_BOOST_TAG@
GIT_SUBMODULES libs/any
GIT_SUBMODULES libs/align
libs/any
libs/assert
libs/config
libs/container
libs/container_hash
libs/core
libs/detail
Expand All @@ -35,8 +37,10 @@ ExternalProject_Add(boost-download
libs/function_types
libs/headers
libs/integer
libs/intrusive
libs/io
libs/iterator
libs/json
libs/move
libs/mpl
libs/mp11
Expand All @@ -47,18 +51,21 @@ ExternalProject_Add(boost-download
libs/random
libs/serialization
libs/smart_ptr
libs/system
libs/static_assert
libs/throw_exception
libs/tti
libs/type_index
libs/type_traits
libs/utility
libs/uuid
libs/variant2
libs/winapi
tools/build
tools/boost_install
GIT_SHALLOW 1
SOURCE_DIR "@CMAKE_CURRENT_BINARY_DIR@/external_boost"
PATCH_COMMAND @PATCH_BOOST_CMD@
BUILD_IN_SOURCE 1
UPDATE_COMMAND ""
CONFIGURE_COMMAND @BOOTSTRAP_CMD@
Expand Down
30 changes: 30 additions & 0 deletions external/boost/boost_182_json_noexceptions.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/libs/json/include/boost/json/impl/value.ipp b/libs/json/include/boost/json/impl/value.ipp
index 7460c02..7513b38 100644
--- a/libs/json/include/boost/json/impl/value.ipp
+++ b/libs/json/include/boost/json/impl/value.ipp
@@ -381,7 +381,9 @@ operator>>(
char read_buf[BOOST_JSON_STACK_BUFFER_SIZE / 2];
std::streambuf& buf = *is.rdbuf();
std::ios::iostate err = std::ios::goodbit;
+#ifndef BOOST_NO_EXCEPTIONS
try
+#endif
{
while( true )
{
@@ -437,6 +439,7 @@ operator>>(
break;
}
}
+#ifndef BOOST_NO_EXCEPTIONS
catch(...)
{
try
@@ -450,6 +453,7 @@ operator>>(
if( is.exceptions() & std::ios::badbit )
throw;
}
+#endif

is.setstate(err | std::ios::failbit);
return is;
4 changes: 4 additions & 0 deletions olp-cpp-sdk-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ endif()
set(OLP_SDK_UTILS_SOURCES
./src/utils/Base64.cpp
./src/utils/BoostExceptionHandle.cpp
./src/utils/BoostJsonSrc.cpp
./src/utils/Credentials.cpp
./src/utils/Dir.cpp
./src/utils/Thread.cpp
Expand Down Expand Up @@ -456,6 +457,9 @@ if (OLP_SDK_USE_STD_ANY)
PUBLIC OLP_SDK_USE_STD_ANY)
endif()

target_compile_definitions(${PROJECT_NAME} PRIVATE BOOST_ALL_NO_LIB)
target_compile_definitions(${PROJECT_NAME} PRIVATE BOOST_JSON_NO_LIB)

target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
Expand Down
20 changes: 20 additions & 0 deletions olp-cpp-sdk-core/src/utils/BoostJsonSrc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright (C) 2026 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
* License-Filename: LICENSE
*/

#include <boost/json/src.hpp>
3 changes: 2 additions & 1 deletion olp-cpp-sdk-core/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2019-2025 HERE Europe B.V.
# Copyright (C) 2019-2026 HERE Europe B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -73,6 +73,7 @@ set(OLP_CPP_SDK_CORE_TESTS_SOURCES
./http/NetworkSettingsTest.cpp
./http/NetworkUtils.cpp

./utils/JsonTest.cpp
./utils/UtilsTest.cpp
./utils/UrlTest.cpp
)
Expand Down
67 changes: 67 additions & 0 deletions olp-cpp-sdk-core/tests/utils/JsonTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (C) 2026 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
* License-Filename: LICENSE
*/

#include <gtest/gtest.h>

#include <boost/json/parse.hpp>

namespace {

using UtilsTest = testing::Test;

const std::string kJsonData = R"json(
{
"catalogs": [
{
"hrn": "hrn:here:data::olp:ocm",
"version": 17,
"dependencies": [],
"metadata_type": "partitions"
}
],
"regions": [
{
"id": 423423,
"parent_id": 14123411,
"catalogs": [
{
"hrn": "hrn:here:data::olp:ocm",
"status": "pending",
"size_raw_bytes": 4623545,
"layer_groups": [
"rendering"
],
"tiles": [
2354325,
5243252
]
}
]
}
]
})json";

TEST(UtilsTest, BoostJsonAvailable) {
boost::system::error_code error_code;
auto parsed_json = boost::json::parse(kJsonData, error_code);

EXPECT_FALSE(error_code.failed());
}

} // namespace
5 changes: 4 additions & 1 deletion tests/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2019-2021 HERE Europe B.V.
# Copyright (C) 2019-2026 HERE Europe B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,6 +50,9 @@ target_include_directories(olp-cpp-sdk-tests-common
${CMAKE_CURRENT_SOURCE_DIR}/../../olp-cpp-sdk-dataservice-read/src/
)

target_compile_definitions(olp-cpp-sdk-tests-common PUBLIC BOOST_CONTAINER_NO_LIB)
target_compile_definitions(olp-cpp-sdk-tests-common PUBLIC BOOST_JSON_NO_LIB)

target_link_libraries(olp-cpp-sdk-tests-common
PUBLIC
gmock
Expand Down
Loading