[cnats] Update to 3.5.0 and remove system dependency to sodium (#28479)

* [cnats] Update to 3.5.0 and remove system dependency to sodium

* fixup! [cnats] Update to 3.5.0 and remove system dependency to sodium

Co-authored-by: Jonliu1993 <13720414433@163.com>
This commit is contained in:
Francisco Facioni 2023-01-04 22:46:19 +00:00 committed by GitHub
parent aa45329eb6
commit 6f70b430d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 70 additions and 4 deletions

View File

@ -0,0 +1,59 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 02adc2e..ccd5492 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -110,6 +110,11 @@ if(NATS_BUILD_STREAMING)
endif(NATS_BUILD_STREAMING)
if(NATS_BUILD_USE_SODIUM)
+ find_package(libsodium NAMES unofficial-sodium CONFIG REQUIRED)
+ set(NATS_SODIUM_INCLUDE_DIRS "")
+ set(NATS_SODIUM_LIBRARIES unofficial-sodium::sodium)
+ add_definitions(-DNATS_USE_LIBSODIUM)
+elseif(0)
IF(DEFINED ENV{NATS_SODIUM_DIR})
SET(NATS_SODIUM_DIR "$ENV{NATS_SODIUM_DIR}")
ENDIF()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ea536de..6198776 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -63,7 +63,7 @@ if(NATS_BUILD_LIB_SHARED)
install(TARGETS nats EXPORT cnats-targets DESTINATION ${NATS_LIBDIR})
install(EXPORT cnats-targets
NAMESPACE cnats::
- FILE cnats-config.cmake
+ FILE cnats-targets.cmake
DESTINATION ${NATS_LIBDIR}/cmake/cnats)
endif(NATS_BUILD_LIB_SHARED)
@@ -75,10 +75,14 @@ if(NATS_BUILD_LIB_STATIC)
install(TARGETS nats_static EXPORT cnats-targets ARCHIVE DESTINATION ${NATS_LIBDIR})
install(EXPORT cnats-targets
NAMESPACE cnats::
- FILE cnats-config.cmake
+ FILE cnats-targets.cmake
DESTINATION ${NATS_LIBDIR}/cmake/cnats)
endif(NATS_BUILD_LIB_STATIC)
+include(CMakePackageConfigHelpers)
+configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/cnats-config.cmake" INSTALL_DESTINATION ${NATS_LIBDIR}/cmake/cnats)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cnats-config.cmake DESTINATION ${NATS_LIBDIR}/cmake/cnats)
+
install(FILES deprnats.h DESTINATION ${NATS_INCLUDE_DIR} RENAME nats.h)
install(FILES nats.h status.h version.h DESTINATION ${NATS_INCLUDE_DIR}/nats)
install(FILES adapters/libevent.h adapters/libuv.h DESTINATION ${NATS_INCLUDE_DIR}/nats/adapters)
diff --git a/src/Config.cmake.in b/src/Config.cmake.in
new file mode 100644
index 0000000..aa1d6bf
--- /dev/null
+++ b/src/Config.cmake.in
@@ -0,0 +1,8 @@
+@PACKAGE_INIT@
+
+include(CMakeFindDependencyMacro)
+if("@NATS_BUILD_USE_SODIUM@")
+ find_dependency(unofficial-sodium)
+endif()
+
+include ( "${CMAKE_CURRENT_LIST_DIR}/cnats-targets.cmake" )

View File

@ -1,9 +1,11 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO nats-io/nats.c
REF b26143da7566e816db66e86f6336ebf5c226c4ad #v3.4.1
SHA512 6422d3d5b59a700ac56730870dab1bbdadd8f85c9a0cef2c685cdd36189b1689d04d5a710500fbc5299445ca32df9434b404fae3018e8266c284aa34259f110a
REF 03ada19a3be6f102a1cf69c89ea76c73df191d9d #v3.5.0
SHA512 be17070acaf1659387441dbbee07b21ae0bd31bb87c746d4435c59812a26d690350e33b411cdb85b2f2f7e7f4e3492259d64b533efbf4fb31a356f9d852111d9
HEAD_REF master
PATCHES
fix-sodium-dep.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS

View File

@ -1,6 +1,6 @@
{
"name": "cnats",
"version": "3.4.1",
"version": "3.5.0",
"description": "A C client for the NATS messaging system",
"homepage": "https://github.com/nats-io/nats.c",
"license": "Apache-2.0",

View File

@ -1525,7 +1525,7 @@
"port-version": 1
},
"cnats": {
"baseline": "3.4.1",
"baseline": "3.5.0",
"port-version": 0
},
"cnl": {

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "b22911f520e4047d11cd9d81a22263775bf1d797",
"version": "3.5.0",
"port-version": 0
},
{
"git-tree": "d886b7595504b34bc08246edd99ceead043f083f",
"version": "3.4.1",