diff --git a/ports/jsonrpcpp/add-cmake-targets.patch b/ports/jsonrpcpp/add-cmake-targets.patch new file mode 100644 index 0000000000..da411eb5ef --- /dev/null +++ b/ports/jsonrpcpp/add-cmake-targets.patch @@ -0,0 +1,45 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a682679..bdcf1b3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -29,11 +29,37 @@ if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR) + PATH "Output directory for header files") + endif() + +-include_directories( +- "include" ++find_package(nlohmann_json CONFIG REQUIRED) ++ ++add_library(jsonrpcpp INTERFACE) ++target_include_directories(jsonrpcpp INTERFACE ++ $ ++ $ ++) ++target_link_libraries(jsonrpcpp INTERFACE nlohmann_json::nlohmann_json) ++ ++include(CMakePackageConfigHelpers) ++configure_package_config_file( ++ "${CMAKE_CURRENT_SOURCE_DIR}/unofficial-jsonrpcpp-config.cmake.in" ++ "${CMAKE_CURRENT_BINARY_DIR}/unofficial-jsonrpcpp-config.cmake" ++ INSTALL_DESTINATION "share/unofficial-jsonrpcpp" ++) ++install( ++ FILES "${CMAKE_CURRENT_BINARY_DIR}/unofficial-jsonrpcpp-config.cmake" ++ DESTINATION "share/unofficial-jsonrpcpp" ++) ++ ++install(TARGETS jsonrpcpp ++ EXPORT unofficial-jsonrpcpp-targets ++ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ++) ++install(EXPORT unofficial-jsonrpcpp-targets ++ FILE unofficial-jsonrpcpp-targets.cmake ++ NAMESPACE unofficial::jsonrpcpp:: ++ DESTINATION share/unofficial-jsonrpcpp + ) + +-install(FILES include/jsonrpcpp.hpp include/json.hpp ++install(FILES include/jsonrpcpp.hpp + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/jsonrpcpp") + + if(MSVC) diff --git a/ports/jsonrpcpp/fix-include-path.patch b/ports/jsonrpcpp/fix-include-path.patch new file mode 100644 index 0000000000..8b0c973526 --- /dev/null +++ b/ports/jsonrpcpp/fix-include-path.patch @@ -0,0 +1,13 @@ +diff --git a/include/jsonrpcpp.hpp b/include/jsonrpcpp.hpp +index 1cea0ac..236850c 100644 +--- a/include/jsonrpcpp.hpp ++++ b/include/jsonrpcpp.hpp +@@ -23,7 +23,7 @@ + #define JSON_RPC_HPP + + // nlohmann-json +-#include ++#include + + // standard headers + #include diff --git a/ports/jsonrpcpp/portfile.cmake b/ports/jsonrpcpp/portfile.cmake new file mode 100644 index 0000000000..5c38190c12 --- /dev/null +++ b/ports/jsonrpcpp/portfile.cmake @@ -0,0 +1,30 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO badaix/jsonrpcpp + REF "v${VERSION}" + SHA512 d6c1ff8113f1b8581c258acdc7f59a3669e43636b06d73db1c4396da4a7797dc9b1d7e3a9f81039cc06c2970806b9b5a565cb2d9c8f0041866067dfcded93fff + HEAD_REF master + PATCHES + fix-include-path.patch + add-cmake-targets.patch +) + +# Remove bundled json.hpp +file(REMOVE "${SOURCE_PATH}/include/json.hpp") + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/unofficial-jsonrpcpp-config.cmake.in" DESTINATION "${SOURCE_PATH}") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DBUILD_EXAMPLE=OFF + -DBUILD_TESTS=OFF +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-jsonrpcpp CONFIG_PATH share/unofficial-jsonrpcpp) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug") + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/jsonrpcpp/unofficial-jsonrpcpp-config.cmake.in b/ports/jsonrpcpp/unofficial-jsonrpcpp-config.cmake.in new file mode 100644 index 0000000000..fe0214a77a --- /dev/null +++ b/ports/jsonrpcpp/unofficial-jsonrpcpp-config.cmake.in @@ -0,0 +1,9 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) + +find_dependency(nlohmann_json CONFIG) + +include("${CMAKE_CURRENT_LIST_DIR}/unofficial-jsonrpcpp-targets.cmake") + +check_required_components(jsonrpcpp) diff --git a/ports/jsonrpcpp/usage b/ports/jsonrpcpp/usage new file mode 100644 index 0000000000..72fe70f194 --- /dev/null +++ b/ports/jsonrpcpp/usage @@ -0,0 +1,4 @@ +jsonrpcpp is a header-only library and can be used from CMake via: + + find_package(unofficial-jsonrpcpp CONFIG REQUIRED) + target_link_libraries(main PRIVATE unofficial::jsonrpcpp::jsonrpcpp) diff --git a/ports/jsonrpcpp/vcpkg.json b/ports/jsonrpcpp/vcpkg.json new file mode 100644 index 0000000000..9daa5ac9e0 --- /dev/null +++ b/ports/jsonrpcpp/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "jsonrpcpp", + "version-semver": "1.4.0", + "description": "C++ JSON-RPC 2.0 library", + "homepage": "https://github.com/badaix/jsonrpcpp", + "license": "MIT", + "dependencies": [ + "nlohmann-json", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index 24bfa195c1..e9782ceabf 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4224,6 +4224,10 @@ "baseline": "0.21.0", "port-version": 1 }, + "jsonrpcpp": { + "baseline": "1.4.0", + "port-version": 0 + }, "juce": { "baseline": "8.0.7", "port-version": 0 diff --git a/versions/j-/jsonrpcpp.json b/versions/j-/jsonrpcpp.json new file mode 100644 index 0000000000..fa7baac19d --- /dev/null +++ b/versions/j-/jsonrpcpp.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "ddf721d7d6a21fb7f624448bb768738bf7018a38", + "version-semver": "1.4.0", + "port-version": 0 + } + ] +}