-
Notifications
You must be signed in to change notification settings - Fork 37.7k
build: Introduce CMake-based build system #30454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
I'd say the section can be removed (or moved to a separate comment), because when this will be merged, I presume many more differences will accumulate. Even looking at the outstanding ports (https://github.com/bitcoin/bitcoin/issues?q=label%3A%22Needs+CMake+port%22+is%3Aclosed) right now, there are some. |
Missing link/reference? |
Thanks! Added. |
src/crypto/sha256.cpp
Outdated
@@ -2,8 +2,6 @@ | |||
// Distributed under the MIT software license, see the accompanying | |||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | |||
|
|||
#include <config/bitcoin-config.h> // IWYU pragma: keep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In commit ff36846
Could you remind me what's going on here, please? I assume these aren't needed because we're meant to be adding compile definitions to specific libs. But from what I can tell, we're not actually adding them to sha256.cpp
? So... is this currently using an un-optimized sha2?
Generally I'd feel more comfortable turning these into opt-outs, I think, to avoid accidentally building without optims.
For the sake of review/sanity, I think for this commit it's worth documenting (in the commit message) exactly which defines are affected and where in CMake they've been added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But from what I can tell, we're not actually adding them to sha256.cpp? So... is this currently using an un-optimized sha2?
Please note the PUBLIC
keyword, which propagates the definition as a usage requirement:
bitcoin/src/crypto/CMakeLists.txt
Line 125 in 2b7c0f4
target_compile_definitions(bitcoin_crypto_arm_shani PUBLIC ENABLE_ARM_SHANI) |
and
bitcoin/src/crypto/CMakeLists.txt
Line 128 in 2b7c0f4
target_link_libraries(bitcoin_crypto PRIVATE bitcoin_crypto_arm_shani) |
where that usage requirement is actually applied.
The same approach works for other definitions used in src/crypto/sha256.cpp
.
For the sake of review/sanity, I think for this commit it's worth documenting (in the commit message) exactly which defines are affected and where in CMake they've been added.
Sure thing! I'll update the commit message during the next branch update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One can see that they are indeed disabled now in https://corecheck.dev/bitcoin/bitcoin/pulls/30454 (coverage report + benchmarks).
Shouldn't autotools be nuked in this pull request, assuming that cmake and autotools are apparently incompatible, as designed now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see hebasto#269.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm https://corecheck.dev/bitcoin/bitcoin/pulls/30454 is down again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm https://corecheck.dev/bitcoin/bitcoin/pulls/30454 is down again
It is up now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm https://corecheck.dev/bitcoin/bitcoin/pulls/30454 is down again
It is up now :)
Nice. The output there looks better now. But I haven't yet tried locally.
Could add the 29.0 milestone? |
Done. |
d318c4e depends: bump libmultiprocess for CMake fixes (Cory Fields) Pull request description: Broken out of bitcoin#30454 . Bumped [even further](bitcoin@4883197#r1684802528) after bitcoin-core/libmultiprocess#98 was merged upstream. hebasto Presumably this approach works now with the CMake branch? ACKs for top commit: ryanofsky: Code review ACK d318c4e. Tree-SHA512: 4b5491f73c0063d09e8339829cd831b1f4c441dd7b55a22037c9337c80cce19bb00a3e5cf925efa77d6d4e89ab45482f40f5799bc14948f8cabcbad3c3549430
7231c76 qt: Replace deprecated LogPrintf with LogInfo in GUIUtil::LogQtInfo() (Hennadii Stepanov) b3d3ae0 qt, build: Drop `QT_STATICPLUGIN` macro (Hennadii Stepanov) Pull request description: Broken out of bitcoin#30454. Our `QT_STATICPLUGIN` macro is effectively equivalent to the Qt's `QT_STATIC` macro. It is easy to see in the `_BITCOIN_QT_IS_STATIC` macro implementation: https://github.com/bitcoin/bitcoin/blob/ebd82fa9fae13d5a7a395800295dd7fd34185b58/build-aux/m4/bitcoin_qt.m4#L269-L292 No need to handle both macros. ACKs for top commit: maflcko: re-ACK 7231c76 TheCharlatan: ACK 7231c76 Tree-SHA512: abbf21859b7ac2aaf47c5b0e075403e4cc9bc540b1565d23f51650b8932dde314586aca67fd4ed5daadebc89268baf8c18f65348fa2b836078ac24543c14cfd6
…nced local variable" 44f0878 test: Fix MSVC warning C4101 "unreferenced local variable" (Hennadii Stepanov) 5d25a82 univalue, refactor: Convert indentation tabs to spaces (Hennadii Stepanov) Pull request description: This PR is split from bitcoin#30454 and addresses MSVC warning [C4101](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4101) "unreferenced local variable". The current MSVC build system in the master branch skips building univalue tests, so it is not affected. No behaviour changes. ACKs for top commit: kevkevinpal: utACK [44f0878](bitcoin@44f0878) maflcko: ACK 44f0878 theuni: trivial ACK 44f0878. Tree-SHA512: 661d3b40ddb4f7915de7a65ccb27a24da88ae499ce03c036099007260b0597e83738f1a3a420985b51f798ee309ade32988c6d78f4ffed401099b175a0b2025b
8c935e6 depends: Fix CMake-generated `libevent*.pc` files (Hennadii Stepanov) Pull request description: Broken out of bitcoin#30454. This is a backport of the merged upstream PR: libevent/libevent#1622. Note that after bitcoin#29835 we might end up dropping pkg-config and using the installed CMake files directly, but that depends on whether or not enough distros actually ship those files. Either way, having fixed up .pc files won't hurt. ACKs for top commit: hebasto: ACK 8c935e6. fanquake: ACK 8c935e6 Tree-SHA512: 259c2ad78fb9e90370a7205dc71c40acda1a872f6509435133bc1c4c2c3de57366e80679aa083e13ed85e7966883dc470c0147ee171a2ed0171a18cd5ffc99b3
d318c4e depends: bump libmultiprocess for CMake fixes (Cory Fields) Pull request description: Broken out of bitcoin#30454 . Bumped [even further](bitcoin@4883197#r1684802528) after bitcoin-core/libmultiprocess#98 was merged upstream. hebasto Presumably this approach works now with the CMake branch? ACKs for top commit: ryanofsky: Code review ACK d318c4e. Tree-SHA512: 4b5491f73c0063d09e8339829cd831b1f4c441dd7b55a22037c9337c80cce19bb00a3e5cf925efa77d6d4e89ab45482f40f5799bc14948f8cabcbad3c3549430
7231c76 qt: Replace deprecated LogPrintf with LogInfo in GUIUtil::LogQtInfo() (Hennadii Stepanov) b3d3ae0 qt, build: Drop `QT_STATICPLUGIN` macro (Hennadii Stepanov) Pull request description: Broken out of bitcoin#30454. Our `QT_STATICPLUGIN` macro is effectively equivalent to the Qt's `QT_STATIC` macro. It is easy to see in the `_BITCOIN_QT_IS_STATIC` macro implementation: https://github.com/bitcoin/bitcoin/blob/ebd82fa9fae13d5a7a395800295dd7fd34185b58/build-aux/m4/bitcoin_qt.m4#L269-L292 No need to handle both macros. ACKs for top commit: maflcko: re-ACK 7231c76 TheCharlatan: ACK 7231c76 Tree-SHA512: abbf21859b7ac2aaf47c5b0e075403e4cc9bc540b1565d23f51650b8932dde314586aca67fd4ed5daadebc89268baf8c18f65348fa2b836078ac24543c14cfd6
…nced local variable" 44f0878 test: Fix MSVC warning C4101 "unreferenced local variable" (Hennadii Stepanov) 5d25a82 univalue, refactor: Convert indentation tabs to spaces (Hennadii Stepanov) Pull request description: This PR is split from bitcoin#30454 and addresses MSVC warning [C4101](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4101) "unreferenced local variable". The current MSVC build system in the master branch skips building univalue tests, so it is not affected. No behaviour changes. ACKs for top commit: kevkevinpal: utACK [44f0878](bitcoin@44f0878) maflcko: ACK 44f0878 theuni: trivial ACK 44f0878. Tree-SHA512: 661d3b40ddb4f7915de7a65ccb27a24da88ae499ce03c036099007260b0597e83738f1a3a420985b51f798ee309ade32988c6d78f4ffed401099b175a0b2025b
8c935e6 depends: Fix CMake-generated `libevent*.pc` files (Hennadii Stepanov) Pull request description: Broken out of bitcoin#30454. This is a backport of the merged upstream PR: libevent/libevent#1622. Note that after bitcoin#29835 we might end up dropping pkg-config and using the installed CMake files directly, but that depends on whether or not enough distros actually ship those files. Either way, having fixed up .pc files won't hurt. ACKs for top commit: hebasto: ACK 8c935e6. fanquake: ACK 8c935e6 Tree-SHA512: 259c2ad78fb9e90370a7205dc71c40acda1a872f6509435133bc1c4c2c3de57366e80679aa083e13ed85e7966883dc470c0147ee171a2ed0171a18cd5ffc99b3
d318c4e depends: bump libmultiprocess for CMake fixes (Cory Fields) Pull request description: Broken out of bitcoin#30454 . Bumped [even further](bitcoin@4883197#r1684802528) after bitcoin-core/libmultiprocess#98 was merged upstream. hebasto Presumably this approach works now with the CMake branch? ACKs for top commit: ryanofsky: Code review ACK d318c4e. Tree-SHA512: 4b5491f73c0063d09e8339829cd831b1f4c441dd7b55a22037c9337c80cce19bb00a3e5cf925efa77d6d4e89ab45482f40f5799bc14948f8cabcbad3c3549430
7231c76 qt: Replace deprecated LogPrintf with LogInfo in GUIUtil::LogQtInfo() (Hennadii Stepanov) b3d3ae0 qt, build: Drop `QT_STATICPLUGIN` macro (Hennadii Stepanov) Pull request description: Broken out of bitcoin#30454. Our `QT_STATICPLUGIN` macro is effectively equivalent to the Qt's `QT_STATIC` macro. It is easy to see in the `_BITCOIN_QT_IS_STATIC` macro implementation: https://github.com/bitcoin/bitcoin/blob/ebd82fa9fae13d5a7a395800295dd7fd34185b58/build-aux/m4/bitcoin_qt.m4#L269-L292 No need to handle both macros. ACKs for top commit: maflcko: re-ACK 7231c76 TheCharlatan: ACK 7231c76 Tree-SHA512: abbf21859b7ac2aaf47c5b0e075403e4cc9bc540b1565d23f51650b8932dde314586aca67fd4ed5daadebc89268baf8c18f65348fa2b836078ac24543c14cfd6
d318c4e depends: bump libmultiprocess for CMake fixes (Cory Fields) Pull request description: Broken out of bitcoin#30454 . Bumped [even further](bitcoin@4883197#r1684802528) after bitcoin-core/libmultiprocess#98 was merged upstream. hebasto Presumably this approach works now with the CMake branch? ACKs for top commit: ryanofsky: Code review ACK d318c4e. Tree-SHA512: 4b5491f73c0063d09e8339829cd831b1f4c441dd7b55a22037c9337c80cce19bb00a3e5cf925efa77d6d4e89ab45482f40f5799bc14948f8cabcbad3c3549430
7231c76 qt: Replace deprecated LogPrintf with LogInfo in GUIUtil::LogQtInfo() (Hennadii Stepanov) b3d3ae0 qt, build: Drop `QT_STATICPLUGIN` macro (Hennadii Stepanov) Pull request description: Broken out of bitcoin#30454. Our `QT_STATICPLUGIN` macro is effectively equivalent to the Qt's `QT_STATIC` macro. It is easy to see in the `_BITCOIN_QT_IS_STATIC` macro implementation: https://github.com/bitcoin/bitcoin/blob/ebd82fa9fae13d5a7a395800295dd7fd34185b58/build-aux/m4/bitcoin_qt.m4#L269-L292 No need to handle both macros. ACKs for top commit: maflcko: re-ACK 7231c76 TheCharlatan: ACK 7231c76 Tree-SHA512: abbf21859b7ac2aaf47c5b0e075403e4cc9bc540b1565d23f51650b8932dde314586aca67fd4ed5daadebc89268baf8c18f65348fa2b836078ac24543c14cfd6
d318c4e depends: bump libmultiprocess for CMake fixes (Cory Fields) Pull request description: Broken out of bitcoin#30454 . Bumped [even further](bitcoin@4883197#r1684802528) after bitcoin-core/libmultiprocess#98 was merged upstream. hebasto Presumably this approach works now with the CMake branch? ACKs for top commit: ryanofsky: Code review ACK d318c4e. Tree-SHA512: 4b5491f73c0063d09e8339829cd831b1f4c441dd7b55a22037c9337c80cce19bb00a3e5cf925efa77d6d4e89ab45482f40f5799bc14948f8cabcbad3c3549430
7231c76 qt: Replace deprecated LogPrintf with LogInfo in GUIUtil::LogQtInfo() (Hennadii Stepanov) b3d3ae0 qt, build: Drop `QT_STATICPLUGIN` macro (Hennadii Stepanov) Pull request description: Broken out of bitcoin#30454. Our `QT_STATICPLUGIN` macro is effectively equivalent to the Qt's `QT_STATIC` macro. It is easy to see in the `_BITCOIN_QT_IS_STATIC` macro implementation: https://github.com/bitcoin/bitcoin/blob/ebd82fa9fae13d5a7a395800295dd7fd34185b58/build-aux/m4/bitcoin_qt.m4#L269-L292 No need to handle both macros. ACKs for top commit: maflcko: re-ACK 7231c76 TheCharlatan: ACK 7231c76 Tree-SHA512: abbf21859b7ac2aaf47c5b0e075403e4cc9bc540b1565d23f51650b8932dde314586aca67fd4ed5daadebc89268baf8c18f65348fa2b836078ac24543c14cfd6
7703884 Fix MSVC warning C4273 "inconsistent dll linkage" (Hennadii Stepanov) Pull request description: Broken out of bitcoin#30454. When using CMake, the user can select the MSVC runtime library to be: 1) Statically-linked (with the corresponding `x64-windows-static` vcpkg triplet) or 2) Dynamically-linked (with the corresponding `x64-windows` vcpkg triplet) In the latter case, the compiler emits the [C4273](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4273) warning. As the "Necessary on some platforms" comment does not apply to MSVC, skip the declaration for MSVC. The MSVC build system in the master branch supports the statically-linked runtime only: https://github.com/bitcoin/bitcoin/blob/ed739d14b58b5e772a65b85bb421703963b06852/build_msvc/common.init.vcxproj.in#L65 ACKs for top commit: sipa: utACK 7703884 sipsorcery: utACK 7703884. theuni: utACK 7703884 Tree-SHA512: a42e1a0d48973217462e703c418f3e9ef9cb5236267c1bf32912aacaf68976cdd2b9229168523f7c2a99ee3f2fb1bf8add4f342796bdb1e4063ca026b761db51
7231c76 qt: Replace deprecated LogPrintf with LogInfo in GUIUtil::LogQtInfo() (Hennadii Stepanov) b3d3ae0 qt, build: Drop `QT_STATICPLUGIN` macro (Hennadii Stepanov) Pull request description: Broken out of bitcoin#30454. Our `QT_STATICPLUGIN` macro is effectively equivalent to the Qt's `QT_STATIC` macro. It is easy to see in the `_BITCOIN_QT_IS_STATIC` macro implementation: https://github.com/bitcoin/bitcoin/blob/ebd82fa9fae13d5a7a395800295dd7fd34185b58/build-aux/m4/bitcoin_qt.m4#L269-L292 No need to handle both macros. ACKs for top commit: maflcko: re-ACK 7231c76 TheCharlatan: ACK 7231c76 Tree-SHA512: abbf21859b7ac2aaf47c5b0e075403e4cc9bc540b1565d23f51650b8932dde314586aca67fd4ed5daadebc89268baf8c18f65348fa2b836078ac24543c14cfd6
7703884 Fix MSVC warning C4273 "inconsistent dll linkage" (Hennadii Stepanov) Pull request description: Broken out of bitcoin#30454. When using CMake, the user can select the MSVC runtime library to be: 1) Statically-linked (with the corresponding `x64-windows-static` vcpkg triplet) or 2) Dynamically-linked (with the corresponding `x64-windows` vcpkg triplet) In the latter case, the compiler emits the [C4273](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4273) warning. As the "Necessary on some platforms" comment does not apply to MSVC, skip the declaration for MSVC. The MSVC build system in the master branch supports the statically-linked runtime only: https://github.com/bitcoin/bitcoin/blob/ed739d14b58b5e772a65b85bb421703963b06852/build_msvc/common.init.vcxproj.in#L65 ACKs for top commit: sipa: utACK 7703884 sipsorcery: utACK 7703884. theuni: utACK 7703884 Tree-SHA512: a42e1a0d48973217462e703c418f3e9ef9cb5236267c1bf32912aacaf68976cdd2b9229168523f7c2a99ee3f2fb1bf8add4f342796bdb1e4063ca026b761db51
…ng fix 1b0b9b4 Extend possible debugging fixes with file-name-only (Lőrinc) cb7c5ca Add gdb and lldb links to debugging troubleshooting (Lőrinc) Pull request description: Split out of #30454 (comment) While testing the new `cmake` build with [CLion](https://youtrack.jetbrains.com/issue/CPP-15850/Debugger-doesnt-stop-on-breakpoints-in-case-of-fdebug-prefix-map#focus=Comments-27-4926356.0-0), I noticed that the tests don't always stop at the set breakpoints, so I've updated the `developer-notes.md`, hoping it will be useful for others experiencing the same. Added links to gdb and lldb documentations. Assumed a default directory (similarly to https://github.com/hebasto/bitcoin/pull/328/files#diff-4d2a64ce14cb8b971dbba9455421b04ae7ed0c489c66d983664be5632b0de4a3R19) to make the commands more realistic. Extended the possible debugging fixes with `file-name-only` option. ACKs for top commit: achow101: ACK 1b0b9b4 laanwj: ACK 1b0b9b4 Tree-SHA512: 11d2fa69074d6301ee0ca94bc7adb4f251e270624b733c03abc0b91ddb4c9e810d31bd8cbebaebf893974cd85aa14fff94504b93d9c1c46ace64349a84041b41
Unsure if a release note was written, apologies if I missed it. @hebasto @theuni @fanquake could you add to https://github.com/bitcoin-core/bitcoin-devwiki/wiki/29.0-Release-Notes-draft? |
Added. |
…Make changes 7ebc458 qt: doc: adapt outdated binary paths to CMake changes (Sebastian Falbesoner) Pull request description: Adapt the qt-related instances of outdated binary paths to `./build/bin/...` (see [#30454](#30454) and the more recently merged [#31161](#31161)). According to `$ git grep src/qt.*bitcoin` there should be no more left to address. ACKs for top commit: maflcko: lgtm ACK 7ebc458 Sjors: utACK 7ebc458 fanquake: ACK 7ebc458 hebasto: ACK 7ebc458. Tree-SHA512: 8cd6579fdf209ec4ee3c4c9cfb94cb11d5d5115068d31613d356ca1303214dc4461580535c2d3f2773f373a4271e9a82df25596d8369eef8235822f7030d88bd
7231c76 qt: Replace deprecated LogPrintf with LogInfo in GUIUtil::LogQtInfo() (Hennadii Stepanov) b3d3ae0 qt, build: Drop `QT_STATICPLUGIN` macro (Hennadii Stepanov) Pull request description: Broken out of bitcoin#30454. Our `QT_STATICPLUGIN` macro is effectively equivalent to the Qt's `QT_STATIC` macro. It is easy to see in the `_BITCOIN_QT_IS_STATIC` macro implementation: https://github.com/bitcoin/bitcoin/blob/ebd82fa9fae13d5a7a395800295dd7fd34185b58/build-aux/m4/bitcoin_qt.m4#L269-L292 No need to handle both macros. ACKs for top commit: maflcko: re-ACK 7231c76 TheCharlatan: ACK 7231c76 Tree-SHA512: abbf21859b7ac2aaf47c5b0e075403e4cc9bc540b1565d23f51650b8932dde314586aca67fd4ed5daadebc89268baf8c18f65348fa2b836078ac24543c14cfd6
This PR introduces a new CMake-based build system, which is a drop-in replacement for the current Autotools-based build system.
ML announcement: https://groups.google.com/g/bitcoindev/c/hgKkfQWzrTo
As discussed during the recent CoreDev meetup in April, the switch from Autotools to CMake is intended to happen as soon as possible after branching 28.x off, which means that 29.0 will be built using CMake.
This PR branch is essentially the staging branch, with every change reviewed and tested by a group of contributors, including (in alphabetical order):
Reviewing in a separate staging repo was suggested in #27060 (comment).
The accompanying changes to the OSS-Fuzz project are available in hebasto/oss-fuzz#8.
Please refer to the build options parity table. The "auto" value is no longer available; non-default values must be specified explicitly. Additionally, the new default values have been chosen to suit the everyday build experience for the majority of developers.
System requirements for using the CMake-based build system:
A note for Windows users: The default installation of the latest version of MSVC 17.10.4 includes both CMake 3.28.3 and the vcpkg package manager).
We, the build system developers, kindly ask reviewers to refrain from making suggestions that are not directly related to the migration process or can be implemented separately. Bugs in the scripts and errors in the updated documentation should be the focus of this PR. Please be advised that comments not aligned with this PR's goal may be ignored.
Thank you all for your understanding.