Skip to content

Commit af71dc6

Browse files
committed
cmake: Build bench_bitcoin executable
1 parent 6da00bb commit af71dc6

File tree

4 files changed

+111
-0
lines changed

4 files changed

+111
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ tristate_option(WITH_USDT
6767
AUTO
6868
)
6969

70+
option(BUILD_BENCH "Build bench_bitcoin executable." ON)
71+
7072
if(CXX20)
7173
set(CMAKE_CXX_STANDARD 20)
7274
else()
@@ -169,6 +171,8 @@ message(" NAT-PMP ............................. ${WITH_NATPMP}")
169171
message(" UPnP ................................ ${WITH_MINIUPNPC}")
170172
message(" ZeroMQ .............................. ${WITH_ZMQ}")
171173
message(" USDT tracing ........................ ${WITH_USDT}")
174+
message("Tests:")
175+
message(" bench_bitcoin ....................... ${BUILD_BENCH}")
172176
message("")
173177
if(CMAKE_CROSSCOMPILING)
174178
set(cross_status "TRUE, for ${CMAKE_SYSTEM_NAME}, ${CMAKE_SYSTEM_PROCESSOR}")

src/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,9 @@ if(BUILD_UTIL)
281281
bitcoin_util
282282
)
283283
endif()
284+
285+
286+
add_subdirectory(test/util)
287+
if(BUILD_BENCH)
288+
add_subdirectory(bench)
289+
endif()

src/bench/CMakeLists.txt

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Copyright (c) 2023 The Bitcoin Core developers
2+
# Distributed under the MIT software license, see the accompanying
3+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
include(GenerateHeaders)
6+
generate_header_from_raw(data/block413567.raw)
7+
8+
add_executable(bench_bitcoin
9+
bench_bitcoin.cpp
10+
bench.cpp
11+
data.cpp
12+
nanobench.cpp
13+
${CMAKE_CURRENT_BINARY_DIR}/data/block413567.raw.h
14+
# Benchmarks:
15+
addrman.cpp
16+
base58.cpp
17+
bech32.cpp
18+
bip324_ecdh.cpp
19+
block_assemble.cpp
20+
ccoins_caching.cpp
21+
chacha20.cpp
22+
chacha_poly_aead.cpp
23+
checkblock.cpp
24+
checkqueue.cpp
25+
crypto_hash.cpp
26+
descriptors.cpp
27+
duplicate_inputs.cpp
28+
ellswift.cpp
29+
examples.cpp
30+
gcs_filter.cpp
31+
hashpadding.cpp
32+
load_external.cpp
33+
lockedpool.cpp
34+
logging.cpp
35+
mempool_eviction.cpp
36+
mempool_stress.cpp
37+
merkle_root.cpp
38+
peer_eviction.cpp
39+
poly1305.cpp
40+
pool.cpp
41+
prevector.cpp
42+
rollingbloom.cpp
43+
rpc_blockchain.cpp
44+
rpc_mempool.cpp
45+
streams_findbyte.cpp
46+
strencodings.cpp
47+
util_time.cpp
48+
verify_script.cpp
49+
)
50+
51+
target_link_libraries(bench_bitcoin
52+
test_util
53+
leveldb
54+
univalue
55+
Boost::headers
56+
)
57+
58+
if(ENABLE_WALLET)
59+
target_sources(bench_bitcoin
60+
PRIVATE
61+
coin_selection.cpp
62+
wallet_balance.cpp
63+
wallet_create_tx.cpp
64+
wallet_loading.cpp
65+
)
66+
target_link_libraries(bench_bitcoin bitcoin_wallet)
67+
endif()

src/test/util/CMakeLists.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright (c) 2023 The Bitcoin Core developers
2+
# Distributed under the MIT software license, see the accompanying
3+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
add_library(test_util STATIC EXCLUDE_FROM_ALL
6+
blockfilter.cpp
7+
coins.cpp
8+
index.cpp
9+
json.cpp
10+
logging.cpp
11+
mining.cpp
12+
net.cpp
13+
script.cpp
14+
setup_common.cpp
15+
str.cpp
16+
transaction_utils.cpp
17+
txmempool.cpp
18+
validation.cpp
19+
)
20+
target_link_libraries(test_util
21+
PRIVATE
22+
bitcoin_common
23+
bitcoin_node
24+
leveldb
25+
univalue
26+
Boost::headers
27+
)
28+
29+
if(ENABLE_WALLET)
30+
target_sources(test_util
31+
PRIVATE
32+
../../wallet/test/util.cpp
33+
)
34+
endif()

0 commit comments

Comments
 (0)