Skip to content

Commit aed38ea

Browse files
hebastoTheCharlatan
andcommitted
cmake: Build bitcoinkernel library
Co-authored-by: TheCharlatan <[email protected]>
1 parent 975d673 commit aed38ea

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ option(BUILD_TESTS "Build test_bitcoin executable." ON)
7474
option(BUILD_TX "Build bitcoin-tx executable." ${BUILD_TESTS})
7575
option(BUILD_UTIL "Build bitcoin-util executable." ${BUILD_TESTS})
7676

77+
option(BUILD_KERNEL_LIB "Build experimental bitcoinkernel library." OFF)
78+
7779
option(ENABLE_WALLET "Enable wallet." ON)
7880
option(WITH_SQLITE "Enable SQLite wallet support." ${ENABLE_WALLET})
7981
if(WITH_SQLITE)
@@ -205,6 +207,7 @@ if(BUILD_FOR_FUZZING)
205207
set(BUILD_CLI OFF)
206208
set(BUILD_TX OFF)
207209
set(BUILD_UTIL OFF)
210+
set(BUILD_KERNEL_LIB OFF)
208211
set(BUILD_WALLET_TOOL OFF)
209212
set(BUILD_GUI OFF)
210213
set(ENABLE_EXTERNAL_SIGNER OFF)
@@ -495,6 +498,7 @@ message(" bitcoin-cli ......................... ${BUILD_CLI}")
495498
message(" bitcoin-tx .......................... ${BUILD_TX}")
496499
message(" bitcoin-util ........................ ${BUILD_UTIL}")
497500
message(" bitcoin-wallet ...................... ${BUILD_WALLET_TOOL}")
501+
message(" libbitcoinkernel (experimental) ..... ${BUILD_KERNEL_LIB}")
498502
message("Optional features:")
499503
message(" wallet support ...................... ${ENABLE_WALLET}")
500504
if(ENABLE_WALLET)

src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,11 @@ if(BUILD_GUI)
349349
endif()
350350

351351

352+
if(BUILD_KERNEL_LIB)
353+
add_subdirectory(kernel)
354+
endif()
355+
356+
352357
add_subdirectory(test/util)
353358
if(BUILD_BENCH)
354359
add_subdirectory(bench)

src/kernel/CMakeLists.txt

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Copyright (c) 2024-present The Bitcoin Core developers
2+
# Distributed under the MIT software license, see the accompanying
3+
# file COPYING or https://opensource.org/license/mit/.
4+
5+
# TODO: libbitcoinkernel is a work in progress consensus engine
6+
# library, as more and more modules are decoupled from the
7+
# consensus engine, this list will shrink to only those
8+
# which are absolutely necessary.
9+
add_library(bitcoinkernel
10+
bitcoinkernel.cpp
11+
chain.cpp
12+
checks.cpp
13+
chainparams.cpp
14+
coinstats.cpp
15+
context.cpp
16+
cs_main.cpp
17+
disconnected_transactions.cpp
18+
mempool_removal_reason.cpp
19+
../arith_uint256.cpp
20+
../chain.cpp
21+
../coins.cpp
22+
../compressor.cpp
23+
../consensus/merkle.cpp
24+
../consensus/tx_check.cpp
25+
../consensus/tx_verify.cpp
26+
../core_read.cpp
27+
../dbwrapper.cpp
28+
../deploymentinfo.cpp
29+
../deploymentstatus.cpp
30+
../flatfile.cpp
31+
../hash.cpp
32+
../logging.cpp
33+
../node/blockstorage.cpp
34+
../node/chainstate.cpp
35+
../node/utxo_snapshot.cpp
36+
../policy/feerate.cpp
37+
../policy/packages.cpp
38+
../policy/policy.cpp
39+
../policy/rbf.cpp
40+
../policy/settings.cpp
41+
../policy/truc_policy.cpp
42+
../pow.cpp
43+
../primitives/block.cpp
44+
../primitives/transaction.cpp
45+
../pubkey.cpp
46+
../random.cpp
47+
../randomenv.cpp
48+
../script/interpreter.cpp
49+
../script/script.cpp
50+
../script/script_error.cpp
51+
../script/sigcache.cpp
52+
../script/solver.cpp
53+
../signet.cpp
54+
../streams.cpp
55+
../support/lockedpool.cpp
56+
../sync.cpp
57+
../txdb.cpp
58+
../txmempool.cpp
59+
../uint256.cpp
60+
../util/chaintype.cpp
61+
../util/check.cpp
62+
../util/feefrac.cpp
63+
../util/fs.cpp
64+
../util/fs_helpers.cpp
65+
../util/hasher.cpp
66+
../util/moneystr.cpp
67+
../util/rbf.cpp
68+
../util/serfloat.cpp
69+
../util/signalinterrupt.cpp
70+
../util/strencodings.cpp
71+
../util/string.cpp
72+
../util/syserror.cpp
73+
../util/threadnames.cpp
74+
../util/time.cpp
75+
../util/tokenpipe.cpp
76+
../validation.cpp
77+
../validationinterface.cpp
78+
../versionbits.cpp
79+
)
80+
target_link_libraries(bitcoinkernel
81+
PRIVATE
82+
core_interface
83+
bitcoin_clientversion
84+
bitcoin_crypto
85+
leveldb
86+
secp256k1
87+
PUBLIC
88+
Boost::headers
89+
)
90+
91+
# libbitcoinkernel requires default symbol visibility, explicitly
92+
# specify that here so that things still work even when user
93+
# configures with -DREDUCE_EXPORTS=ON
94+
#
95+
# Note this is a quick hack that will be removed as we
96+
# incrementally define what to export from the library.
97+
set_target_properties(bitcoinkernel PROPERTIES
98+
CXX_VISIBILITY_PRESET default
99+
)

0 commit comments

Comments
 (0)