mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 17:54:19 +02:00
Merge bitcoin/bitcoin#31161: cmake: Set top-level target output locations
568fcdddaescripted-diff: Adjust documentation per top-level target output location (Hennadii Stepanov)026bb226e9cmake: Set top-level target output locations (Hennadii Stepanov) Pull request description: This PR sets the target output locations to the `bin` and `lib` subdirectories within the build tree, creating a directory structure that mirrors that of the installed targets. This approach is widely adopted by the large projects, such as [LLVM](e146c1867e/lldb/cmake/modules/LLDBStandalone.cmake (L128-L130)): ```cmake set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}) ``` The `libsecp256k1` project has also recently [adopted](https://github.com/bitcoin-core/secp256k1/pull/1553) this approach. With this PR, all binaries are conveniently located. For example, run: ``` $ ./build/bin/fuzz ``` instead of: ``` $ ./build/src/test/fuzz/fuzz ``` On Windows, all required DLLs are now located in the same directory as the executables, allowing to run `bitcoin-chainstate.exe` (which loads `bitcoinkernel.dll`) without the need to copy DLLs or modify the `PATH` variable. The idea was briefly discussed among the build team during the recent CoreDev meeting. --- **Warning**: This PR changes build locations of newly built executables like `bitcoind` and `test_bitcoin` from `src/` to `bin/` without deleting previously built executables. A clean build is recommended to avoid accidentally running old binaries. ACKs for top commit: theStack: Light re-ACK568fcdddaeryanofsky: Code review ACK568fcdddae. Only change since last review was rebasing. I'm ok with this PR in its current form if other developers are happy with it. I just personally think it is inappropriate to \*silently\* break an everyday developer workflow like `git pull; make bitcoind`. I wouldn't have a problem with this PR if it triggered an explicit error, or if the problem was limited to less common workflows like changing cmake options in an existing build. TheCharlatan: Re-ACK568fcdddaetheuni: ACK568fcdddaeTree-SHA512: 1aa5ecd3cd49bd82f1dcc96c8e171d2d19c58aec8dade4bc329df89311f9e50cbf6cf021d004c58a0e1016c375b0fa348ccd52761bcdd179c2d1e61c105e3b9f
This commit is contained in:
@@ -8,10 +8,10 @@ declare -A LIBS
|
||||
LIBS[cli]="libbitcoin_cli.a"
|
||||
LIBS[common]="libbitcoin_common.a"
|
||||
LIBS[consensus]="libbitcoin_consensus.a"
|
||||
LIBS[crypto]="crypto/libbitcoin_crypto.a"
|
||||
LIBS[crypto]="libbitcoin_crypto.a"
|
||||
LIBS[node]="libbitcoin_node.a"
|
||||
LIBS[util]="util/libbitcoin_util.a"
|
||||
LIBS[wallet]="wallet/libbitcoin_wallet.a"
|
||||
LIBS[util]="libbitcoin_util.a"
|
||||
LIBS[wallet]="libbitcoin_wallet.a"
|
||||
|
||||
# Declare allowed dependencies "X Y" where X is allowed to depend on Y. This
|
||||
# list is taken from doc/design/libraries.md.
|
||||
@@ -187,7 +187,7 @@ fi
|
||||
# shellcheck disable=SC2046
|
||||
cmake --build "$BUILD_DIR" -j"$(nproc)" -t $(lib_targets)
|
||||
TEMP_DIR="$(mktemp -d)"
|
||||
cd "$BUILD_DIR/src"
|
||||
cd "$BUILD_DIR/lib"
|
||||
extract_symbols "$TEMP_DIR"
|
||||
if check_libraries "$TEMP_DIR"; then
|
||||
echo "Success! No unexpected dependencies were detected."
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
export LC_ALL=C
|
||||
TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}
|
||||
BUILDDIR=${BUILDDIR:-$TOPDIR/build}
|
||||
BINDIR=${BINDIR:-$BUILDDIR/src}
|
||||
BINDIR=${BINDIR:-$BUILDDIR/bin}
|
||||
BITCOIND=${BITCOIND:-$BINDIR/bitcoind}
|
||||
SHARE_EXAMPLES_DIR=${SHARE_EXAMPLES_DIR:-$TOPDIR/share/examples}
|
||||
EXAMPLE_CONF_FILE=${EXAMPLE_CONF_FILE:-$SHARE_EXAMPLES_DIR/bitcoin.conf}
|
||||
|
||||
@@ -9,12 +9,12 @@ import tempfile
|
||||
import argparse
|
||||
|
||||
BINARIES = [
|
||||
'src/bitcoind',
|
||||
'src/bitcoin-cli',
|
||||
'src/bitcoin-tx',
|
||||
'src/bitcoin-wallet',
|
||||
'src/bitcoin-util',
|
||||
'src/qt/bitcoin-qt',
|
||||
'bin/bitcoind',
|
||||
'bin/bitcoin-cli',
|
||||
'bin/bitcoin-tx',
|
||||
'bin/bitcoin-wallet',
|
||||
'bin/bitcoin-util',
|
||||
'bin/bitcoin-qt',
|
||||
]
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
|
||||
Reference in New Issue
Block a user