Skip to content

Commit 751453f

Browse files
committed
cmake: Build bench_bitcoin executable
1 parent a2c3493 commit 751453f

File tree

4 files changed

+107
-0
lines changed

4 files changed

+107
-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()
@@ -172,6 +174,8 @@ message(" NAT-PMP ............................. ${WITH_NATPMP}")
172174
message(" UPnP ................................ ${WITH_MINIUPNPC}")
173175
message(" ZeroMQ .............................. ${WITH_ZMQ}")
174176
message(" USDT tracing ........................ ${WITH_USDT}")
177+
message("Tests:")
178+
message(" bench_bitcoin ....................... ${BUILD_BENCH}")
175179
message("")
176180
if(CMAKE_CROSSCOMPILING)
177181
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
@@ -276,3 +276,9 @@ if(BUILD_UTIL)
276276
bitcoin_util
277277
)
278278
endif()
279+
280+
281+
add_subdirectory(test/util)
282+
if(BUILD_BENCH)
283+
add_subdirectory(bench)
284+
endif()

src/bench/CMakeLists.txt

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
block_assemble.cpp
19+
ccoins_caching.cpp
20+
chacha20.cpp
21+
chacha_poly_aead.cpp
22+
checkblock.cpp
23+
checkqueue.cpp
24+
crypto_hash.cpp
25+
descriptors.cpp
26+
duplicate_inputs.cpp
27+
examples.cpp
28+
gcs_filter.cpp
29+
hashpadding.cpp
30+
load_external.cpp
31+
lockedpool.cpp
32+
logging.cpp
33+
mempool_eviction.cpp
34+
mempool_stress.cpp
35+
merkle_root.cpp
36+
peer_eviction.cpp
37+
poly1305.cpp
38+
pool.cpp
39+
prevector.cpp
40+
rollingbloom.cpp
41+
rpc_blockchain.cpp
42+
rpc_mempool.cpp
43+
strencodings.cpp
44+
util_time.cpp
45+
verify_script.cpp
46+
)
47+
48+
target_link_libraries(bench_bitcoin
49+
test_util
50+
leveldb
51+
univalue
52+
Boost::headers
53+
)
54+
55+
if(ENABLE_WALLET)
56+
target_sources(bench_bitcoin
57+
PRIVATE
58+
coin_selection.cpp
59+
wallet_balance.cpp
60+
wallet_create_tx.cpp
61+
wallet_loading.cpp
62+
)
63+
target_link_libraries(bench_bitcoin bitcoin_wallet)
64+
endif()

src/test/util/CMakeLists.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
json.cpp
9+
logging.cpp
10+
mining.cpp
11+
net.cpp
12+
script.cpp
13+
setup_common.cpp
14+
str.cpp
15+
transaction_utils.cpp
16+
txmempool.cpp
17+
validation.cpp
18+
)
19+
target_link_libraries(test_util
20+
PRIVATE
21+
bitcoin_common
22+
bitcoin_node
23+
leveldb
24+
univalue
25+
Boost::headers
26+
)
27+
28+
if(ENABLE_WALLET)
29+
target_sources(test_util
30+
PRIVATE
31+
../../wallet/test/util.cpp
32+
)
33+
endif()

0 commit comments

Comments
 (0)