From 5d37f16c6cf1b5a5bc91ddf073dde4dd87ccb853 Mon Sep 17 00:00:00 2001 From: Christopher McArthur Date: Fri, 20 Mar 2026 22:16:25 -0700 Subject: [PATCH] upgrade boost json to v1.90.0 replace deprecated standalone with full release with one component --- .github/actions/install/boost-json/action.yml | 2 +- .../install/boost-json/install-boost-json.sh | 18 +++++++++++------- .github/workflows/traits.yml | 2 +- cmake/private-find-boost-json.cmake | 16 ---------------- example/traits/CMakeLists.txt | 6 +++--- tests/CMakeLists.txt | 12 ++++++------ 6 files changed, 22 insertions(+), 34 deletions(-) delete mode 100644 cmake/private-find-boost-json.cmake diff --git a/.github/actions/install/boost-json/action.yml b/.github/actions/install/boost-json/action.yml index 2df26823f..edebb5b7e 100644 --- a/.github/actions/install/boost-json/action.yml +++ b/.github/actions/install/boost-json/action.yml @@ -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: diff --git a/.github/actions/install/boost-json/install-boost-json.sh b/.github/actions/install/boost-json/install-boost-json.sh index de5dd929d..66d78a97c 100755 --- a/.github/actions/install/boost-json/install-boost-json.sh +++ b/.github/actions/install/boost-json/install-boost-json.sh @@ -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!" diff --git a/.github/workflows/traits.yml b/.github/workflows/traits.yml index 27b1420c6..c1866b061 100644 --- a/.github/workflows/traits.yml +++ b/.github/workflows/traits.yml @@ -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" } diff --git a/cmake/private-find-boost-json.cmake b/cmake/private-find-boost-json.cmake deleted file mode 100644 index 70c7b6ccd..000000000 --- a/cmake/private-find-boost-json.cmake +++ /dev/null @@ -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 ") - 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() diff --git a/example/traits/CMakeLists.txt b/example/traits/CMakeLists.txt index 8ac66cfed..3a6c07fad 100644 --- a/example/traits/CMakeLists.txt +++ b/example/traits/CMakeLists.txt @@ -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) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 91f21fb45..bd407efa5 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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 \n") endif() -if(TARGET boost_json) +if(TARGET Boost::json) string(APPEND TRAITS_TYPELIST_CONTENT "#include \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)