2022-02-28 16:16:39 -06:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO nats-io/nats.c
|
2023-11-29 22:16:47 -05:00
|
|
|
REF "v${VERSION}"
|
2024-03-26 06:34:55 +08:00
|
|
|
SHA512 d32979a686420fe23af96b58efcf366ff9ff315531ca54962f2ae8ae7126174b5ca10a74152cc14f49be1143d0ad7dd5a68beeb31126410c76dbaa0468a45382
|
2023-11-29 22:16:47 -05:00
|
|
|
HEAD_REF main
|
2023-01-04 22:46:19 +00:00
|
|
|
PATCHES
|
|
|
|
fix-sodium-dep.patch
|
2023-12-07 05:56:22 +08:00
|
|
|
fix_install_path.patch
|
2022-02-28 16:16:39 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
|
|
|
FEATURES
|
|
|
|
"streaming" NATS_BUILD_STREAMING
|
|
|
|
)
|
|
|
|
|
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
|
|
|
list(APPEND OPTIONS -DNATS_BUILD_LIB_SHARED=ON)
|
|
|
|
list(APPEND OPTIONS -DNATS_BUILD_LIB_STATIC=OFF)
|
|
|
|
list(APPEND OPTIONS -DBUILD_TESTING=OFF)
|
|
|
|
list(APPEND OPTIONS -DNATS_BUILD_USE_SODIUM=ON)
|
|
|
|
else()
|
|
|
|
list(APPEND OPTIONS -DNATS_BUILD_LIB_SHARED=OFF)
|
|
|
|
list(APPEND OPTIONS -DNATS_BUILD_LIB_STATIC=ON)
|
|
|
|
list(APPEND OPTIONS -DBUILD_TESTING=ON)
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
list(APPEND OPTIONS -DNATS_BUILD_USE_SODIUM=OFF)
|
|
|
|
else()
|
|
|
|
list(APPEND OPTIONS -DNATS_BUILD_USE_SODIUM=ON)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
vcpkg_cmake_configure(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
|
|
OPTIONS
|
|
|
|
${FEATURE_OPTIONS}
|
|
|
|
${OPTIONS}
|
|
|
|
-DNATS_BUILD_TLS_USE_OPENSSL_1_1_API=ON
|
|
|
|
-DNATS_BUILD_EXAMPLES=OFF
|
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_cmake_install(ADD_BIN_TO_PATH)
|
|
|
|
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
|
|
|
if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/nats.dll")
|
|
|
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin")
|
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/nats.dll" "${CURRENT_PACKAGES_DIR}/bin/nats.dll")
|
|
|
|
endif()
|
|
|
|
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/natsd.dll")
|
|
|
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin")
|
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/natsd.dll" "${CURRENT_PACKAGES_DIR}/debug/bin/natsd.dll")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT})
|
|
|
|
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
|
|
|
if(EXISTS "${CURRENT_PACKAGES_DIR}/share/cnats/cnats-config-debug.cmake")
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/cnats/cnats-config-debug.cmake"
|
|
|
|
"\${_IMPORT_PREFIX}/debug/lib/natsd.dll" "\${_IMPORT_PREFIX}/debug/bin/natsd.dll")
|
|
|
|
endif()
|
|
|
|
if(EXISTS "${CURRENT_PACKAGES_DIR}/share/cnats/cnats-config-release.cmake")
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/cnats/cnats-config-release.cmake"
|
|
|
|
"\${_IMPORT_PREFIX}/lib/nats.dll" "\${_IMPORT_PREFIX}/bin/nats.dll")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
vcpkg_fixup_pkgconfig()
|
|
|
|
|
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
|
|
|
|
2023-12-07 05:56:22 +08:00
|
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|
2022-02-28 16:16:39 -06:00
|
|
|
|