⬆️ Upgrade boost json to v1.90.0 (#425)

replace deprecated standalone with full release with one component
This commit is contained in:
Chris Mc
2026-04-02 10:58:46 -07:00
committed by GitHub
parent 3e037df3e6
commit 0a503e7508
6 changed files with 22 additions and 34 deletions

View File

@@ -4,7 +4,7 @@ inputs:
version:
description: The desired Boost.JSON version to install
required: false
default: "1.78.0"
default: "1.90.0"
runs:
using: composite
steps:

View File

@@ -13,32 +13,36 @@ if [[ -z "$1" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then
echo " VERSION Boost.JSON version to install (required)"
echo ""
echo "Examples:"
echo " $0 1.78.0"
echo " $0 1.90.0"
echo " $0 1.89.0"
exit 1
fi
BOOST_JSON_VERSION="$1"
INSTALL_DIR="/tmp"
BUILD_DIR="${INSTALL_DIR}/json-boost-${BOOST_JSON_VERSION}"
BUILD_DIR="${INSTALL_DIR}/boost-${BOOST_JSON_VERSION}"
echo "Installing Boost.JSON v${BOOST_JSON_VERSION}..."
# Download
echo "Downloading Boost.JSON v${BOOST_JSON_VERSION}..."
cd "${INSTALL_DIR}"
wget -q "https://github.com/boostorg/json/archive/boost-${BOOST_JSON_VERSION}.tar.gz"
wget -q "https://github.com/boostorg/boost/releases/download/boost-${BOOST_JSON_VERSION}/boost-${BOOST_JSON_VERSION}-cmake.tar.xz"
# Extract
echo "Extracting archive..."
tar -zxf "boost-${BOOST_JSON_VERSION}.tar.gz"
tar -xf "boost-${BOOST_JSON_VERSION}-cmake.tar.xz"
# Install
# Build and install
echo "Building and installing..."
cd "${BUILD_DIR}"
sudo cp -vR include/boost /usr/local/include
cmake . -DCMAKE_BUILD_TYPE=Release -DBOOST_INCLUDE_LIBRARIES="json"
cmake --build . --config Release
sudo cmake --install .
# Cleanup
echo "Cleaning up..."
rm -f "${INSTALL_DIR}/boost-${BOOST_JSON_VERSION}.tar.gz"
rm -f "${INSTALL_DIR}/boost-${BOOST_JSON_VERSION}-cmake.tar.xz"
rm -rf "${BUILD_DIR}"
echo "✓ Boost.JSON v${BOOST_JSON_VERSION} installed successfully!"

View File

@@ -17,7 +17,7 @@ jobs:
matrix:
target:
- { name: "danielaparker-jsoncons", tag: "1.3.2", version: "v1.3.2" }
- { name: "boost-json", tag: "1.78.0", version: "v1.80.0" }
- { name: "boost-json", tag: "1.90.0", version: "v1.90.0" }
- { name: "nlohmann-json", tag: "3.12.0", version: "v3.12.0" }
- { name: "kazuho-picojson", tag: "111c9be5188f7350c2eac9ddaedd8cca3d7bf394", version: "111c9be" }
- { name: "open-source-parsers-jsoncpp", tag: "1.9.6", version: "v1.9.6" }

View File

@@ -1,16 +0,0 @@
if(TARGET boost_json)
return()
endif()
unset(BOOSTJSON_INCLUDE_DIR CACHE)
find_path(BOOSTJSON_INCLUDE_DIR "boost/json.hpp" "boost/json/src.hpp")
if(EXISTS "${BOOSTJSON_INCLUDE_DIR}/boost/json.hpp")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/private-boost-json.cpp.in" "#include <boost/json/src.hpp>")
configure_file("${CMAKE_CURRENT_BINARY_DIR}/private-boost-json.cpp.in" private-boost-json.cpp COPYONLY)
add_library(boost_json "${BOOSTJSON_INCLUDE_DIR}/boost/json.hpp"
"${BOOSTJSON_INCLUDE_DIR}/boost/json/src.hpp"
"${CMAKE_CURRENT_BINARY_DIR}/private-boost-json.cpp")
target_include_directories(boost_json PUBLIC ${BOOSTJSON_INCLUDE_DIR})
target_compile_definitions(boost_json PUBLIC BOOST_JSON_STANDALONE)
target_compile_features(boost_json PUBLIC cxx_std_17)
endif()

View File

@@ -11,10 +11,10 @@ if(TARGET jsoncons)
target_link_libraries(danielaparker-jsoncons jwt-cpp::jwt-cpp jsoncons)
endif()
include("../../cmake/private-find-boost-json.cmake")
if(TARGET boost_json)
find_package(Boost CONFIG COMPONENTS json)
if(TARGET Boost::json)
add_executable(boost-json boost-json.cpp)
target_link_libraries(boost-json jwt-cpp::jwt-cpp boost_json)
target_link_libraries(boost-json jwt-cpp::jwt-cpp Boost::json)
endif()
find_package(nlohmann_json CONFIG)

View File

@@ -37,8 +37,8 @@ if(TARGET jsoncons)
list(APPEND AVAILABLE_TRAIT_TYPES "::jwt::traits::danielaparker_jsoncons")
endif()
include("private-find-boost-json")
if(TARGET boost_json)
find_package(Boost CONFIG COMPONENTS json)
if(TARGET Boost::json)
list(APPEND AVAILABLE_TRAIT_NAMES "boost_json")
list(APPEND AVAILABLE_TRAIT_TYPES "::jwt::traits::boost_json")
endif()
@@ -80,7 +80,7 @@ if(TARGET jsoncons)
string(APPEND TRAITS_TYPELIST_CONTENT "#include <jwt-cpp/traits/danielaparker-jsoncons/traits.h>\n")
endif()
if(TARGET boost_json)
if(TARGET Boost::json)
string(APPEND TRAITS_TYPELIST_CONTENT "#include <jwt-cpp/traits/boost-json/traits.h>\n")
endif()
@@ -128,7 +128,7 @@ if(TARGET jsoncons)
list(APPEND TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/traits/JsonconsTest.cpp)
endif()
if(TARGET boost_json)
if(TARGET Boost::json)
list(APPEND TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/traits/BoostJsonTest.cpp)
endif()
@@ -167,8 +167,8 @@ else()
if(TARGET jsoncons)
target_link_libraries(jwt-cpp-test PRIVATE jsoncons)
endif()
if(TARGET boost_json)
target_link_libraries(jwt-cpp-test PRIVATE boost_json)
if(TARGET Boost::json)
target_link_libraries(jwt-cpp-test PRIVATE Boost::json)
endif()
if(TARGET jsoncpp_static)
target_link_libraries(jwt-cpp-test PRIVATE jsoncpp_static)