vcpkg/ports/secp256k1/CMakeLists.txt

86 lines
2.9 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.8)
project(secp256k1 C)
option(INSTALL_HEADERS "Install header files" ON)
[secp256k1] Update secp256k1 from 2017 to 2022 (#25398) * 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>
2022-07-16 03:08:22 +08:00
option(BUILD_TOOLS "Build tools" OFF)
option(BUILD_EXAMPLES "Build examples" OFF)
add_definitions(
-DENABLE_MODULE_ECDH
-DENABLE_MODULE_RECOVERY
[secp256k1] Update secp256k1 from 2017 to 2022 (#25398) * 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>
2022-07-16 03:08:22 +08:00
-DENABLE_MODULE_EXTRAKEYS
-DENABLE_MODULE_SCHNORRSIG
)
file(GLOB SOURCES src/secp256k1.c)
add_library(secp256k1 ${SOURCES})
2022-07-19 04:16:51 +08:00
target_include_directories(secp256k1 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src> $<INSTALL_INTERFACE:include>)
[secp256k1] Update secp256k1 from 2017 to 2022 (#25398) * 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>
2022-07-16 03:08:22 +08:00
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()
[secp256k1] Update secp256k1 from 2017 to 2022 (#25398) * 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>
2022-07-16 03:08:22 +08:00
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(
[secp256k1] Update secp256k1 from 2017 to 2022 (#25398) * 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>
2022-07-16 03:08:22 +08:00
EXPORT unofficial-secp256k1-config
FILE unofficial-secp256k1-config.cmake
NAMESPACE unofficial::
DESTINATION share/unofficial-secp256k1
[secp256k1] Update secp256k1 from 2017 to 2022 (#25398) * 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>
2022-07-16 03:08:22 +08:00
)