From 965578c137f359c0ffeb3c5bcf986eb42b89e541 Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Fri, 13 Sep 2024 11:05:43 +0200 Subject: [PATCH] build: libbitcoin_sv2 scaffold --- CMakeLists.txt | 3 +++ doc/design/libraries.md | 1 + src/CMakeLists.txt | 3 +++ src/sv2/CMakeLists.txt | 14 ++++++++++++++ src/test/CMakeLists.txt | 7 +++++++ src/test/fuzz/CMakeLists.txt | 9 +++++++++ 6 files changed, 37 insertions(+) create mode 100644 src/sv2/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 767ccc5774993..4defcf08beecb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,6 +149,8 @@ if(WITH_MULTIPROCESS) ) endif() +option(WITH_SV2 "Enable Stratum v2 functionality." ON) + cmake_dependent_option(BUILD_GUI_TESTS "Build test_bitcoin-qt executable." ON "BUILD_GUI;BUILD_TESTS" OFF) if(BUILD_GUI) set(qt_components Core Gui Widgets LinguistTools) @@ -610,6 +612,7 @@ message(" ZeroMQ .............................. ${WITH_ZMQ}") message(" USDT tracing ........................ ${WITH_USDT}") message(" QR code (GUI) ....................... ${WITH_QRENCODE}") message(" DBus (GUI, Linux only) .............. ${WITH_DBUS}") +message(" Stratum v2 .......................... ${WITH_SV2}") message("Tests:") message(" test_bitcoin ........................ ${BUILD_TESTS}") message(" test_bitcoin-qt ..................... ${BUILD_GUI_TESTS}") diff --git a/doc/design/libraries.md b/doc/design/libraries.md index 24185bf4776df..8448fb7011d69 100644 --- a/doc/design/libraries.md +++ b/doc/design/libraries.md @@ -14,6 +14,7 @@ | *libbitcoin_wallet* | Wallet functionality used by *bitcoind* and *bitcoin-wallet* executables. | | *libbitcoin_wallet_tool* | Lower-level wallet functionality used by *bitcoin-wallet* executable. | | *libbitcoin_zmq* | [ZeroMQ](../zmq.md) functionality used by *bitcoind* and *bitcoin-qt* executables. | +| *libbitcoin_sv2* | Stratum v2 functionality (usage TBD) | ## Conventions diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 22c850e775595..d21eb1dc66170 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -29,6 +29,9 @@ add_subdirectory(util) if(WITH_MULTIPROCESS) add_subdirectory(ipc) endif() +if(WITH_SV2) + add_subdirectory(sv2) +endif() #============================= # secp256k1 subtree diff --git a/src/sv2/CMakeLists.txt b/src/sv2/CMakeLists.txt new file mode 100644 index 0000000000000..e02c4c01fa877 --- /dev/null +++ b/src/sv2/CMakeLists.txt @@ -0,0 +1,14 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +add_library(bitcoin_sv2 STATIC EXCLUDE_FROM_ALL +) + +target_link_libraries(bitcoin_sv2 + PRIVATE + core_interface + bitcoin_clientversion + bitcoin_crypto + $<$:ws2_32> +) diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index ed73e44901558..4d13043c95505 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -175,6 +175,13 @@ if(WITH_MULTIPROCESS) target_link_libraries(test_bitcoin bitcoin_ipc_test bitcoin_ipc) endif() +if(WITH_SV2) + target_sources(test_bitcoin + PRIVATE + ) + target_link_libraries(test_bitcoin bitcoin_sv2) +endif() + function(add_boost_test source_file) if(NOT EXISTS ${source_file}) return() diff --git a/src/test/fuzz/CMakeLists.txt b/src/test/fuzz/CMakeLists.txt index 1bf05ee4fbd5e..5f959596d9d48 100644 --- a/src/test/fuzz/CMakeLists.txt +++ b/src/test/fuzz/CMakeLists.txt @@ -149,3 +149,12 @@ target_link_libraries(fuzz if(ENABLE_WALLET) add_subdirectory(${PROJECT_SOURCE_DIR}/src/wallet/test/fuzz wallet) endif() + +if(WITH_SV2) + target_sources(fuzz + PRIVATE + ) + target_link_libraries(fuzz + bitcoin_sv2 + ) +endif()