Skip to content

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Jul 11, 2025

The codebase, which is compiled, consists of both files in the source tree and additional files generated during the build process. These generated files include headers such as bitcoin-build-config.h, headers generated for tests and benchmarks from data files, and files produced by Qt's tools, such as moc, rcc and uic.

When using Makefile or Ninja generators, CMake 3.31 and later provides a convenient builtin build target codegen, which builds all generated files. For example:

$ cmake -B build -DCMAKE_GENERATOR="Ninja"
$ cmake --build build --target codegen

or

$ cmake -B build -DCMAKE_GENERATOR="Unix Makefiles"
$ cmake --build build --target codegen

However, when building with -DBUILD_GUI=ON, setting the CMAKE_{AUTOMOC,RCC,UIC} variables globally introduces undesired dependencies for Makefiles generators, resulting in building dependencies directly unrelated to the generated files.

This PR resolves that issue. The first commit refactors the build system by factoring out the main library from the test_bitcoin-qt executable, just as is already done for bitcoinqt and bitcoin-qt, and prepares the ground for the second commit.

hebasto added 2 commits July 11, 2025 17:29
This change avoids unnecessary dependencies for the `codegen` target
when using Makefile generators.
@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 11, 2025

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32951.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #32380 (Modernize use of UTF-8 in Windows code by hebasto)

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.

@hebasto
Copy link
Member Author

hebasto commented Jul 11, 2025

My Guix build:

