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
16 changes: 16 additions & 0 deletions .github/workflows/psv_pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,22 @@ jobs:
run: gcc --version && ./scripts/linux/psv/build_psv.sh
shell: bash

psv-linux-22-04-gcc11-build-json-lib:
name: PSV.Linux.22.04.gcc11.OLP_SDK_EMBED_BOOST_JSON
runs-on: ubuntu-22.04
env:
BUILD_TYPE: RelWithDebInfo
EXTRA_CMAKE_OPTIONS: -DOLP_SDK_EMBED_BOOST_JSON=OFF -DOLP_SDK_ENABLE_TESTING=OFF
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Ubuntu dependencies
run: sudo apt-get update && sudo apt-get install -y libboost-all-dev ccache libssl-dev libcurl4-openssl-dev --no-install-recommends
shell: bash
- name: Compile project with cmake and ccache
run: gcc --version && ./scripts/linux/psv/build_psv.sh
shell: bash

psv-linux-latest-gcc14-build:
name: PSV.Linux.latest.gcc14.Tests
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ option(OLP_SDK_NO_EXCEPTION "Disable exception handling" OFF)
option(OLP_SDK_USE_STD_OPTIONAL "Use std::optional instead of boost::optional with C++17 and above" OFF)
option(OLP_SDK_USE_STD_ANY "Use std::any instead of boost::any with C++17 and above" OFF)
option(OLP_SDK_BOOST_THROW_EXCEPTION_EXTERNAL "The boost::throw_exception() is defined externally" OFF)
option(OLP_SDK_EMBED_BOOST_JSON "Use boost.json in header-only mode." ON)
Comment thread
rustam-gamidov-here marked this conversation as resolved.
option(OLP_SDK_BUILD_EXTERNAL_DEPS "Download and build external dependencies" ON)
option(OLP_SDK_BUILD_EXAMPLES "Enable examples targets" OFF)
option(OLP_SDK_MSVC_PARALLEL_BUILD_ENABLE "Enable parallel build on MSVC" ON)
Expand Down
20 changes: 16 additions & 4 deletions external/boost/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ endif()

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

# Skip installation if boost is embedded, otherwise install it to a temporary location and use it from there.
set(INSTALL_BOOST_CMD ${CMAKE_COMMAND} -E true)
if (NOT OLP_SDK_EMBED_BOOST_JSON)
set(INSTALL_BOOST_CMD ${B2_CMD} install --with-json --prefix=${CMAKE_CURRENT_BINARY_DIR}/external_boost_install)
endif()

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

set(CMAKE_VERBOSE_MAKEFILE ON)
Expand All @@ -52,7 +58,13 @@ if(result)
message(FATAL_ERROR "Build step for boost failed: ${result}")
endif()

# We are using boost header only, we don't care about libs
set(EXTERNAL_BOOST_ROOT ${CMAKE_CURRENT_BINARY_DIR}/external_boost PARENT_SCOPE)
set(EXTERNAL_BOOST_ROOT_INCLUDE ${CMAKE_CURRENT_BINARY_DIR}/external_boost PARENT_SCOPE)
set(EXTERNAL_BOOST_ROOT_LIB dummy_path PARENT_SCOPE)
if (OLP_SDK_EMBED_BOOST_JSON)
set(EXTERNAL_BOOST_ROOT ${CMAKE_CURRENT_BINARY_DIR}/external_boost PARENT_SCOPE)
set(EXTERNAL_BOOST_ROOT_INCLUDE ${CMAKE_CURRENT_BINARY_DIR}/external_boost PARENT_SCOPE)
# We are using boost header only, we don't care about libs
set(EXTERNAL_BOOST_ROOT_LIB dummy_path PARENT_SCOPE)
else()
set(EXTERNAL_BOOST_ROOT ${CMAKE_CURRENT_BINARY_DIR}/external_boost_install PARENT_SCOPE)
set(EXTERNAL_BOOST_ROOT_INCLUDE ${CMAKE_CURRENT_BINARY_DIR}/external_boost_install/include PARENT_SCOPE)
set(EXTERNAL_BOOST_ROOT_LIB ${CMAKE_CURRENT_BINARY_DIR}/external_boost_install/lib PARENT_SCOPE)
endif ()
4 changes: 2 additions & 2 deletions external/boost/CMakeLists.txt.boost.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ExternalProject_Add(boost-download
BUILD_IN_SOURCE 1
UPDATE_COMMAND ""
CONFIGURE_COMMAND @BOOTSTRAP_CMD@
BUILD_COMMAND "@B2_CMD@" headers
INSTALL_COMMAND ""
BUILD_COMMAND "@B2_CMD@" headers @BOOST_LIBRARIES_ARG@
INSTALL_COMMAND "@INSTALL_BOOST_CMD@"
TEST_COMMAND ""
)
14 changes: 13 additions & 1 deletion olp-cpp-sdk-authentication/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
project(olp-cpp-sdk-authentication VERSION 1.25.0)
set(DESCRIPTION "C++ API library for accessing HERE Account authentication service")

find_package(Boost REQUIRED)
if (OLP_SDK_EMBED_BOOST_JSON)
find_package(Boost REQUIRED)
else ()
find_package(Boost COMPONENTS json REQUIRED)
endif()

file(GLOB_RECURSE AUTHENTICATION_INC "include/*.h*")
file(GLOB_RECURSE AUTHENTICATION_SRC "src/*.*")
Expand Down Expand Up @@ -56,6 +60,14 @@ if(BUILD_SHARED_LIBS)
PUBLIC AUTHENTICATION_SHARED_LIBRARY)
endif()

if (OLP_SDK_EMBED_BOOST_JSON)
target_compile_definitions(${PROJECT_NAME}
PRIVATE OLP_SDK_EMBED_BOOST_JSON)
else ()
target_link_libraries(${PROJECT_NAME}
PRIVATE Boost::json)
endif()

target_compile_definitions(${PROJECT_NAME}
PRIVATE
BOOST_ALL_NO_LIB
Expand Down
2 changes: 2 additions & 0 deletions olp-cpp-sdk-authentication/src/utils/BoostJsonSrc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
* License-Filename: LICENSE
*/

#if defined(OLP_SDK_EMBED_BOOST_JSON)
#include <boost/json/src.hpp>
#endif
15 changes: 14 additions & 1 deletion olp-cpp-sdk-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
project(olp-cpp-sdk-core VERSION 1.25.0)
set(DESCRIPTION "Core network and utility library for the HERE OLP SDK C++")

find_package(Boost REQUIRED)
if (OLP_SDK_EMBED_BOOST_JSON)
find_package(Boost REQUIRED)
else ()
find_package(Boost COMPONENTS json REQUIRED)
endif()

find_package(Threads REQUIRED)

if(OLP_SDK_ENABLE_DEFAULT_CACHE)
Expand Down Expand Up @@ -456,6 +461,14 @@ if (OLP_SDK_USE_STD_ANY)
PUBLIC OLP_SDK_USE_STD_ANY)
endif()

if (OLP_SDK_EMBED_BOOST_JSON)
target_compile_definitions(${PROJECT_NAME}
PRIVATE OLP_SDK_EMBED_BOOST_JSON)
else ()
target_link_libraries(${PROJECT_NAME}
PRIVATE Boost::json)
endif()

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

Expand Down
2 changes: 2 additions & 0 deletions olp-cpp-sdk-core/src/utils/BoostJsonSrc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
* License-Filename: LICENSE
*/

#if defined(OLP_SDK_EMBED_BOOST_JSON)
#include <boost/json/src.hpp>
#endif
14 changes: 13 additions & 1 deletion olp-cpp-sdk-dataservice-read/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ file(GLOB_RECURSE INC "include/*.h*")
file(GLOB_RECURSE SRC "src/*.*")


find_package(Boost REQUIRED)
if (OLP_SDK_EMBED_BOOST_JSON)
find_package(Boost REQUIRED)
else ()
find_package(Boost COMPONENTS json REQUIRED)
endif()

add_library(${PROJECT_NAME}
${SRC}
Expand Down Expand Up @@ -53,6 +57,14 @@ if(BUILD_SHARED_LIBS)
PUBLIC DATASERVICE_READ_SHARED_LIBRARY)
endif()

if (OLP_SDK_EMBED_BOOST_JSON)
target_compile_definitions(${PROJECT_NAME}
PRIVATE OLP_SDK_EMBED_BOOST_JSON)
else ()
target_link_libraries(${PROJECT_NAME}
PRIVATE Boost::json)
endif()

# install component
file(GLOB API_HEADERS "include/olp/dataservice/read/*.h")
file(GLOB MODEL_HEADERS "include/olp/dataservice/read/model/*.h")
Expand Down
2 changes: 2 additions & 0 deletions olp-cpp-sdk-dataservice-read/src/utils/BoostJsonSrc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
* License-Filename: LICENSE
*/

#if defined(OLP_SDK_EMBED_BOOST_JSON)
#include <boost/json/src.hpp>
#endif
14 changes: 13 additions & 1 deletion olp-cpp-sdk-dataservice-write/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
project(olp-cpp-sdk-dataservice-write VERSION 1.25.0)
set(DESCRIPTION "C++ API library for writing data to OLP")

find_package(Boost REQUIRED)
if (OLP_SDK_EMBED_BOOST_JSON)
find_package(Boost REQUIRED)
else ()
find_package(Boost COMPONENTS json REQUIRED)
endif()

set(OLP_SDK_DATASERVICE_WRITE_API_HEADERS
./include/olp/dataservice/write/DataServiceWriteApi.h
Expand Down Expand Up @@ -189,6 +193,14 @@ target_compile_definitions(${PROJECT_NAME}
BOOST_ALL_NO_LIB
BOOST_JSON_NO_LIB)

if (OLP_SDK_EMBED_BOOST_JSON)
target_compile_definitions(${PROJECT_NAME}
PRIVATE OLP_SDK_EMBED_BOOST_JSON)
else ()
target_link_libraries(${PROJECT_NAME}
PRIVATE Boost::json)
endif()

# Used also in the package config file
set(PROJECT_LIBS olp-cpp-sdk-core)

Expand Down
2 changes: 2 additions & 0 deletions olp-cpp-sdk-dataservice-write/src/utils/BoostJsonSrc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
* License-Filename: LICENSE
*/

#if defined(OLP_SDK_EMBED_BOOST_JSON)
#include <boost/json/src.hpp>
#endif
Loading