v30.3-roots.1 · Commit 1: [PATCH 01/68] build: adapt Roots platform support to Core 30.3
CMakeLists.txt
Before: CMakeLists.txt · After: CMakeLists.txt
File metadata
index 0e4c72c06551d88c8b43185905976b0178140d4a..69537baa706f5736d75e8a5c6c625fc019b8aaf3 100644
Download original patch · Release notes
Diff rows 1–253 of 253. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
CMakeLists.txt
CHANGED
|
@@ -57,15 +57,15 @@ project(BitcoinCore
|
|
|
57
57
|
LANGUAGES NONE
|
|
58
58
|
)
|
|
59
59
|
|
|
60
|
+
set(COPYRIGHT_HOLDERS "The %s developers")
|
|
61
|
+
set(COPYRIGHT_HOLDERS_FINAL "The ${CLIENT_NAME} developers")
|
|
62
|
+
set(CLIENT_BUGREPORT "https://github.com/bitcoin/bitcoin/issues")
|
|
63
|
+
|
|
60
64
|
set(CLIENT_VERSION_STRING ${PROJECT_VERSION})
|
|
61
65
|
if(CLIENT_VERSION_RC GREATER 0)
|
|
62
66
|
string(APPEND CLIENT_VERSION_STRING "rc${CLIENT_VERSION_RC}")
|
|
63
67
|
endif()
|
|
64
68
|
|
|
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")
|
|
68
|
-
|
|
69
69
|
#=============================
|
|
70
70
|
# Language setup
|
|
71
71
|
#=============================
|
|
@@ -97,6 +97,8 @@ include(CMakeDependentOption)
|
|
|
97
97
|
option(BUILD_BITCOIN_BIN "Build bitcoin executable." ON)
|
|
98
98
|
option(BUILD_DAEMON "Build bitcoind executable." ON)
|
|
99
99
|
option(BUILD_GUI "Build bitcoin-qt executable." OFF)
|
|
100
|
+
set(WITH_QT_VERSION "6" CACHE STRING "Choose 5 or 6.")
|
|
101
|
+
set_property(CACHE WITH_QT_VERSION PROPERTY STRINGS "5" "6")
|
|
100
102
|
option(BUILD_CLI "Build bitcoin-cli executable." ON)
|
|
101
103
|
|
|
102
104
|
option(BUILD_TESTS "Build test_bitcoin and other unit test executables." ON)
|
|
@@ -106,6 +108,56 @@ option(BUILD_UTIL "Build bitcoin-util executable." ${BUILD_TESTS})
|
|
|
106
108
|
option(BUILD_UTIL_CHAINSTATE "Build experimental bitcoin-chainstate executable." OFF)
|
|
107
109
|
option(BUILD_KERNEL_LIB "Build experimental bitcoinkernel library." ${BUILD_UTIL_CHAINSTATE})
|
|
108
110
|
|
|
111
|
+
option(WITH_SYSTEM_LEVELDB "Build with system LevelDB instead of embedded fork." OFF)
|
|
112
|
+
mark_as_advanced(WITH_SYSTEM_LEVELDB)
|
|
113
|
+
if(WITH_SYSTEM_LEVELDB)
|
|
114
|
+
find_package(LevelDB MODULE REQUIRED)
|
|
115
|
+
else()
|
|
116
|
+
set(EMBEDDED_LEVELDB TRUE)
|
|
117
|
+
endif() # WITH_SYSTEM_LEVELDB
|
|
118
|
+
|
|
119
|
+
option(WITH_SYSTEM_LIBSECP256K1 "Build with system libsecp256k1 instead of embedded copy." OFF)
|
|
120
|
+
mark_as_advanced(WITH_SYSTEM_LIBSECP256K1)
|
|
121
|
+
if(WITH_SYSTEM_LIBSECP256K1)
|
|
122
|
+
find_package(PkgConfig REQUIRED)
|
|
123
|
+
pkg_check_modules(libsecp256k1 REQUIRED IMPORTED_TARGET libsecp256k1)
|
|
124
|
+
add_library(secp256k1 ALIAS PkgConfig::libsecp256k1)
|
|
125
|
+
|
|
126
|
+
if(NOT (libsecp256k1_HAS_SECP256K1_ELLSWIFT_CREATE AND libsecp256k1_HAS_SECP256K1_XONLY_PUBKEY_PARSE AND libsecp256k1_HAS_SECP256K1_ECDSA_RECOVER AND libsecp256k1_HAS_SECP256K1_SCHNORRSIG_VERIFY AND libsecp256k1_HAS_SECP256K1_MUSIG_PUBKEY_AGG))
|
|
127
|
+
include(CheckSymbolExists)
|
|
128
|
+
include(CMakePushCheckState)
|
|
129
|
+
cmake_push_check_state(RESET)
|
|
130
|
+
string(APPEND CMAKE_REQUIRED_FLAGS " ${libsecp256k1_CFLAGS_OTHER}")
|
|
131
|
+
list(APPEND CMAKE_REQUIRED_INCLUDES ${libsecp256k1_INCLUDE_DIRS})
|
|
132
|
+
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS ${libsecp256k1_LDFLAGS})
|
|
133
|
+
list(APPEND CMAKE_REQUIRED_LIBRARIES ${libsecp256k1_LIBRARIES})
|
|
134
|
+
unset(missing_modules)
|
|
135
|
+
macro(check_secp256k1_module module symbol)
|
|
136
|
+
string(TOUPPER "${symbol}" VAR)
|
|
137
|
+
set(VAR "libsecp256k1_HAS_${VAR}")
|
|
138
|
+
unset(${VAR})
|
|
139
|
+
check_symbol_exists("${symbol}" "secp256k1_${module}.h" ${VAR})
|
|
140
|
+
if(NOT ${VAR})
|
|
141
|
+
list(APPEND missing_modules "${module}")
|
|
142
|
+
endif()
|
|
143
|
+
endmacro()
|
|
144
|
+
message(CHECK_START "Checking for required libsecp256k1 modules")
|
|
145
|
+
list(APPEND CMAKE_MESSAGE_INDENT " ")
|
|
146
|
+
check_secp256k1_module(ellswift secp256k1_ellswift_create)
|
|
147
|
+
check_secp256k1_module(extrakeys secp256k1_xonly_pubkey_parse)
|
|
148
|
+
check_secp256k1_module(recovery secp256k1_ecdsa_recover)
|
|
149
|
+
check_secp256k1_module(schnorrsig secp256k1_schnorrsig_verify)
|
|
150
|
+
check_secp256k1_module(musig secp256k1_musig_pubkey_agg)
|
|
151
|
+
list(POP_BACK CMAKE_MESSAGE_INDENT)
|
|
152
|
+
if(missing_modules)
|
|
153
|
+
list(JOIN missing_modules ", " missing_modules)
|
|
154
|
+
message(FATAL_ERROR "System-installed libsecp256k1 lacks these required modules: ${missing_modules}.")
|
|
155
|
+
endif()
|
|
156
|
+
message(CHECK_PASS "all were found")
|
|
157
|
+
cmake_pop_check_state()
|
|
158
|
+
endif()
|
|
159
|
+
endif() # WITH_SYSTEM_LIBSECP256K1
|
|
160
|
+
|
|
109
161
|
option(ENABLE_WALLET "Enable wallet." ON)
|
|
110
162
|
if(ENABLE_WALLET)
|
|
111
163
|
if(VCPKG_TARGET_TRIPLET)
|
|
@@ -125,6 +177,11 @@ option(REDUCE_EXPORTS "Attempt to reduce exported symbols in the resulting execu
|
|
|
125
177
|
option(WERROR "Treat compiler warnings as errors." OFF)
|
|
126
178
|
option(WITH_CCACHE "Attempt to use ccache for compiling." ON)
|
|
127
179
|
|
|
180
|
+
option(WITH_MINIUPNPC "Enable UPnP." OFF)
|
|
181
|
+
if(WITH_MINIUPNPC)
|
|
182
|
+
find_package(MiniUPnPc MODULE REQUIRED)
|
|
183
|
+
endif()
|
|
184
|
+
|
|
128
185
|
option(WITH_ZMQ "Enable ZMQ notifications." OFF)
|
|
129
186
|
if(WITH_ZMQ)
|
|
130
187
|
find_package(ZeroMQ 4.0.0 MODULE REQUIRED)
|
|
@@ -137,6 +194,8 @@ endif()
|
|
|
137
194
|
|
|
138
195
|
option(ENABLE_EXTERNAL_SIGNER "Enable external signer support." ON)
|
|
139
196
|
|
|
197
|
+
option(ENABLE_TOR_SUBPROCESS "Enable support for executing a dedicated Tor node." ON)
|
|
198
|
+
|
|
140
199
|
cmake_dependent_option(WITH_QRENCODE "Enable QR code support." ON "BUILD_GUI" OFF)
|
|
141
200
|
if(WITH_QRENCODE)
|
|
142
201
|
find_package(QRencode MODULE REQUIRED)
|
|
@@ -145,6 +204,8 @@ endif()
|
|
|
145
204
|
|
|
146
205
|
cmake_dependent_option(WITH_DBUS "Enable DBus support." ON "NOT CMAKE_SYSTEM_NAME MATCHES \"(Windows|Darwin)\" AND BUILD_GUI" OFF)
|
|
147
206
|
|
|
207
|
+
cmake_dependent_option(WITH_TASKBAR_PROGRESS "Enable GUI taskbar progress." ON "CMAKE_SYSTEM_NAME STREQUAL \"Windows\" AND BUILD_GUI" OFF)
|
|
208
|
+
|
|
148
209
|
cmake_dependent_option(ENABLE_IPC "Build multiprocess bitcoin-node and bitcoin-gui executables in addition to monolithic bitcoind and bitcoin-qt executables." ON "NOT WIN32" OFF)
|
|
149
210
|
cmake_dependent_option(WITH_EXTERNAL_LIBMULTIPROCESS "Build with external libmultiprocess library instead of with local git subtree when ENABLE_IPC is enabled. This is not normally recommended, but can be useful for developing libmultiprocess itself." OFF "ENABLE_IPC" OFF)
|
|
150
211
|
if(ENABLE_IPC AND WITH_EXTERNAL_LIBMULTIPROCESS)
|
|
@@ -164,12 +225,21 @@ if(BUILD_GUI)
|
|
|
164
225
|
list(APPEND qt_components DBus)
|
|
165
226
|
set(USE_DBUS TRUE)
|
|
166
227
|
endif()
|
|
228
|
+
if(WITH_TASKBAR_PROGRESS)
|
|
229
|
+
set(BITCOIN_QT_WIN_TASKBAR TRUE)
|
|
230
|
+
endif()
|
|
167
231
|
if(BUILD_GUI_TESTS)
|
|
168
232
|
list(APPEND qt_components Test)
|
|
169
233
|
endif()
|
|
170
|
-
find_package(Qt 6.2 MODULE REQUIRED
|
|
171
|
-
COMPONENTS ${qt_components}
|
|
172
|
-
)
|
|
234
|
+
if("${WITH_QT_VERSION}" STREQUAL "6")
|
|
235
|
+
find_package(Qt 6.2 MODULE REQUIRED
|
|
236
|
+
COMPONENTS ${qt_components}
|
|
237
|
+
)
|
|
238
|
+
else() # ! Qt 6
|
|
239
|
+
find_package(Qt 5.11.3 MODULE REQUIRED
|
|
240
|
+
COMPONENTS ${qt_components}
|
|
241
|
+
)
|
|
242
|
+
endif() # Qt 6
|
|
173
243
|
unset(qt_components)
|
|
174
244
|
endif()
|
|
175
245
|
|
|
@@ -217,6 +287,7 @@ if(BUILD_FOR_FUZZING)
|
|
|
217
287
|
set(BUILD_WALLET_TOOL OFF)
|
|
218
288
|
set(BUILD_GUI OFF)
|
|
219
289
|
set(ENABLE_EXTERNAL_SIGNER OFF)
|
|
290
|
+
set(WITH_MINIUPNPC OFF)
|
|
220
291
|
set(WITH_ZMQ OFF)
|
|
221
292
|
set(BUILD_TESTS OFF)
|
|
222
293
|
set(BUILD_GUI_TESTS OFF)
|
|
@@ -229,9 +300,20 @@ if(BUILD_FOR_FUZZING)
|
|
|
229
300
|
)
|
|
230
301
|
endif()
|
|
231
302
|
|
|
303
|
+
# The external_lib_interface interface library aims to encapsulate build flags, which
|
|
304
|
+
# are specific to non-internal libraries.
|
|
305
|
+
# It is intended to be a usage requirement for non-internal library
|
|
306
|
+
# targets.
|
|
307
|
+
add_library(external_lib_interface INTERFACE)
|
|
308
|
+
|
|
232
309
|
include(TryAppendCXXFlags)
|
|
233
310
|
include(TryAppendLinkerFlag)
|
|
234
311
|
|
|
312
|
+
# Sanitizers require leaving undefined symbols in the library
|
|
313
|
+
if(NOT SANITIZERS)
|
|
314
|
+
try_append_linker_flag("-Wl,--no-undefined" TARGET external_lib_interface)
|
|
315
|
+
endif()
|
|
316
|
+
|
|
235
317
|
# Redefine/adjust per-configuration flags.
|
|
236
318
|
target_compile_definitions(core_interface_debug INTERFACE
|
|
237
319
|
DEBUG
|
|
@@ -307,6 +389,13 @@ if(WIN32)
|
|
|
307
389
|
# As a best effort, target Windows 8.
|
|
308
390
|
try_append_linker_flag("-Wl,--major-subsystem-version,6" TARGET core_interface)
|
|
309
391
|
try_append_linker_flag("-Wl,--minor-subsystem-version,2" TARGET core_interface)
|
|
392
|
+
|
|
393
|
+
find_library(MINGWTHRD_LIBRARY mingwthrd)
|
|
394
|
+
if (MINGWTHRD_LIBRARY)
|
|
395
|
+
target_link_libraries(core_interface INTERFACE
|
|
396
|
+
${MINGWTHRD_LIBRARY}
|
|
397
|
+
)
|
|
398
|
+
endif()
|
|
310
399
|
endif()
|
|
311
400
|
|
|
312
401
|
# Workaround producing large object files, which cannot be handled by the assembler.
|
|
@@ -421,8 +510,12 @@ if(BUILD_DAEMON OR BUILD_GUI OR BUILD_CLI OR BUILD_TESTS OR BUILD_BENCH OR BUILD
|
|
|
421
510
|
find_package(Libevent 2.1.8 MODULE REQUIRED)
|
|
422
511
|
endif()
|
|
423
512
|
|
|
513
|
+
include(cmake/iopriority.cmake)
|
|
514
|
+
|
|
424
515
|
include(cmake/introspection.cmake)
|
|
425
516
|
|
|
517
|
+
include(cmake/mempressure.cmake)
|
|
518
|
+
|
|
426
519
|
include(cmake/ccache.cmake)
|
|
427
520
|
|
|
428
521
|
add_library(warn_interface INTERFACE)
|
|
@@ -460,7 +553,7 @@ else()
|
|
|
460
553
|
try_append_cxx_flags("-Woverloaded-virtual" TARGET warn_interface SKIP_LINK)
|
|
461
554
|
try_append_cxx_flags("-Wsuggest-override" TARGET warn_interface SKIP_LINK)
|
|
462
555
|
try_append_cxx_flags("-Wimplicit-fallthrough" TARGET warn_interface SKIP_LINK)
|
|
463
|
-
try_append_cxx_flags("-Wunreachable-code" TARGET warn_interface SKIP_LINK)
|
|
556
|
+
try_append_cxx_flags("-Wunreachable-code-loop-increment" TARGET warn_interface SKIP_LINK)
|
|
464
557
|
try_append_cxx_flags("-Wdocumentation" TARGET warn_interface SKIP_LINK)
|
|
465
558
|
try_append_cxx_flags("-Wself-assign" TARGET warn_interface SKIP_LINK)
|
|
466
559
|
try_append_cxx_flags("-Wbidi-chars=any" TARGET warn_interface SKIP_LINK)
|
|
@@ -581,6 +674,7 @@ if(WERROR)
|
|
|
581
674
|
unset(werror_flag)
|
|
582
675
|
endif()
|
|
583
676
|
|
|
677
|
+
|
|
584
678
|
# Prefer Unix-style package components over frameworks on macOS.
|
|
585
679
|
# This improves compatibility with Python version managers.
|
|
586
680
|
set(Python3_FIND_FRAMEWORK LAST CACHE STRING "")
|
|
@@ -588,13 +682,28 @@ set(Python3_FIND_FRAMEWORK LAST CACHE STRING "")
|
|
|
588
682
|
# improves compatibility with Python version managers that use shims.
|
|
589
683
|
set(Python3_FIND_UNVERSIONED_NAMES FIRST CACHE STRING "")
|
|
590
684
|
mark_as_advanced(Python3_FIND_FRAMEWORK Python3_FIND_UNVERSIONED_NAMES)
|
|
591
|
-
find_package(Python3 3.10 COMPONENTS Interpreter)
|
|
685
|
+
if(BUILD_GUI)
|
|
686
|
+
find_package(Python3 3.10 REQUIRED COMPONENTS Interpreter)
|
|
687
|
+
else()
|
|
688
|
+
find_package(Python3 3.10 COMPONENTS Interpreter)
|
|
689
|
+
endif()
|
|
592
690
|
if(NOT TARGET Python3::Interpreter)
|
|
593
691
|
list(APPEND configure_warnings
|
|
594
692
|
"Minimum required Python not found."
|
|
595
693
|
)
|
|
596
694
|
endif()
|
|
597
695
|
|
|
696
|
+
if(BUILD_GUI)
|
|
697
|
+
find_program(RSVG_CONVERT rsvg-convert REQUIRED)
|
|
698
|
+
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
699
|
+
find_program(IMAGEMAGICK_CONVERT NAMES magick convert)
|
|
700
|
+
find_program(PNG2ICNS png2icns REQUIRED)
|
|
701
|
+
else()
|
|
702
|
+
find_program(IMAGEMAGICK_CONVERT NAMES magick convert REQUIRED)
|
|
703
|
+
find_program(PNG2ICNS png2icns)
|
|
704
|
+
endif()
|
|
705
|
+
endif()
|
|
706
|
+
|
|
598
707
|
target_compile_definitions(core_interface INTERFACE ${DEPENDS_COMPILE_DEFINITIONS})
|
|
599
708
|
target_compile_definitions(core_interface_relwithdebinfo INTERFACE ${DEPENDS_COMPILE_DEFINITIONS_RELWITHDEBINFO})
|
|
600
709
|
target_compile_definitions(core_interface_debug INTERFACE ${DEPENDS_COMPILE_DEFINITIONS_DEBUG})
|
|
@@ -627,7 +736,6 @@ endif()
|
|
|
627
736
|
if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
|
|
628
737
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|
629
738
|
else()
|
|
630
|
-
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
|
631
739
|
set(CMAKE_SKIP_INSTALL_RPATH TRUE)
|
|
632
740
|
endif()
|
|
633
741
|
add_subdirectory(test)
|
|
@@ -653,7 +761,7 @@ else()
|
|
|
653
761
|
set(bitcoin_daemon_status OFF)
|
|
654
762
|
endif()
|
|
655
763
|
message(" bitcoin-node (multiprocess) ......... ${bitcoin_daemon_status}")
|
|
656
|
-
message(" bitcoin-qt (GUI) .................... ${BUILD_GUI}")
|
|
764
|
+
message(" bitcoin-qt (GUI) .................... ${BUILD_GUI} (Qt ${WITH_QT_VERSION})")
|
|
657
765
|
if(BUILD_GUI AND ENABLE_IPC)
|
|
658
766
|
set(bitcoin_gui_status ON)
|
|
659
767
|
else()
|
|
@@ -669,6 +777,8 @@ message(" libbitcoinkernel (experimental) ..... ${BUILD_KERNEL_LIB}")
|
|
|
669
777
|
message("Optional features:")
|
|
670
778
|
message(" wallet support ...................... ${ENABLE_WALLET}")
|
|
671
779
|
message(" external signer ..................... ${ENABLE_EXTERNAL_SIGNER}")
|
|
780
|
+
message(" tor subprocess ...................... ${ENABLE_TOR_SUBPROCESS}")
|
|
781
|
+
message(" port mapping using UPnP ............. ${WITH_MINIUPNPC}")
|
|
672
782
|
message(" ZeroMQ .............................. ${WITH_ZMQ}")
|
|
673
783
|
if(ENABLE_IPC)
|
|
674
784
|
if (WITH_EXTERNAL_LIBMULTIPROCESS)
|