[pbc] Add usage (#27049)

* [pbc] Add usage

* x-add-version

* fix

* x-add-version

* update config file

* update version
This commit is contained in:
Lily Wang 2023-06-12 15:07:05 -07:00 committed by GitHub
parent 6336644343
commit 13d7255093
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 11 deletions

View File

@ -1,17 +1,15 @@
set(PBC_VERSION 0.5.14)
if(NOT VCPKG_TARGET_IS_WINDOWS) if(NOT VCPKG_TARGET_IS_WINDOWS)
vcpkg_download_distfile( vcpkg_download_distfile(
ARCHIVE ARCHIVE
URLS "https://crypto.stanford.edu/pbc/files/pbc-${PBC_VERSION}.tar.gz" URLS "https://crypto.stanford.edu/pbc/files/pbc-${VERSION}.tar.gz"
FILENAME pbc-${PBC_VERSION}.tar.gz FILENAME pbc-${VERSION}.tar.gz
SHA512 d75d4ceb3f67ee62c7ca41e2a91ee914fbffaeb70256675aed6734d586950ea8e64e2f16dc069d71481eddb703624df8d46497005fb58e75cf098dd7e7961333 SHA512 d75d4ceb3f67ee62c7ca41e2a91ee914fbffaeb70256675aed6734d586950ea8e64e2f16dc069d71481eddb703624df8d46497005fb58e75cf098dd7e7961333
) )
vcpkg_extract_source_archive( vcpkg_extract_source_archive(
SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE} ARCHIVE ${ARCHIVE}
SOURCE_BASE ${PBC_VERSION} SOURCE_BASE "${VERSION}"
PATCHES linux.patch PATCHES linux.patch
) )
@ -27,7 +25,7 @@ if(NOT VCPKG_TARGET_IS_WINDOWS)
set(OPTIONS ${SHARED_STATIC} LEX=${FLEX} YACC=${BISON}\ -y) set(OPTIONS ${SHARED_STATIC} LEX=${FLEX} YACC=${BISON}\ -y)
vcpkg_configure_make( vcpkg_configure_make(
SOURCE_PATH ${SOURCE_PATH} SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG AUTOCONFIG
COPY_SOURCE COPY_SOURCE
OPTIONS OPTIONS
@ -36,8 +34,8 @@ if(NOT VCPKG_TARGET_IS_WINDOWS)
vcpkg_install_make() vcpkg_install_make()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share ${CURRENT_PACKAGES_DIR}/share/info) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share" "${CURRENT_PACKAGES_DIR}/share/info")
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
else() else()
vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github( vcpkg_from_github(
@ -105,9 +103,10 @@ else()
OPTIONS_DEBUG "/p:RuntimeLibrary=MultiThreadedDebug${RuntimeLibraryExt}" OPTIONS_DEBUG "/p:RuntimeLibrary=MultiThreadedDebug${RuntimeLibraryExt}"
OPTIONS_RELEASE "/p:RuntimeLibrary=MultiThreaded${RuntimeLibraryExt}" OPTIONS_RELEASE "/p:RuntimeLibrary=MultiThreaded${RuntimeLibraryExt}"
OPTIONS /p:SolutionDir=../ OPTIONS /p:SolutionDir=../
ALLOW_ROOT_INCLUDES ON ALLOW_ROOT_INCLUDES
) )
# clean up mpir stuff # clean up mpir stuff
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/mpir.lib ${CURRENT_PACKAGES_DIR}/debug/lib/mpir.lib) file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/mpir.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/mpir.lib")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/unofficial-pbc-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}")
endif() endif()

View File

@ -0,0 +1,25 @@
if(NOT TARGET unofficial::pbc::pbc)
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
add_library(unofficial::pbc::pbc UNKNOWN IMPORTED)
set_target_properties(unofficial::pbc::pbc PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)
find_library(PBC_LIBRARY_DEBUG NAMES pbclib libpbc PATHS "${_IMPORT_PREFIX}/debug" PATH_SUFFIXES lib NO_DEFAULT_PATH)
if(EXISTS "${PBC_LIBRARY_DEBUG}")
set_property(TARGET unofficial::pbc::pbc APPEND PROPERTY IMPORTED_CONFIGURATIONS "Debug")
set_target_properties(unofficial::pbc::pbc PROPERTIES IMPORTED_LOCATION_DEBUG "${PBC_LIBRARY_DEBUG}")
endif()
find_library(PBC_LIBRARY_RELEASE NAMES pbclib libpbc PATHS "${_IMPORT_PREFIX}/" PATH_SUFFIXES lib NO_DEFAULT_PATH)
if(EXISTS "${PBC_LIBRARY_RELEASE}")
set_property(TARGET unofficial::pbc::pbc APPEND PROPERTY IMPORTED_CONFIGURATIONS "Release")
set_target_properties(unofficial::pbc::pbc PROPERTIES IMPORTED_LOCATION_RELEASE "${PBC_LIBRARY_RELEASE}")
endif()
unset(_IMPORT_PREFIX)
endif()

View File

@ -4,6 +4,7 @@
"port-version": 7, "port-version": 7,
"description": "Pairing-Based Crypto library provides low-level routines for pairing-based cryptosystems.", "description": "Pairing-Based Crypto library provides low-level routines for pairing-based cryptosystems.",
"homepage": "https://crypto.stanford.edu/pbc", "homepage": "https://crypto.stanford.edu/pbc",
"license": "LGPL-3.0",
"supports": "!uwp & !arm", "supports": "!uwp & !arm",
"dependencies": [ "dependencies": [
{ {

View File

@ -1,7 +1,7 @@
{ {
"versions": [ "versions": [
{ {
"git-tree": "8622a50777b672d1eb2066d3110c8cb503da84ba", "git-tree": "23f4f1804aaa515560fdd3efa19485c9714d2a20",
"version": "0.5.14", "version": "0.5.14",
"port-version": 7 "port-version": 7
}, },