Commit graph

99 commits

Author SHA1 Message Date
ivanlele
b1125e0120
Merge 7e1eca4882 into merged_master (Bitcoin PR bitcoin/bitcoin#33344) 2026-07-14 14:18:40 +00:00
ivanlele
d2bfcaa9db
Merge d360a6ef56 into merged_master (Bitcoin PR bitcoin/bitcoin#32810) 2026-07-13 15:36:56 +00:00
ivanlele
d6516d7f3a
Merge 589b56192f into merged_master (Bitcoin PR bitcoin/bitcoin#32292) 2026-07-13 14:15:43 +00:00
ivanlele
c8f4c0dc55
Merge 1344d3bd0f into merged_master (Bitcoin PR bitcoin/bitcoin#32136) 2026-07-13 14:05:34 +00:00
Tom Trevethan
cb1c30db22
Merge d6db87165c into merged_master (Bitcoin PR bitcoin/bitcoin#32062) 2026-07-13 08:37:40 +01:00
Tom Trevethan
f29fe12e1e
rename test_bitcoin to test_elements 2026-05-11 23:57:42 +01:00
Tom Trevethan
33ff16cbac
build: fix windows/mingw build 2026-05-07 20:34:28 +01:00
ivanlele
e33910c474
Merge 79bbb381a1 into merged_master (Bitcoin PR bitcoin/bitcoin#30901) 2026-04-16 13:19:28 +00:00
ivanlele
1fd8510334
Merge da3ed8b970 into merged_master (Bitcoin PR bitcoin/bitcoin#31662) 2026-04-16 12:21:04 +00:00
ivanlele
d5ef0e2f02
Merge 43e287b3ff into merged_master (Bitcoin PR bitcoin/bitcoin#31892) 2026-04-16 11:12:02 +00:00
Tom Trevethan
a1a5adee04 Merge 06b9236f43 into merged_master (Bitcoin PR bitcoin/bitcoin#31359) 2026-04-15 23:20:36 +01:00
Tom Trevethan
189a598a2a Merge 73e2ec1373 into merged_master (Bitcoin PR bitcoin/bitcoin#31844) 2026-04-15 22:53:42 +01:00
Tom Trevethan
d1715bf4b5 Merge ede388d03d into merged_master (Bitcoin PR bitcoin/bitcoin#30911) 2026-04-15 13:50:47 +01:00
Tom Trevethan
0769cf8a98 Merge 0b6ed342b5 into merged_master (Bitcoin PR bitcoin/bitcoin#31711) 2026-04-15 13:41:27 +01:00
Tom Trevethan
c1c9b145b7 Merge a44ccedcc2 into merged_master (Bitcoin PR bitcoin/bitcoin#31818) 2026-04-15 13:41:13 +01:00
ivanlele
af292df457
Merge eb2ebe6f30 into merged_master (Bitcoin PR bitcoin/bitcoin#31231) 2026-04-08 13:52:04 +00:00
ivanlele
a9df14c956
Merge 8d340be924 into merged_master (Bitcoin PR bitcoin/bitcoin#31181) 2026-04-03 08:14:04 +00:00
ivanlele
b766b3f8c8
Merge 19f277711e into merged_master (Bitcoin PR bitcoin/bitcoin#26593) 2026-04-02 15:08:15 +00:00
ivanlele
cbad0e0ef9
Merge 45e2f8f87d into merged_master (Bitcoin PR bitcoin/bitcoin#31173) 2026-04-02 13:24:37 +00:00
Tom Trevethan
bb2657cc2d Merge dc97e7f6db into merged_master (Bitcoin PR bitcoin/bitcoin#30903) 2026-04-01 23:02:28 +01:00
Tom Trevethan
030ab66c70 Merge 54c4b09f08 into merged_master (Bitcoin PR bitcoin/bitcoin#31042) 2026-04-01 22:41:52 +01:00
Tom Trevethan
1244d0d5a3 Merge 6e21dedbf2 into merged_master (Bitcoin PR bitcoin/bitcoin#31130) 2026-04-01 13:36:19 +01:00
ivanlele
8318484912
Merge ec58dfe8f7 into merged_master (Bitcoin PR bitcoin/bitcoin#31010) 2026-03-27 14:20:47 +00:00
ivanlele
1f6c8b929f
Merge c33eb2360e into merged_master (Bitcoin PR bitcoin/bitcoin#30043) 2026-03-27 11:35:17 +00:00
ivanlele
1259c13ba5
Merge db8350b0e3 into merged_master (Bitcoin PR bitcoin/bitcoin#30803) 2026-03-25 15:32:18 +00:00
ivanlele
55ee06f0d9
Merge a86e7a476d into merged_master (Bitcoin PR bitcoin/bitcoin#30838) 2026-03-25 14:55:09 +00:00
ivanlele
7c12a0a5b0
Merge ba84c2774d into merged_master (Bitcoin PR bitcoin/bitcoin#30823) 2026-03-25 11:42:36 +00:00
ivanlele
4fcd6f4927
Merge c3af4b1ec3 into merged_master (Bitcoin PR bitcoin/bitcoin#30822) 2026-03-25 10:02:16 +00:00
ivanlele
0501efa402
Merge 6852d1d487 into merged_master (Bitcoin PR bitcoin/bitcoin#30796) 2026-03-25 09:34:43 +00:00
ivanlele
b1b308f6e7
Merge fa05ee0517 into merged_master (Bitcoin PR bitcoin/bitcoin#30772) 2026-03-25 09:28:30 +00:00
ivanlele
26176c3cd4
Migrate elements build to Cmake 2026-03-24 11:11:11 +00:00
Luke Dashjr
e97588fc3d
trace: Workaround GCC bug compiling with old systemtap
Github-Pull: #33310
Rebased-From: 93a29ff2830162c8129d35c7b9beb43fab984503
2025-09-12 11:52:26 +01:00
Hennadii Stepanov
a3c1939d6e
cmake: Explicitly specify Boost_ROOT for Homebrew's package
On macOS, this change ensures that the Boost package is located at its
real path rather than via the symlink in the default prefix.

Github-Pull: #32814
Rebased-From: 8800b5acc1ef7abe6c5260ae0be5386b1d593a19
2025-06-26 15:02:08 +01:00
Hennadii Stepanov
a990c1002b
cmake: Use HINTS instead of PATHS in find_* commands
According to the CMake documentation, `HINTS` "should be paths computed
by system introspection, such as a hint provided by the location of
another item already found", which is precisely the case in the
`FindQRencode` module.

Entries in `HINTS` are searched before those in `PATHS`. On macOS,
Homebrew’s `libqrencode` will therefore be located at its real path
rather than via the symlink in the default prefix.

Github-Pull: #32805
Rebased-From: ead44687483e9c936ba970de890c01d5e7ad3485
2025-06-26 12:10:51 +01:00
Hennadii Stepanov
f9d2c67a0c
cmake: Respect user-provided configuration-specific flags
Github-Pull: #32356
Rebased-From: edde96376a2961dec3730331b3d171ddf972589f
2025-05-08 16:35:14 +01:00
Hennadii Stepanov
477345207b cmake: Add NO_CACHE_IF_FAILED option for checking linker flags
Use it for checking `-fsanitize`.

This change improves the user experience when the configuration step
fails due to a missing library. Now, there is no need to manually clean
the CMake cache after installing the required library.

Github-Pull: #32027
Rebased-From: 52ac17757eed5056d03a6861bcc24ee864c17385
2025-03-28 14:24:09 -04:00
Ava Chow
7ff0b02161 build: Remove manpages when making MacOS app
Github-Pull: #32064
Rebased-From: 80b5e7f2cb7fbfbd724e1f52b00c0e72b79a200b
2025-03-16 22:07:20 -04:00
Hennadii Stepanov
ecf54a32ed
cmake: Add support for builtin codegen target
Additionally, this change removes unnecessary braces in the `if()`
command for improved robustness, readability and consistency with CMake
guidelines.
2025-02-21 11:11:30 +00:00
Hennadii Stepanov
a8c78a0574
cmake: Revamp handling of data files
This change introduces new functions `target_json_data_sources()` and
`target_raw_data_sources()`.
2025-02-21 11:11:29 +00:00
merge-script
da3ed8b970
Merge bitcoin/bitcoin#31662: cmake: Do not modify CMAKE_TRY_COMPILE_TARGET_TYPE globally
2c4b229c90 cmake: Introduce `FUZZ_LIBS` (Hennadii Stepanov)
ea929c0848 scripted-diff: Rename CMake helper module (Hennadii Stepanov)
8d238c1dfd cmake: Delete `check_cxx_source_links*` macros (Hennadii Stepanov)
71bf8294a9 cmake: Convert `check_cxx_source_compiles_with_flags` to a function (Hennadii Stepanov)
88ee6800c9 cmake: Delete `check_cxx_source_links_with_flags` macro (Hennadii Stepanov)
09e8fd25b1 build: Don't override CMake's default try_compile target (Hennadii Stepanov)

Pull request description:

  This was requested in https://github.com/bitcoin/bitcoin/pull/31359#issuecomment-2515287092.

  From https://github.com/bitcoin/bitcoin/pull/31359#issuecomment-2511246212:
  > (Almost?) every CMake check internally uses the [`try_compile()`](https://cmake.org/cmake/help/latest/command/try_compile.html) command, whose behaviour, in turn, depends on the [`CMAKE_TRY_COMPILE_TARGET_TYPE`](https://cmake.org/cmake/help/latest/variable/CMAKE_TRY_COMPILE_TARGET_TYPE.html) variable:
  >
  >    1. The default value, `EXECUTABLE`, enables both compiler and linker checks.
  >
  >    2. The `STATIC_LIBRARY` value enables only compiler checks.
  >
  >
  > To mimic Autotools' behaviour, we [disabled](d3f42fa08f/cmake/module/CheckSourceCompilesAndLinks.cmake (L9-L10)) linker checks by setting `CMAKE_TRY_COMPILE_TARGET_TYPE` to `STATIC_LIBRARY` globally (perhaps not the best design). This effectively separates the entire CMake script into regions where `CMAKE_TRY_COMPILE_TARGET_TYPE` is:
  >
  >    * unset
  >
  >    * set to `STATIC_LIBRARY`
  >
  >    * set to `EXECUTABLE`

  From https://github.com/bitcoin/bitcoin/pull/31359#issuecomment-2515287092:
  > > This seems very fragile and unintuitive, and the fact that this could silently break at any point is not documented in any way. I don't think other bad design decisions should lead to us having to write even more boilerplate code to fix things that should "just work" (minus the upstream bugs).
  >
  > Agreed. I forgot that we set `CMAKE_TRY_COMPILE_TARGET_TYPE` globally. And even worse, it's buried in a module. If that upsets CMake internal tests, I think we should undo that.

  This PR ensures that `CMAKE_TRY_COMPILE_TARGET_TYPE` is modified only within local scopes.

  Additionally, the `FUZZ_LIBS` variable has been introduced to handle additional libraries required for linking, rather than link options, in certain build environment, such as OSS-Fuzz.

ACKs for top commit:
  TheCharlatan:
    Re-ACK 2c4b229c90
  theuni:
    utACK 2c4b229c90

Tree-SHA512: f72ffa8f50f216fc1a2f8027ba8ddfd4acd42b94ff6c1cb2138f2da51eb8f945660e97d3c247d7f3f7ec8dfebbccec3ab84347d6ae2e3f8a40f3d7aa8b14cde9
2025-02-20 15:07:03 -05:00
Hennadii Stepanov
ea929c0848
scripted-diff: Rename CMake helper module
-BEGIN VERIFY SCRIPT-
git mv cmake/module/CheckSourceCompilesAndLinks.cmake cmake/module/CheckSourceCompilesWithFlags.cmake
sed -i 's|\<CheckSourceCompilesAndLinks\>|CheckSourceCompilesWithFlags|g' $(git grep -l 'CheckSourceCompilesAndLinks')
-END VERIFY SCRIPT-
2025-02-20 12:39:20 +00:00
Hennadii Stepanov
8d238c1dfd
cmake: Delete check_cxx_source_links* macros 2025-02-20 12:39:12 +00:00
Hennadii Stepanov
71bf8294a9
cmake: Convert check_cxx_source_compiles_with_flags to a function 2025-02-20 12:39:03 +00:00
Hennadii Stepanov
88ee6800c9
cmake: Delete check_cxx_source_links_with_flags macro 2025-02-20 12:38:55 +00:00
Hennadii Stepanov
09e8fd25b1
build: Don't override CMake's default try_compile target
CMake assumes the default value internally, so overriding this causes
problems. The minimal speedup of skipping the linker isn't worth the
complexity of setting it to static.
2025-02-20 12:38:35 +00:00
fanquake
113a7a363f
build: remove ENABLE_HARDENING cond from check-security
This check is only used in release builds, where hardening should always
be enabled. I can't think of a reason we'd want to silently skip these
checks if hardening was inadvertently disabled.
2025-02-17 16:35:28 +00:00
merge-script
06b9236f43
Merge bitcoin/bitcoin#31359: cmake: Add CheckLinkerSupportsPIE module
81c174e318 cmake: Refer to the configure log instead of printing PIE test error (Hennadii Stepanov)
65a0920ca6 cmake: Add `CheckLinkerSupportsPIE` module (Hennadii Stepanov)

Pull request description:

  This new module is a wrapper around CMake's `CheckPIESupported` module that fixes an upstream bug.

  See: https://gitlab.kitware.com/cmake/cmake/-/issues/26463.

  Fixes https://github.com/bitcoin/bitcoin/issues/30771.

ACKs for top commit:
  theuni:
    utACK 81c174e318.
  vasild:
    ACK 81c174e318

Tree-SHA512: 77d7022238551a4e69c59d1fe6b78975bb552cbbed5339459853d7ebf0086813036081f464fed230be330b3bd7d6cf8590b536b064028d2f786d6ae40f342f95
2025-02-14 18:02:35 +01:00
merge-script
73e2ec1373
Merge bitcoin/bitcoin#31844: cmake: add a component for each binary
9b033bebb1 cmake: rename Kernel component to bitcoinkernel for consistency (Cory Fields)
2e0c92558e cmake: add and use install_binary_component (Cory Fields)
0264c5d86c cmake: use per-target components for bitcoin-qt and bitcoin-gui (Cory Fields)
fb0546b1c5 ci: don't try to install for a fuzz build (Cory Fields)

Pull request description:

  This makes it possible to build/install only the desired binaries regardless of the configuration.
  For consistency, the component names match the binary names. `Kernel` and `GUI` have been renamed.

  Additionally it fixes #31762 by installing only the manpages for the configured targets (and includes them in the component installs for each).

  Also fixes #31745.

  Alternative to #31765 which is (imo) more correct/thorough.

  Can be tested using (for ex):
  ```bash
  $ cmake -B build
  $ cmake --build build -t bitcoind -t bitcoin-cli
  $ cmake --install build --component bitcoind
  $ cmake --install build --component bitcoin-cli
  ```

ACKs for top commit:
  hebasto:
    ACK 9b033bebb1.
  TheCharlatan:
    Re-ACK 9b033bebb1
  stickies-v:
    re-ACK 9b033bebb1

Tree-SHA512: fd4818e76f190dbeafbf0c246b466f829771902c9d6d7111ed917093b811c8a5536a4a45e20708f73e7f581d6cb77c8e61cfa69e065788dcf0886792f553a355
2025-02-14 14:19:12 +01:00
Cory Fields
2e0c92558e cmake: add and use install_binary_component
Add a separate component for each binary for fine-grained installation options.

Also install the man pages for only for the targets enabled.
2025-02-13 18:14:41 +00:00
merge-script
ede388d03d
Merge bitcoin/bitcoin#30911: build: simplify by flattening the dependency graph
12fa9511b5 build: simplify dependency graph (Cory Fields)
c4e498300c build: avoid unnecessary dependencies on generated headers (Cory Fields)

Pull request description:

  These changes speed up my build (default config/options/targets) by roughly 10%. I suspect the difference may be more significant in other build configs.

  Before:
  > $ time cmake --build build -j24
  > real3m26.932s

  After:
  > $ time cmake --build build -j24
  > real3m7.556s

  Generally they allow for jobservers (either `make -jX` or `ninja`) to be better utilized. This can be verified using `top` while building and looking at the number of compiles running at any given time before/after these changes. Before, it's easy to observe periods of stalling when only one or two compiles are happening. After these changes, the compiler process count should mostly match the number of jobs given (`-jX`) until it falls off at the end.

  ---

  The first commit sets [DEPENDS_EXPLICIT_ONLY](https://cmake.org/cmake/help/latest/command/add_custom_command.html#command:add_custom_command) for commands which generate our test header files. Without this option, `test_bitcoin`'s generated headers won't be built until all of its other dependencies have been built. This introduces a significant stall in the build, though currently only Ninja benefits from this being set, and only CMake >= 3.27 understands it.

  Example from a generated `build.ninja`:

  Before:

  > \# Custom command for src/test/data/base58_encode_decode.json.h
  >
  > build src/test/data/base58_encode_decode.json.h | ${cmake_ninja_workdir}src/test/data/base58_encode_decode.json.h: CUSTOM_COMMAND /home/cory/dev/bitcoin/src/test/data/base58_encode_decode.json /home/cory/dev/bitcoin/cmake/script/GenerateHeaderFromJson.cmake || libcrc32c.a libcrc32c_sse42.a libleveldb.a libminisketch.a minisketch_clmul src/bitcoin_clientversion src/crypto/libbitcoin_crypto.a src/crypto/libbitcoin_crypto_avx2.a src/crypto/libbitcoin_crypto_sse41.a src/crypto/libbitcoin_crypto_x86_shani.a src/generate_build_info src/libbitcoin_cli.a src/libbitcoin_common.a src/libbitcoin_consensus.a src/libbitcoin_node.a src/secp256k1/src/libsecp256k1.a src/secp256k1/src/secp256k1_precomputed src/test/util/libtest_util.a src/univalue/libunivalue.a src/util/libbitcoin_util.a src/wallet/libbitcoin_wallet.a src/zmq/libbitcoin_zmq.a

  After:

  > \# Custom command for src/test/data/base58_encode_decode.json.h
  >
  > build src/test/data/base58_encode_decode.json.h | ${cmake_ninja_workdir}src/test/data/base58_encode_decode.json.h: CUSTOM_COMMAND /home/cory/dev/bitcoin/src/test/data/base58_encode_decode.json /home/cory/dev/bitcoin/cmake/script/GenerateHeaderFromJson.cmake

  ---

  The second commit is more significant. It sets [CMAKE_OPTIMIZE_DEPENDENCIES](https://cmake.org/cmake/help/latest/prop_tgt/OPTIMIZE_DEPENDENCIES.html) globally, which allows the objects of static libs to be built in parallel when one lib depends on the other. This can be set as a per-lib property, ~but I don't see any need for that as we don't currently have any edge-cases where this wouldn't be ok. If those should arise, we could always disable on a per-lib basis~.

  Edit: turns out this triggers an [upstream bug](https://gitlab.kitware.com/cmake/cmake/-/issues/24058), which I guess can be considered an edge-case until fixed in CMake. I've added 2 per-lib opt-outs as a result.

  Example:

  Before:

  > \# Link the static library src/libbitcoin_cli.a
  >
  > build src/libbitcoin_cli.a: CXX_STATIC_LIBRARY_LINKER__bitcoin_cli_RelWithDebInfo src/CMakeFiles/bitcoin_cli.dir/compat/stdin.cpp.o src/CMakeFiles/bitcoin_cli.dir/rpc/client.cpp.o || src/univalue/libunivalue.a

  After:

  > \# Link the static library src/libbitcoin_cli.a
  >
  > build src/libbitcoin_cli.a: CXX_STATIC_LIBRARY_LINKER__bitcoin_cli_RelWithDebInfo src/CMakeFiles/bitcoin_cli.dir/compat/stdin.cpp.o src/CMakeFiles/bitcoin_cli.dir/rpc/client.cpp.o
  >

ACKs for top commit:
  l0rinc:
    utACK 12fa9511b5
  hebasto:
    ACK 12fa9511b5.

Tree-SHA512: f85f507e70cdc06acd07542161d9f9b8edf9ba866f08c8ef17aaaed770fa11530a27521c4413456d863463a6e77d4d6983fa623a64e17bbd602c2bc70aacc112
2025-02-12 16:02:57 +01:00