cmake: Build `bench_bitcoin` executable

pull/30454/head
Hennadii Stepanov 3 months ago
parent 801735163a
commit 8bb0e85631
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

@ -140,6 +140,8 @@ endif()
cmake_dependent_option(ENABLE_EXTERNAL_SIGNER "Enable external signer support." ON "NOT WIN32" OFF) cmake_dependent_option(ENABLE_EXTERNAL_SIGNER "Enable external signer support." ON "NOT WIN32" OFF)
option(BUILD_BENCH "Build bench_bitcoin executable." OFF)
set(configure_warnings) set(configure_warnings)
include(CheckPIESupported) include(CheckPIESupported)
@ -264,7 +266,7 @@ target_link_libraries(core_interface INTERFACE
include(AddBoostIfNeeded) include(AddBoostIfNeeded)
add_boost_if_needed() add_boost_if_needed()
if(BUILD_DAEMON OR BUILD_CLI OR BUILD_TESTS) if(BUILD_DAEMON OR BUILD_CLI OR BUILD_TESTS OR BUILD_BENCH)
find_package(Libevent 2.1.8 MODULE REQUIRED) find_package(Libevent 2.1.8 MODULE REQUIRED)
endif() endif()
@ -320,6 +322,7 @@ message(" ZeroMQ .............................. ${WITH_ZMQ}")
message(" USDT tracing ........................ ${WITH_USDT}") message(" USDT tracing ........................ ${WITH_USDT}")
message("Tests:") message("Tests:")
message(" test_bitcoin ........................ ${BUILD_TESTS}") message(" test_bitcoin ........................ ${BUILD_TESTS}")
message(" bench_bitcoin ....................... ${BUILD_BENCH}")
message("") message("")
message("C++ compiler .......................... ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}, ${CMAKE_CXX_COMPILER}") message("C++ compiler .......................... ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}, ${CMAKE_CXX_COMPILER}")
include(FlagsSummary) include(FlagsSummary)

@ -339,6 +339,10 @@ endif()
add_subdirectory(test/util) add_subdirectory(test/util)
if(BUILD_BENCH)
add_subdirectory(bench)
endif()
if(BUILD_TESTS) if(BUILD_TESTS)
add_subdirectory(test) add_subdirectory(test)
endif() endif()

@ -0,0 +1,81 @@
# Copyright (c) 2023-present The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/license/mit/.
include(GenerateHeaders)
generate_header_from_raw(data/block413567.raw)
add_executable(bench_bitcoin
bench_bitcoin.cpp
bench.cpp
data.cpp
nanobench.cpp
${CMAKE_CURRENT_BINARY_DIR}/data/block413567.raw.h
# Benchmarks:
addrman.cpp
base58.cpp
bech32.cpp
bip324_ecdh.cpp
block_assemble.cpp
ccoins_caching.cpp
chacha20.cpp
checkblock.cpp
checkblockindex.cpp
checkqueue.cpp
cluster_linearize.cpp
crypto_hash.cpp
descriptors.cpp
disconnected_transactions.cpp
duplicate_inputs.cpp
ellswift.cpp
examples.cpp
gcs_filter.cpp
hashpadding.cpp
index_blockfilter.cpp
load_external.cpp
lockedpool.cpp
logging.cpp
mempool_eviction.cpp
mempool_stress.cpp
merkle_root.cpp
parse_hex.cpp
peer_eviction.cpp
poly1305.cpp
pool.cpp
prevector.cpp
random.cpp
readblock.cpp
rollingbloom.cpp
rpc_blockchain.cpp
rpc_mempool.cpp
sign_transaction.cpp
streams_findbyte.cpp
strencodings.cpp
util_time.cpp
verify_script.cpp
xor.cpp
)
target_link_libraries(bench_bitcoin
core_interface
test_util
bitcoin_node
Boost::headers
)
if(ENABLE_WALLET)
target_sources(bench_bitcoin
PRIVATE
coin_selection.cpp
wallet_balance.cpp
wallet_create.cpp
wallet_create_tx.cpp
wallet_loading.cpp
wallet_ismine.cpp
)
target_link_libraries(bench_bitcoin bitcoin_wallet)
endif()
add_test(NAME bench_sanity_check_high_priority
COMMAND bench_bitcoin -sanity-check -priority-level=high
)
Loading…
Cancel
Save