2017-10-18 07:25:58 +08:00
|
|
|
vcpkg_from_github(
|
2017-11-12 16:22:51 +08:00
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
2017-10-18 07:25:58 +08:00
|
|
|
REPO jedisct1/libsodium
|
2023-08-09 02:32:45 +08:00
|
|
|
REF ${VERSION}
|
2023-12-20 15:16:05 +08:00
|
|
|
SHA512 6094d7bf191ea3be85f2ddab76b71f1b9c69c786493db5b84d3c5d5a0237003377ddf6a8687a962ea651fe4a9369cf5ee1676ba0bae82690f5f7ef31a698efa9
|
2017-10-18 07:25:58 +08:00
|
|
|
HEAD_REF master
|
2024-04-03 10:21:35 +08:00
|
|
|
PATCHES
|
|
|
|
arm-neon.diff # https://github.com/jedisct1/libsodium/commit/8f453f41f8834e0fe47610f2a3e03e696ddb3450 with fuzz 2
|
2017-12-07 10:08:03 +08:00
|
|
|
)
|
|
|
|
|
2024-02-22 14:07:27 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
|
|
|
set(lib_linkage "LIB")
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
|
|
set(lib_linkage "DLL")
|
|
|
|
endif()
|
2018-12-19 17:50:38 +08:00
|
|
|
|
2024-02-22 14:07:27 +08:00
|
|
|
set(LIBSODIUM_PROJECT_SUBPATH "builds/msvc/vs2022/libsodium/libsodium.vcxproj" CACHE STRING "Triplet variable")
|
2022-09-09 05:01:20 +08:00
|
|
|
|
2024-02-22 14:07:27 +08:00
|
|
|
vcpkg_msbuild_install(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
|
|
PROJECT_SUBPATH "${LIBSODIUM_PROJECT_SUBPATH}"
|
|
|
|
RELEASE_CONFIGURATION "Release${lib_linkage}"
|
|
|
|
DEBUG_CONFIGURATION "Debug${lib_linkage}"
|
|
|
|
)
|
2017-10-18 07:43:54 +08:00
|
|
|
|
2024-02-22 14:07:27 +08:00
|
|
|
file(INSTALL "${SOURCE_PATH}/src/libsodium/include/sodium.h" "${SOURCE_PATH}/src/libsodium/include/sodium" DESTINATION "${CURRENT_PACKAGES_DIR}/include")
|
|
|
|
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/src/libsodium/include/sodium/version.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/sodium")
|
|
|
|
file(REMOVE "${CURRENT_PACKAGES_DIR}/include/Makefile.am" "${CURRENT_PACKAGES_DIR}/include/sodium/version.h.in")
|
2018-12-19 20:01:14 +08:00
|
|
|
|
2024-02-22 14:07:27 +08:00
|
|
|
block(SCOPE_FOR VARIABLES)
|
|
|
|
set(PACKAGE_NAME "libsodium")
|
|
|
|
set(PACKAGE_VERSION "${VERSION}")
|
|
|
|
set(prefix [[unused]])
|
|
|
|
set(exec_prefix [[${prefix}]])
|
|
|
|
set(includedir [[${prefix}/include]])
|
|
|
|
set(libdir [[${prefix}/lib]])
|
|
|
|
set(PKGCONFIG_LIBS_PRIVATE "")
|
|
|
|
configure_file("${SOURCE_PATH}/libsodium.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libsodium.pc" @ONLY)
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libsodium.pc" " -lsodium" " -llibsodium")
|
|
|
|
if(NOT VCPKG_BUILD_TYPE)
|
|
|
|
set(includedir [[${prefix}/../include]])
|
|
|
|
configure_file("${SOURCE_PATH}/libsodium.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libsodium.pc" @ONLY)
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libsodium.pc" " -lsodium" " -llibsodium")
|
|
|
|
endif()
|
|
|
|
endblock()
|
|
|
|
else()
|
|
|
|
vcpkg_configure_make(
|
|
|
|
AUTOCONFIG
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
|
|
)
|
|
|
|
vcpkg_install_make()
|
2017-12-01 10:10:33 +08:00
|
|
|
|
2024-02-22 14:07:27 +08:00
|
|
|
file(REMOVE_RECURSE
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/include"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/share"
|
|
|
|
)
|
|
|
|
endif()
|
2019-05-02 06:43:48 +08:00
|
|
|
|
2024-02-22 14:07:27 +08:00
|
|
|
vcpkg_fixup_pkgconfig()
|
2017-10-18 07:43:54 +08:00
|
|
|
|
2024-02-22 14:07:27 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/sodium/export.h" "#ifdef SODIUM_STATIC" "#if 1")
|
|
|
|
endif()
|
2019-06-13 12:39:10 +08:00
|
|
|
|
2024-02-22 14:07:27 +08:00
|
|
|
# vcpkg legacy
|
2019-05-02 06:43:48 +08:00
|
|
|
configure_file(
|
2022-05-18 02:15:06 +08:00
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/sodiumConfig.cmake.in"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/share/unofficial-sodium/unofficial-sodiumConfig.cmake"
|
2021-03-30 00:45:43 +08:00
|
|
|
@ONLY
|
|
|
|
)
|
2022-05-18 02:15:06 +08:00
|
|
|
|
2023-08-09 02:32:45 +08:00
|
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|