aarch64
6ab7ae50b219efd4675878dabfc783e0335bc67af31ad8bdfeb4d6317b66a054  guix-build-d38eca989aeb/output/aarch64-linux-gnu/SHA256SUMS.part
0ab47d80a7cc03eb654c5ad3b80b7a7ca7f0e02a92b072f21a395ff2508c1ee1  guix-build-d38eca989aeb/output/aarch64-linux-gnu/bitcoin-d38eca989aeb-aarch64-linux-gnu-debug.tar.gz
5fb1183124482b3c49411b8981743e9dba2c959b935a67e7ca938f5aad677ba3  guix-build-d38eca989aeb/output/aarch64-linux-gnu/bitcoin-d38eca989aeb-aarch64-linux-gnu.tar.gz
3eb65847d1cf953458d800cb588a4e317b735cecdb5af9c3a734fd207b557155  guix-build-d38eca989aeb/output/arm-linux-gnueabihf/SHA256SUMS.part
7e0d149f42ff3949c66108c77869cfd7df787b2217268b5049e793ab148e9d6e  guix-build-d38eca989aeb/output/arm-linux-gnueabihf/bitcoin-d38eca989aeb-arm-linux-gnueabihf-debug.tar.gz
c9c4b36656100973f95aeed26ec4c704a78487106fe137204b3324d093664406  guix-build-d38eca989aeb/output/arm-linux-gnueabihf/bitcoin-d38eca989aeb-arm-linux-gnueabihf.tar.gz
826d759bf47667462da61cbbc04081ce37cac445f592a5b2d57419837a7e03fc  guix-build-d38eca989aeb/output/arm64-apple-darwin/SHA256SUMS.part
96def2b09dd83462eb6d565249ef5aa94bd73cdeb3a524d55d9c4d871426bc90  guix-build-d38eca989aeb/output/arm64-apple-darwin/bitcoin-d38eca989aeb-arm64-apple-darwin-codesigning.tar.gz
20a89762c11a3565743de23f6db39f4575a99b2568ec481e41702b781c08bcdf  guix-build-d38eca989aeb/output/arm64-apple-darwin/bitcoin-d38eca989aeb-arm64-apple-darwin-unsigned.tar.gz
f4624b5cb88cecdc69f323a2b5bd3e86356e77ffaebd3798c1fecc3aaf437878  guix-build-d38eca989aeb/output/arm64-apple-darwin/bitcoin-d38eca989aeb-arm64-apple-darwin-unsigned.zip
0b5672e80b265cbbb166d6442a3ba380fc6d6e52c39d8c15283597334b9d4f81  guix-build-d38eca989aeb/output/dist-archive/bitcoin-d38eca989aeb.tar.gz
b84567da803c2b8e04406b45db813f10a3f905c0abce5a4133268e504c6184ee  guix-build-d38eca989aeb/output/powerpc64-linux-gnu/SHA256SUMS.part
6d2d408bb8900c3e76d278f481f29704b080c8276da1275cf97d3ba2e96da152  guix-build-d38eca989aeb/output/powerpc64-linux-gnu/bitcoin-d38eca989aeb-powerpc64-linux-gnu-debug.tar.gz
09a401b73311a50a0deb1972951ac178508a9244a1113d654b262b55a4b772cc  guix-build-d38eca989aeb/output/powerpc64-linux-gnu/bitcoin-d38eca989aeb-powerpc64-linux-gnu.tar.gz
ab2978cb9ddabb28efde5143623ff7ec55a55243635cade122f863456c0ae655  guix-build-d38eca989aeb/output/riscv64-linux-gnu/SHA256SUMS.part
ecaeb86e43702388c63b92b84608ed11ae0cc658e5eb05a49bf47ac98c52a08f  guix-build-d38eca989aeb/output/riscv64-linux-gnu/bitcoin-d38eca989aeb-riscv64-linux-gnu-debug.tar.gz
08d7e4648d7215d95fbbef67d0b2eb7a874d01cb880e82ac39dad832441ec9d7  guix-build-d38eca989aeb/output/riscv64-linux-gnu/bitcoin-d38eca989aeb-riscv64-linux-gnu.tar.gz
a7e076e98319fcee9801b4eb7096d19949f82754f663b9ef787cabe6b5f9df5f  guix-build-d38eca989aeb/output/x86_64-apple-darwin/SHA256SUMS.part
99e506860232ac54e2e3a506f276e4eb0bf668ac307173ec67432e589eb66e8d  guix-build-d38eca989aeb/output/x86_64-apple-darwin/bitcoin-d38eca989aeb-x86_64-apple-darwin-codesigning.tar.gz
9bf50d479a345a02a269e630381ab33d3abf44274b195523ee7af93fabc88d14  guix-build-d38eca989aeb/output/x86_64-apple-darwin/bitcoin-d38eca989aeb-x86_64-apple-darwin-unsigned.tar.gz
fc8053128ab1e188819154cad0ab7cde63cad9922c25f8fcd16d28e03f866b7e  guix-build-d38eca989aeb/output/x86_64-apple-darwin/bitcoin-d38eca989aeb-x86_64-apple-darwin-unsigned.zip
7a434995857d0644a5e4944ba86e486964c05401da23b49301902ff1830c79d6  guix-build-d38eca989aeb/output/x86_64-linux-gnu/SHA256SUMS.part
f8c19bed4c56d806323142fc4179fa500c97737d11b1014bf0fed34f859d7c61  guix-build-d38eca989aeb/output/x86_64-linux-gnu/bitcoin-d38eca989aeb-x86_64-linux-gnu-debug.tar.gz
289324b09407c552f62b03035142683da3484449446b0adfaee324b215d7cb5d  guix-build-d38eca989aeb/output/x86_64-linux-gnu/bitcoin-d38eca989aeb-x86_64-linux-gnu.tar.gz
390349a7082587523de38e646e06b2bebb938747168315b9a3c10b6cec32bf8b  guix-build-d38eca989aeb/output/x86_64-w64-mingw32/SHA256SUMS.part
71957c222392c032fdb88c730912e93570ffe1e73a5758f71e210b60d3c799d7  guix-build-d38eca989aeb/output/x86_64-w64-mingw32/bitcoin-d38eca989aeb-win64-codesigning.tar.gz
ae7b58e6c6106259d391238fd82a6dbcfb7ffd2f292f2c89f89b58f9327d97fb  guix-build-d38eca989aeb/output/x86_64-w64-mingw32/bitcoin-d38eca989aeb-win64-debug.zip
1ec49ebfd3e0816e55398d3d05020301331ef85a9facce53d8c7d50362930ccf  guix-build-d38eca989aeb/output/x86_64-w64-mingw32/bitcoin-d38eca989aeb-win64-setup-unsigned.exe
c527f2cb9bf43d471d562e973d09ff97f48ed67cdfa7043f14956ac0ec888a84  guix-build-d38eca989aeb/output/x86_64-w64-mingw32/bitcoin-d38eca989aeb-win64-unsigned.zip

@hebasto hebasto marked this pull request as draft July 12, 2025 10:47
@hebasto hebasto marked this pull request as ready for review July 12, 2025 11:01
@hebasto hebasto marked this pull request as draft July 12, 2025 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants