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](https://github.com/llvm/llvm-project/blob/e146c1867e8decfd423034f63a3a863733e03f04/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:
27 files changed
+164
-145
No files matched your search
@@ -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(
|
||||
|
||||
@@ -24,7 +24,7 @@ miner
|
||||
You will first need to pick a difficulty target. Since signet chains are primarily protected by a signature rather than proof of work, there is no need to spend as much energy as possible mining, however you may wish to choose to spend more time than the absolute minimum. The calibrate subcommand can be used to pick a target appropriate for your hardware, eg:
|
||||
|
||||
MINER="./contrib/signet/miner"
|
||||
GRIND="./build/src/bitcoin-util grind"
|
||||
GRIND="./build/bin/bitcoin-util grind"
|
||||
$MINER calibrate --grind-cmd="$GRIND"
|
||||
nbits=1e00f403 for 25s average mining time
|
||||
|
||||
@@ -32,7 +32,7 @@ It defaults to estimating an nbits value resulting in 25s average time to find a
|
||||
|
||||
To mine the first block in your custom chain, you can run:
|
||||
|
||||
CLI="./build/src/bitcoin-cli -conf=mysignet.conf"
|
||||
CLI="./build/bin/bitcoin-cli -conf=mysignet.conf"
|
||||
ADDR=$($CLI -signet getnewaddress)
|
||||
NBITS=1e00f403
|
||||
$MINER --cli="$CLI" generate --grind-cmd="$GRIND" --address="$ADDR" --nbits=$NBITS
|
||||
|
||||
@@ -188,7 +188,7 @@ In a different terminal, starting Bitcoin Core in SigNet mode and with
|
||||
re-indexing enabled.
|
||||
|
||||
```
|
||||
$ ./build/src/bitcoind -signet -reindex
|
||||
$ ./build/bin/bitcoind -signet -reindex
|
||||
```
|
||||
|
||||
This produces the following output.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
This script requires a 'bitcoind' binary compiled with eBPF support and the
|
||||
'validation:block_connected' USDT. By default, it's assumed that 'bitcoind' is
|
||||
located in './build/src/bitcoind'. This can be modified in the script below.
|
||||
located in './build/bin/bitcoind'. This can be modified in the script below.
|
||||
|
||||
EXAMPLES:
|
||||
|
||||
@@ -67,7 +67,7 @@ BEGIN
|
||||
connected block is between the start and end height (or the end height is
|
||||
unset).
|
||||
*/
|
||||
usdt:./build/src/bitcoind:validation:block_connected /arg1 >= $1 && (arg1 <= $2 || $2 == 0 )/
|
||||
usdt:./build/bin/bitcoind:validation:block_connected /arg1 >= $1 && (arg1 <= $2 || $2 == 0 )/
|
||||
{
|
||||
$height = arg1;
|
||||
$transactions = arg2;
|
||||
@@ -102,7 +102,7 @@ usdt:./build/src/bitcoind:validation:block_connected /arg1 >= $1 && (arg1 <= $2
|
||||
blocks where the time it took to connect the block is above the
|
||||
<logging threshold in ms>.
|
||||
*/
|
||||
usdt:./build/src/bitcoind:validation:block_connected / (uint64) arg5 / 1e6 > $3 /
|
||||
usdt:./build/bin/bitcoind:validation:block_connected / (uint64) arg5 / 1e6 > $3 /
|
||||
{
|
||||
$hash = arg0;
|
||||
$height = (int32) arg1;
|
||||
|
||||
@@ -5,7 +5,7 @@ BEGIN
|
||||
printf("Logging opened, closed, misbehaving, and evicted P2P connections\n")
|
||||
}
|
||||
|
||||
usdt:./build/src/bitcoind:net:inbound_connection
|
||||
usdt:./build/bin/bitcoind:net:inbound_connection
|
||||
{
|
||||
$id = (int64) arg0;
|
||||
$addr = str(arg1);
|
||||
@@ -15,7 +15,7 @@ usdt:./build/src/bitcoind:net:inbound_connection
|
||||
printf("INBOUND conn from %s: id=%ld, type=%s, network=%d, total=%d\n", $addr, $id, $conn_type, $network, $existing);
|
||||
}
|
||||
|
||||
usdt:./build/src/bitcoind:net:outbound_connection
|
||||
usdt:./build/bin/bitcoind:net:outbound_connection
|
||||
{
|
||||
$id = (int64) arg0;
|
||||
$addr = str(arg1);
|
||||
@@ -25,7 +25,7 @@ usdt:./build/src/bitcoind:net:outbound_connection
|
||||
printf("OUTBOUND conn to %s: id=%ld, type=%s, network=%d, total=%d\n", $addr, $id, $conn_type, $network, $existing);
|
||||
}
|
||||
|
||||
usdt:./build/src/bitcoind:net:closed_connection
|
||||
usdt:./build/bin/bitcoind:net:closed_connection
|
||||
{
|
||||
$id = (int64) arg0;
|
||||
$addr = str(arg1);
|
||||
@@ -34,7 +34,7 @@ usdt:./build/src/bitcoind:net:closed_connection
|
||||
printf("CLOSED conn to %s: id=%ld, type=%s, network=%d, established=%ld\n", $addr, $id, $conn_type, $network, arg4);
|
||||
}
|
||||
|
||||
usdt:./build/src/bitcoind:net:evicted_inbound_connection
|
||||
usdt:./build/bin/bitcoind:net:evicted_inbound_connection
|
||||
{
|
||||
$id = (int64) arg0;
|
||||
$addr = str(arg1);
|
||||
@@ -43,7 +43,7 @@ usdt:./build/src/bitcoind:net:evicted_inbound_connection
|
||||
printf("EVICTED conn to %s: id=%ld, type=%s, network=%d, established=%ld\n", $addr, $id, $conn_type, $network, arg4);
|
||||
}
|
||||
|
||||
usdt:./build/src/bitcoind:net:misbehaving_connection
|
||||
usdt:./build/bin/bitcoind:net:misbehaving_connection
|
||||
{
|
||||
$id = (int64) arg0;
|
||||
$message = str(arg1);
|
||||
|
||||
@@ -5,7 +5,7 @@ BEGIN
|
||||
printf("Logging P2P traffic\n")
|
||||
}
|
||||
|
||||
usdt:./build/src/bitcoind:net:inbound_message
|
||||
usdt:./build/bin/bitcoind:net:inbound_message
|
||||
{
|
||||
$peer_id = (int64) arg0;
|
||||
$peer_addr = str(arg1);
|
||||
@@ -15,7 +15,7 @@ usdt:./build/src/bitcoind:net:inbound_message
|
||||
printf("inbound '%s' msg from peer %d (%s, %s) with %d bytes\n", $msg_type, $peer_id, $peer_type, $peer_addr, $msg_len);
|
||||
}
|
||||
|
||||
usdt:./build/src/bitcoind:net:outbound_message
|
||||
usdt:./build/bin/bitcoind:net:outbound_message
|
||||
{
|
||||
$peer_id = (int64) arg0;
|
||||
$peer_addr = str(arg1);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
This script requires a 'bitcoind' binary compiled with eBPF support and the
|
||||
'utxocache' tracepoints. By default, it's assumed that 'bitcoind' is
|
||||
located in './build/src/bitcoind'. This can be modified in the script below.
|
||||
located in './build/bin/bitcoind'. This can be modified in the script below.
|
||||
|
||||
NOTE: requires bpftrace v0.12.0 or above.
|
||||
*/
|
||||
@@ -22,7 +22,7 @@ BEGIN
|
||||
/*
|
||||
Attaches to the 'utxocache:add' tracepoint and prints additions to the UTXO set cache.
|
||||
*/
|
||||
usdt:./build/src/bitcoind:utxocache:add
|
||||
usdt:./build/bin/bitcoind:utxocache:add
|
||||
{
|
||||
$txid = arg0;
|
||||
$index = (uint32)arg1;
|
||||
@@ -44,7 +44,7 @@ usdt:./build/src/bitcoind:utxocache:add
|
||||
/*
|
||||
Attaches to the 'utxocache:spent' tracepoint and prints spents from the UTXO set cache.
|
||||
*/
|
||||
usdt:./build/src/bitcoind:utxocache:spent
|
||||
usdt:./build/bin/bitcoind:utxocache:spent
|
||||
{
|
||||
$txid = arg0;
|
||||
$index = (uint32)arg1;
|
||||
@@ -66,7 +66,7 @@ usdt:./build/src/bitcoind:utxocache:spent
|
||||
/*
|
||||
Attaches to the 'utxocache:uncache' tracepoint and uncache UTXOs from the UTXO set cache.
|
||||
*/
|
||||
usdt:./build/src/bitcoind:utxocache:uncache
|
||||
usdt:./build/bin/bitcoind:utxocache:uncache
|
||||
{
|
||||
$txid = arg0;
|
||||
$index = (uint32)arg1;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
# dependencies that cannot be fixed in-tree.
|
||||
#
|
||||
# Example use:
|
||||
# $ valgrind --suppressions=contrib/valgrind.supp build/src/test/test_bitcoin
|
||||
# $ valgrind --suppressions=contrib/valgrind.supp build/bin/test_bitcoin
|
||||
# $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \
|
||||
# --show-leak-kinds=all build/src/test/test_bitcoin
|
||||
# --show-leak-kinds=all build/bin/test_bitcoin
|
||||
#
|
||||
# To create suppressions for found issues, use the --gen-suppressions=all option:
|
||||
# $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \
|
||||
# --show-leak-kinds=all --gen-suppressions=all --show-reachable=yes \
|
||||
# --error-limit=no build/src/test/test_bitcoin
|
||||
# --error-limit=no build/bin/test_bitcoin
|
||||
#
|
||||
# Note that suppressions may depend on OS and/or library versions.
|
||||
# Tested on:
|
||||
|
||||
Reference in new issue
Block a user