[blake3] Add new port (#25787)

* [blake3] Add new port

Fixes #20023

* Add license

* update version

Co-authored-by: Jonliu1993 <13720414433@163.com>
This commit is contained in:
Yuriy O'Donnell 2022-07-19 00:10:20 +02:00 committed by GitHub
parent 8b7ac186bf
commit c39678d764
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,41 @@
cmake_minimum_required(VERSION 3.19)
project(blake3 LANGUAGES C)
add_library(blake3)
target_sources(blake3 PRIVATE
c/blake3.c
c/blake3_dispatch.c
c/blake3_portable.c
)
# This is a bit too exotic to be worth supporting right now
target_compile_definitions(blake3 PRIVATE BLAKE3_NO_AVX512=1)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
target_sources(blake3 PRIVATE
c/blake3_avx2.c
c/blake3_sse2.c
c/blake3_sse41.c
)
if (NOT MSVC)
set_source_files_properties(c/blake3_avx2.c COMPILE_FLAGS -mavx2)
set_source_files_properties(c/blake3_sse2.c COMPILE_FLAGS -msse2)
set_source_files_properties(c/blake3_sse41.c COMPILE_FLAGS -msse4.1)
endif()
else()
target_compile_definitions(blake3 PRIVATE BLAKE3_NO_SSE2=1 BLAKE3_NO_SSE41=1 BLAKE3_NO_AVX2=1)
endif()
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
target_compile_definitions(blake3 PRIVATE BLAKE3_USE_NEON=1)
target_sources(blake3 PRIVATE
c/blake3_neon.c
)
else()
target_compile_definitions(blake3 PRIVATE BLAKE3_NO_NEON=1)
endif()
install(TARGETS blake3)
install(FILES c/blake3.h DESTINATION include)

View File

@ -0,0 +1,20 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO BLAKE3-team/BLAKE3
REF 1.3.1
SHA512 9906673a9eca100a6ad8c369f4c380ac66b59ed055cb8358fe99bb67ebbcc98e24da5860b257136a1f9cc8ece5733b2ac68c55b9be65ae6f2904ffd92ef34ce6
HEAD_REF main
)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
)
vcpkg_cmake_install()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

13
ports/blake3/vcpkg.json Normal file
View File

@ -0,0 +1,13 @@
{
"name": "blake3",
"version": "1.3.1",
"description": "BLAKE3 cryptographic hash function.",
"homepage": "https://github.com/BLAKE3-team/BLAKE3",
"license": "CC0-1.0 OR Apache-2.0",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
}
]
}

9
versions/b-/blake3.json Normal file
View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "62a5201ca424389c823b9b4be3d588e1cbb88a58",
"version": "1.3.1",
"port-version": 0
}
]
}

View File

@ -500,6 +500,10 @@
"baseline": "5.2.2",
"port-version": 0
},
"blake3": {
"baseline": "1.3.1",
"port-version": 0
},
"blas": {
"baseline": "1",
"port-version": 1