mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-28 21:39:18 +08:00
1782b7edf2
* Update secp256k1 from 2017 to 2022, that added Schnorr Signature on last year. - Edit CMakeList.txt to target precomputed library. - Edit libsecp256k1-config.h to undef and define VARS compilation. - Edit portfile.cmake to download new sources from repository, commit reference 44c2452fd387f7ca604ab42d73746e7d3a44d8a2 (bitcoin-core/secp256k1) - Edit vcpkg.json to new version portfile * Update secp256k1 from 2017 to 2022, that added Schnorr Signature on last year >> vcpkg x-add-version secp256k1 - Update secp256k1.json version - Update baseline.json version * Update ports/secp256k1/portfile.cmake Added JonLiu1993 suggestion. Put PREFER_NINJA to secp256k1/portfile.cmake Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> * Update ports/secp256k1/vcpkg.json Added JonLiu1993 suggestion. Put dependencies to secp256k1/vcpkg.json Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> * Update port-version, REQUIRED to "x-add-version" >> vcpkg x-add-version secp256k1 * Update port file to secp256k1 identation * Update vcpkg.json identation >> vcpkg format-manifest ports/secp256k1/vcpkg.json * Update x-add-version command vcpkg x-add-version secp256k1 * [secp256k1 ]Update secp256k1 from 2017 to 2022 * update version * Add license * update version * Update, add features * version * fix * version * clean port version * version Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> Co-authored-by: Jonliu1993 <13720414433@163.com> Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
86 lines
2.9 KiB
CMake
86 lines
2.9 KiB
CMake
cmake_minimum_required(VERSION 3.8)
|
|
project(secp256k1 C)
|
|
|
|
option(INSTALL_HEADERS "Install header files" ON)
|
|
option(BUILD_TOOLS "Build tools" OFF)
|
|
option(BUILD_EXAMPLES "Build examples" OFF)
|
|
|
|
add_definitions(
|
|
-DENABLE_MODULE_ECDH
|
|
-DENABLE_MODULE_RECOVERY
|
|
-DENABLE_MODULE_EXTRAKEYS
|
|
-DENABLE_MODULE_SCHNORRSIG
|
|
)
|
|
|
|
file(GLOB SOURCES src/secp256k1.c)
|
|
add_library(secp256k1 ${SOURCES})
|
|
|
|
target_include_directories(secp256k1 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include;${CMAKE_CURRENT_SOURCE_DIR}/src> $<INSTALL_INTERFACE:include>)
|
|
|
|
file(GLOB SOURCES_PRECOMP src/precomputed_ecmult.c src/precomputed_ecmult_gen.c)
|
|
add_library(secp256k1_precomputed ${SOURCES_PRECOMP})
|
|
|
|
target_include_directories(secp256k1_precomputed PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
|
|
|
|
if (BUILD_TOOLS)
|
|
add_executable(bench src/bench.c)
|
|
target_link_libraries(bench PRIVATE secp256k1 secp256k1_precomputed)
|
|
|
|
add_executable(bench_internal src/bench_internal.c)
|
|
target_link_libraries(bench_internal PRIVATE secp256k1_precomputed)
|
|
|
|
add_executable(bench_ecmult src/bench_ecmult.c)
|
|
target_link_libraries(bench_ecmult PRIVATE secp256k1_precomputed)
|
|
|
|
install(TARGETS bench bench_internal bench_ecmult RUNTIME DESTINATION bin)
|
|
endif()
|
|
|
|
if (BUILD_EXAMPLES)
|
|
add_executable(ecdsa_example examples/ecdsa.c)
|
|
target_include_directories(ecdsa_example PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
target_link_libraries(ecdsa_example PRIVATE secp256k1 secp256k1_precomputed)
|
|
if (WIN32)
|
|
target_link_libraries(ecdsa_example PRIVATE Bcrypt)
|
|
endif()
|
|
|
|
add_executable(ecdh_example examples/ecdh.c)
|
|
target_include_directories(ecdh_example PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
target_link_libraries(ecdh_example PRIVATE secp256k1 secp256k1_precomputed)
|
|
if (WIN32)
|
|
target_link_libraries(ecdh_example PRIVATE Bcrypt)
|
|
endif()
|
|
|
|
add_executable(schnorr_example examples/schnorr.c)
|
|
target_include_directories(schnorr_example PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
target_link_libraries(schnorr_example PRIVATE secp256k1 secp256k1_precomputed)
|
|
if (WIN32)
|
|
target_link_libraries(schnorr_example PRIVATE Bcrypt)
|
|
endif()
|
|
|
|
install(TARGETS ecdsa_example ecdh_example schnorr_example RUNTIME DESTINATION bin)
|
|
endif()
|
|
|
|
if(INSTALL_HEADERS)
|
|
file(GLOB HEADERS include/*.h)
|
|
install(FILES ${HEADERS} DESTINATION include)
|
|
endif()
|
|
|
|
install(TARGETS secp256k1 EXPORT unofficial-secp256k1-config
|
|
RUNTIME DESTINATION bin
|
|
ARCHIVE DESTINATION lib
|
|
LIBRARY DESTINATION lib
|
|
)
|
|
|
|
install(TARGETS secp256k1_precomputed EXPORT unofficial-secp256k1-config
|
|
RUNTIME DESTINATION bin
|
|
ARCHIVE DESTINATION lib
|
|
LIBRARY DESTINATION lib
|
|
)
|
|
|
|
install(
|
|
EXPORT unofficial-secp256k1-config
|
|
FILE unofficial-secp256k1-config.cmake
|
|
NAMESPACE unofficial::
|
|
DESTINATION share/unofficial-secp256k1
|
|
)
|