@@ -26,45 +26,27 @@ get_directory_property(precious_variables CACHE_VARIABLES)
2626#=============================
2727# Project / Package metadata
2828#=============================
29- set (CLIENT_NAME "Bitcoin Core" )
30- set (CLIENT_VERSION_MAJOR 29)
31- set (CLIENT_VERSION_MINOR 99)
32- set (CLIENT_VERSION_BUILD 0)
33- set (CLIENT_VERSION_RC 0)
34- set (CLIENT_VERSION_IS_RELEASE "false" )
35- set (COPYRIGHT_YEAR "2025" )
36-
37- # During the enabling of the CXX and CXXOBJ languages, we modify
38- # CMake's compiler/linker invocation strings by appending the content
39- # of the user-defined `APPEND_*` variables, which allows overriding
40- # any flag. We also ensure that the APPEND_* flags are considered
41- # during CMake's tests, which use the `try_compile()` command.
42- #
43- # CMake's docs state that the `CMAKE_TRY_COMPILE_PLATFORM_VARIABLES`
44- # variable "is meant to be set by CMake's platform information modules
45- # for the current toolchain, or by a toolchain file." We do our best
46- # to set it before the `project()` command.
47- set (CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
48- CMAKE_CXX_COMPILE_OBJECT
49- CMAKE_OBJCXX_COMPILE_OBJECT
50- CMAKE_CXX_LINK_EXECUTABLE
51- )
52-
53- project (BitcoinCore
54- VERSION ${CLIENT_VERSION_MAJOR} .${CLIENT_VERSION_MINOR} .${CLIENT_VERSION_BUILD}
55- DESCRIPTION "Bitcoin client software"
56- HOMEPAGE_URL "https://bitcoincore.org/"
57- LANGUAGES NONE
29+ project (libsecp256k1
30+ # The package (a.k.a. release) version is based on semantic versioning 2.0.0 of
31+ # the API. All changes in experimental modules are treated as
32+ # backwards-compatible and therefore at most increase the minor version.
33+ VERSION 0.6.1
34+ DESCRIPTION "Optimized C library for ECDSA signatures and secret/public key operations on curve secp256k1."
35+ HOMEPAGE_URL "https://github.com/bitcoin-core/secp256k1"
36+ LANGUAGES C
5837)
59-
60- set (CLIENT_VERSION_STRING ${PROJECT_VERSION} )
61- if (CLIENT_VERSION_RC GREATER 0)
62- string (APPEND CLIENT_VERSION_STRING "rc${CLIENT_VERSION_RC} " )
63- endif ()
64-
65- set (COPYRIGHT_HOLDERS "The %s developers" )
66- set (COPYRIGHT_HOLDERS_FINAL "The ${CLIENT_NAME} developers" )
67- set (CLIENT_BUGREPORT "https://github.com/bitcoin/bitcoin/issues" )
38+ enable_testing ()
39+ include (CTestUseLaunchers) # Allow users to set CTEST_USE_LAUNCHERS in custom `ctest -S` scripts.
40+ list (APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR} /cmake)
41+
42+ # The library version is based on libtool versioning of the ABI. The set of
43+ # rules for updating the version can be found here:
44+ # https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
45+ # All changes in experimental modules are treated as if they don't affect the
46+ # interface and therefore only increase the revision.
47+ set (${PROJECT_NAME} _LIB_VERSION_CURRENT 5)
48+ set (${PROJECT_NAME} _LIB_VERSION_REVISION 1)
49+ set (${PROJECT_NAME} _LIB_VERSION_AGE 0)
6850
6951#=============================
7052# Language setup
@@ -103,14 +85,61 @@ option(BUILD_TESTS "Build test_bitcoin and other unit test executables." ON)
10385option (BUILD_TX "Build bitcoin-tx executable." ${BUILD_TESTS} )
10486option (BUILD_UTIL "Build bitcoin-util executable." ${BUILD_TESTS} )
10587
106- option (BUILD_UTIL_CHAINSTATE "Build experimental bitcoin-chainstate executable." OFF )
107- option (BUILD_KERNEL_LIB "Build experimental bitcoinkernel library." ${BUILD_UTIL_CHAINSTATE} )
108-
109- option (ENABLE_WALLET "Enable wallet." ON )
110- if (ENABLE_WALLET)
111- if (VCPKG_TARGET_TRIPLET)
112- # Use of the `unofficial::` namespace is a vcpkg package manager convention.
113- find_package (unofficial-sqlite3 CONFIG REQUIRED)
88+ ## Modules
89+
90+ # We declare all options before processing them, to make sure we can express
91+ # dependencies while processing.
92+ option (SECP256K1_ENABLE_MODULE_ECDH "Enable ECDH module." ON )
93+ option (SECP256K1_ENABLE_MODULE_RECOVERY "Enable ECDSA pubkey recovery module." OFF )
94+ option (SECP256K1_ENABLE_MODULE_EXTRAKEYS "Enable extrakeys module." ON )
95+ option (SECP256K1_ENABLE_MODULE_SCHNORRSIG "Enable schnorrsig module." ON )
96+ option (SECP256K1_ENABLE_MODULE_MUSIG "Enable musig module." ON )
97+ option (SECP256K1_ENABLE_MODULE_ELLSWIFT "Enable ElligatorSwift module." ON )
98+ option (SECP256K1_ENABLE_MODULE_SILENTPAYMENTS "Enable Silent Payments module." ON )
99+
100+ option (SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS "Enable external default callback functions." OFF )
101+ if (SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS)
102+ add_compile_definitions (USE_EXTERNAL_DEFAULT_CALLBACKS=1)
103+ endif ()
104+
105+ set (SECP256K1_ECMULT_WINDOW_SIZE 15 CACHE STRING "Window size for ecmult precomputation for verification, specified as integer in range [2..24]. The default value is a reasonable setting for desktop machines (currently 15). [default=15]" )
106+ set_property (CACHE SECP256K1_ECMULT_WINDOW_SIZE PROPERTY STRINGS 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24)
107+ include (CheckStringOptionValue)
108+ check_string_option_value(SECP256K1_ECMULT_WINDOW_SIZE)
109+ add_compile_definitions (ECMULT_WINDOW_SIZE=${SECP256K1_ECMULT_WINDOW_SIZE} )
110+
111+ set (SECP256K1_ECMULT_GEN_KB 86 CACHE STRING "The size of the precomputed table for signing in multiples of 1024 bytes (on typical platforms). Larger values result in possibly better signing or key generation performance at the cost of a larger table. Valid choices are 2, 22, 86. The default value is a reasonable setting for desktop machines (currently 86). [default=86]" )
112+ set_property (CACHE SECP256K1_ECMULT_GEN_KB PROPERTY STRINGS 2 22 86)
113+ check_string_option_value(SECP256K1_ECMULT_GEN_KB)
114+ if (SECP256K1_ECMULT_GEN_KB EQUAL 2)
115+ add_compile_definitions (COMB_BLOCKS=2)
116+ add_compile_definitions (COMB_TEETH=5)
117+ elseif (SECP256K1_ECMULT_GEN_KB EQUAL 22)
118+ add_compile_definitions (COMB_BLOCKS=11)
119+ add_compile_definitions (COMB_TEETH=6)
120+ elseif (SECP256K1_ECMULT_GEN_KB EQUAL 86)
121+ add_compile_definitions (COMB_BLOCKS=43)
122+ add_compile_definitions (COMB_TEETH=6)
123+ endif ()
124+
125+ set (SECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY "OFF" CACHE STRING "Test-only override of the (autodetected by the C code) \" widemul\" setting. Legal values are: \" OFF\" , \" int128_struct\" , \" int128\" or \" int64\" . [default=OFF]" )
126+ set_property (CACHE SECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY PROPERTY STRINGS "OFF" "int128_struct" "int128" "int64" )
127+ check_string_option_value(SECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY)
128+ if (SECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY)
129+ string (TOUPPER "${SECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY} " widemul_upper_value)
130+ add_compile_definitions (USE_FORCE_WIDEMUL_${widemul_upper_value} =1)
131+ endif ()
132+ mark_as_advanced (FORCE SECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY)
133+
134+ set (SECP256K1_ASM "AUTO" CACHE STRING "Assembly to use: \" AUTO\" , \" OFF\" , \" x86_64\" or \" arm32\" (experimental). [default=AUTO]" )
135+ set_property (CACHE SECP256K1_ASM PROPERTY STRINGS "AUTO" "OFF" "x86_64" "arm32" )
136+ check_string_option_value(SECP256K1_ASM)
137+ if (SECP256K1_ASM STREQUAL "arm32" )
138+ enable_language (ASM)
139+ include (CheckArm32Assembly)
140+ check_arm32_assembly()
141+ if (HAVE_ARM32_ASM)
142+ add_compile_definitions (USE_EXTERNAL_ASM=1)
114143 else ()
115144 find_package (SQLite3 3.7.17 REQUIRED)
116145 endif ()
@@ -653,20 +682,19 @@ if(BUILD_DAEMON AND ENABLE_IPC)
653682else ()
654683 set (bitcoin_daemon_status OFF )
655684endif ()
656- message (" bitcoin-node (multiprocess) ......... ${bitcoin_daemon_status} " )
657- message (" bitcoin-qt (GUI) .................... ${BUILD_GUI} " )
658- if (BUILD_GUI AND ENABLE_IPC)
659- set (bitcoin_gui_status ON )
660- else ()
661- set (bitcoin_gui_status OFF )
662- endif ()
663- message (" bitcoin-gui (GUI, multiprocess) ..... ${bitcoin_gui_status} " )
664- message (" bitcoin-cli ......................... ${BUILD_CLI} " )
665- message (" bitcoin-tx .......................... ${BUILD_TX} " )
666- message (" bitcoin-util ........................ ${BUILD_UTIL} " )
667- message (" bitcoin-wallet ...................... ${BUILD_WALLET_TOOL} " )
668- message (" bitcoin-chainstate (experimental) ... ${BUILD_UTIL_CHAINSTATE} " )
669- message (" libbitcoinkernel (experimental) ..... ${BUILD_KERNEL_LIB} " )
685+
686+ message (" library type ........................ ${library_type} " )
687+ message ("Optional modules:" )
688+ message (" ECDH ................................ ${SECP256K1_ENABLE_MODULE_ECDH} " )
689+ message (" ECDSA pubkey recovery ............... ${SECP256K1_ENABLE_MODULE_RECOVERY} " )
690+ message (" extrakeys ........................... ${SECP256K1_ENABLE_MODULE_EXTRAKEYS} " )
691+ message (" schnorrsig .......................... ${SECP256K1_ENABLE_MODULE_SCHNORRSIG} " )
692+ message (" musig ............................... ${SECP256K1_ENABLE_MODULE_MUSIG} " )
693+ message (" ElligatorSwift ...................... ${SECP256K1_ENABLE_MODULE_ELLSWIFT} " )
694+ message (" Silent Payments ..................... ${SECP256K1_ENABLE_MODULE_SILENTPAYMENTS} " )
695+ message ("Parameters:" )
696+ message (" ecmult window size .................. ${SECP256K1_ECMULT_WINDOW_SIZE} " )
697+ message (" ecmult gen table size ............... ${SECP256K1_ECMULT_GEN_KB} KiB" )
670698message ("Optional features:" )
671699message (" wallet support ...................... ${ENABLE_WALLET} " )
672700message (" external signer ..................... ${ENABLE_EXTERNAL_SIGNER} " )
@@ -696,18 +724,54 @@ else()
696724 set (cross_status "FALSE" )
697725endif ()
698726message ("Cross compiling ....................... ${cross_status} " )
699- message ("C++ compiler .......................... ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} , ${CMAKE_CXX_COMPILER} " )
700- include (FlagsSummary)
701- flags_summary()
702- message ("Treat compiler warnings as errors ..... ${WERROR} " )
703- message ("Use ccache for compiling .............. ${WITH_CCACHE} " )
704- message ("\n " )
705- if (configure_warnings)
706- message (" ******\n " )
707- foreach (warning IN LISTS configure_warnings)
708- message (WARNING "${warning} " )
709- endforeach ()
710- message (" ******\n " )
727+ message ("Valgrind .............................. ${SECP256K1_VALGRIND} " )
728+ get_directory_property (definitions COMPILE_DEFINITIONS )
729+ string (REPLACE ";" " " definitions "${definitions} " )
730+ message ("Preprocessor defined macros ........... ${definitions} " )
731+ message ("C compiler ............................ ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION} , ${CMAKE_C_COMPILER} " )
732+ message ("CFLAGS ................................ ${CMAKE_C_FLAGS} " )
733+ get_directory_property (compile_options COMPILE_OPTIONS)
734+ string (REPLACE ";" " " compile_options "${compile_options} " )
735+ message ("Compile options ....................... " ${compile_options} )
736+ if (NOT is_multi_config)
737+ message ("Build type:" )
738+ message (" - CMAKE_BUILD_TYPE ................... ${CMAKE_BUILD_TYPE} " )
739+ string (TOUPPER "${CMAKE_BUILD_TYPE} " build_type )
740+ message (" - CFLAGS ............................. ${CMAKE_C_FLAGS_${build_type} }" )
741+ message (" - LDFLAGS for executables ............ ${CMAKE_EXE_LINKER_FLAGS_${build_type} }" )
742+ message (" - LDFLAGS for shared libraries ....... ${CMAKE_SHARED_LINKER_FLAGS_${build_type} }" )
743+ else ()
744+ message ("Supported configurations .............. ${CMAKE_CONFIGURATION_TYPES} " )
745+ message ("RelWithDebInfo configuration:" )
746+ message (" - CFLAGS ............................. ${CMAKE_C_FLAGS_RELWITHDEBINFO} " )
747+ message (" - LDFLAGS for executables ............ ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} " )
748+ message (" - LDFLAGS for shared libraries ....... ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} " )
749+ message ("Debug configuration:" )
750+ message (" - CFLAGS ............................. ${CMAKE_C_FLAGS_DEBUG} " )
751+ message (" - LDFLAGS for executables ............ ${CMAKE_EXE_LINKER_FLAGS_DEBUG} " )
752+ message (" - LDFLAGS for shared libraries ....... ${CMAKE_SHARED_LINKER_FLAGS_DEBUG} " )
753+ endif ()
754+ if (SECP256K1_APPEND_CFLAGS)
755+ message ("SECP256K1_APPEND_CFLAGS ............... ${SECP256K1_APPEND_CFLAGS} " )
756+ endif ()
757+ if (SECP256K1_APPEND_LDFLAGS)
758+ message ("SECP256K1_APPEND_LDFLAGS .............. ${SECP256K1_APPEND_LDFLAGS} " )
759+ endif ()
760+ message ("" )
761+ if (print_msan_notice)
762+ message (
763+ "Note:\n "
764+ " MemorySanitizer detected, tried to add -fno-sanitize-memory-param-retval to compile options\n "
765+ " to avoid false positives in ctime_tests. Pass -DSECP256K1_BUILD_CTIME_TESTS=OFF to avoid this.\n "
766+ )
767+ endif ()
768+ if (SECP256K1_EXPERIMENTAL)
769+ message (
770+ " ******\n "
771+ " WARNING: experimental build\n "
772+ " Experimental features do not have stable APIs or properties, and may not be safe for production use.\n "
773+ " ******\n "
774+ )
711775endif ()
712776
713777# We want all build properties to be encapsulated properly.
0 commit comments