mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 22:19:02 +08:00
[ed25519] New port (#34517)
* [ports/ed25519] New port * [ports/ed25519/CMakeLists.txt] Export symbols corrected on shared libs on Windows * [ports/ed25519/CMakeLists.txt] Export one header ; work on correct DLL exposure for Windows
This commit is contained in:
parent
809e93f524
commit
71ab19baf4
64
ports/ed25519/CMakeLists.txt
Normal file
64
ports/ed25519/CMakeLists.txt
Normal file
@ -0,0 +1,64 @@
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
project(ed25519 LANGUAGES C)
|
||||
set(PROJECT_VERSION "${VERSION}")
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/ed25519.h" "#elif defined(ED25519_DLL)" "#elif 1")
|
||||
endif()
|
||||
set(Header_Files "src/ed25519.h"
|
||||
"src/fe.h"
|
||||
"src/fixedint.h"
|
||||
"src/ge.h"
|
||||
"src/precomp_data.h"
|
||||
"src/sc.h"
|
||||
"src/sha512.h")
|
||||
set(Source_Files "src/add_scalar.c"
|
||||
"src/fe.c"
|
||||
"src/ge.c"
|
||||
"src/key_exchange.c"
|
||||
"src/keypair.c"
|
||||
"src/sc.c"
|
||||
"src/seed.c"
|
||||
"src/sha512.c"
|
||||
"src/sign.c"
|
||||
"src/verify.c")
|
||||
|
||||
add_library("${PROJECT_NAME}" "${Header_Files}" "${Source_Files}")
|
||||
|
||||
include(GNUInstallDirs)
|
||||
target_include_directories(
|
||||
"${PROJECT_NAME}"
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
)
|
||||
target_compile_features("${PROJECT_NAME}" PRIVATE c_std_90)
|
||||
set_target_properties("${PROJECT_NAME}" PROPERTIES C_VISIBILITY_PRESET hidden
|
||||
PUBLIC_HEADER "src/ed25519.h")
|
||||
|
||||
install(
|
||||
TARGETS "${PROJECT_NAME}"
|
||||
EXPORT "unofficial-${PROJECT_NAME}Config"
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
set(VERSION_FILE_PATH "${CMAKE_CURRENT_BINARY_DIR}/unofficial-${PROJECT_NAME}ConfigVersion.cmake")
|
||||
write_basic_package_version_file(
|
||||
"${VERSION_FILE_PATH}"
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
install(FILES "${VERSION_FILE_PATH}" DESTINATION "share/unofficial-${PROJECT_NAME}")
|
||||
install(FILES "src/ed25519.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
|
||||
install(
|
||||
EXPORT "unofficial-${PROJECT_NAME}Config"
|
||||
FILE "unofficial-${PROJECT_NAME}Config.cmake"
|
||||
NAMESPACE "unofficial::${PROJECT_NAME}::"
|
||||
DESTINATION "share/unofficial-${PROJECT_NAME}")
|
||||
|
||||
export(PACKAGE "${PROJECT_NAME}")
|
30
ports/ed25519/portfile.cmake
Normal file
30
ports/ed25519/portfile.cmake
Normal file
@ -0,0 +1,30 @@
|
||||
if(WIN32)
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
endif()
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO orlp/${PORT}
|
||||
REF b1f19fab4aebe607805620d25a5e42566ce46a0e
|
||||
SHA512 fcbeba58591543304dd93ae7c1b62a720d89c80c4c07c323eabb6e1f41b93562660181973bda345976e5361e925f243ba9abaec19fc8a05235011957367c6e7e
|
||||
HEAD_REF master
|
||||
)
|
||||
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt"
|
||||
DESTINATION "${SOURCE_PATH}")
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
"-DVERSION=${VERSION}"
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-${PORT})
|
||||
|
||||
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "Zlib")
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/include")
|
3
ports/ed25519/usage
Normal file
3
ports/ed25519/usage
Normal file
@ -0,0 +1,3 @@
|
||||
ed25519 provides CMake targets:
|
||||
find_package(unofficial-ed25519 CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE unofficial::ed25519::ed25519)
|
17
ports/ed25519/vcpkg.json
Normal file
17
ports/ed25519/vcpkg.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "ed25519",
|
||||
"version-date": "2017-02-10",
|
||||
"description": "Portable C implementation of Ed25519, a high-speed high-security public-key signature system.",
|
||||
"homepage": "https://github.com/orlp/ed25519",
|
||||
"license": "Zlib",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
@ -2364,6 +2364,10 @@
|
||||
"baseline": "1.0.7.15",
|
||||
"port-version": 5
|
||||
},
|
||||
"ed25519": {
|
||||
"baseline": "2017-02-10",
|
||||
"port-version": 0
|
||||
},
|
||||
"edflib": {
|
||||
"baseline": "1.24",
|
||||
"port-version": 0
|
||||
|
9
versions/e-/ed25519.json
Normal file
9
versions/e-/ed25519.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "c62f7e2a6268b66c80e20287872725e8bc273032",
|
||||
"version-date": "2017-02-10",
|
||||
"port-version": 0
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user