cmake: Add `MULTIPROCESS` option

pull/30454/head
Hennadii Stepanov 3 months ago
parent bb1a450dcb
commit 90cec4d251
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

@ -155,6 +155,15 @@ if(WITH_QRENCODE)
endif()
cmake_dependent_option(WITH_DBUS "Enable DBus support." ON "CMAKE_SYSTEM_NAME STREQUAL \"Linux\" AND BUILD_GUI" OFF)
option(WITH_MULTIPROCESS "Build multiprocess bitcoin-node and bitcoin-gui executables in addition to monolithic bitcoind and bitcoin-qt executables. Requires libmultiprocess library. Experimental." OFF)
if(WITH_MULTIPROCESS)
find_package(Libmultiprocess COMPONENTS Lib)
find_package(LibmultiprocessNative COMPONENTS Bin
NAMES Libmultiprocess
)
endif()
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)
@ -495,7 +504,14 @@ message("Configure summary")
message("=================")
message("Executables:")
message(" bitcoind ............................ ${BUILD_DAEMON}")
message(" bitcoin-node (multiprocess) ......... ${WITH_MULTIPROCESS}")
message(" bitcoin-qt (GUI) .................... ${BUILD_GUI}")
if(BUILD_GUI AND WITH_MULTIPROCESS)
set(bitcoin_gui_status ON)
else()
set(bitcoin_gui_status OFF)
endif()
message(" bitcoin-gui (GUI, multiprocess) ..... ${bitcoin_gui_status}")
message(" bitcoin-cli ......................... ${BUILD_CLI}")
message(" bitcoin-tx .......................... ${BUILD_TX}")
message(" bitcoin-util ........................ ${BUILD_UTIL}")

@ -31,6 +31,9 @@ add_dependencies(bitcoin_clientversion generate_build_info)
add_subdirectory(crypto)
add_subdirectory(univalue)
add_subdirectory(util)
if(WITH_MULTIPROCESS)
add_subdirectory(ipc)
endif()
#=============================
# secp256k1 subtree
@ -297,6 +300,18 @@ if(BUILD_DAEMON)
$<TARGET_NAME_IF_EXISTS:bitcoin_wallet>
)
endif()
if(WITH_MULTIPROCESS)
add_executable(bitcoin-node
bitcoind.cpp
init/bitcoin-node.cpp
)
target_link_libraries(bitcoin-node
core_interface
bitcoin_node
bitcoin_ipc
$<TARGET_NAME_IF_EXISTS:bitcoin_wallet>
)
endif()
add_library(bitcoin_cli STATIC EXCLUDE_FROM_ALL

@ -0,0 +1,18 @@
# 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/.
add_library(bitcoin_ipc STATIC EXCLUDE_FROM_ALL
capnp/protocol.cpp
interfaces.cpp
process.cpp
)
target_capnp_sources(bitcoin_ipc ${PROJECT_SOURCE_DIR}
capnp/echo.capnp capnp/init.capnp
)
target_link_libraries(bitcoin_ipc
PRIVATE
core_interface
)

@ -243,6 +243,23 @@ if(WIN32)
set_target_properties(bitcoin-qt PROPERTIES WIN32_EXECUTABLE TRUE)
endif()
if(WITH_MULTIPROCESS)
add_executable(bitcoin-gui
main.cpp
../init/bitcoin-gui.cpp
)
target_link_libraries(bitcoin-gui
core_interface
bitcoinqt
bitcoin_node
bitcoin_ipc
)
import_plugins(bitcoin-gui)
if(WIN32)
set_target_properties(bitcoin-gui PROPERTIES WIN32_EXECUTABLE TRUE)
endif()
endif()
if(BUILD_GUI_TESTS)
add_subdirectory(test)
endif()

@ -158,6 +158,28 @@ if(ENABLE_WALLET)
add_subdirectory(${PROJECT_SOURCE_DIR}/src/wallet/test wallet)
endif()
if(WITH_MULTIPROCESS)
add_library(bitcoin_ipc_test STATIC EXCLUDE_FROM_ALL
ipc_test.cpp
)
target_capnp_sources(bitcoin_ipc_test ${PROJECT_SOURCE_DIR}
ipc_test.capnp
)
target_link_libraries(bitcoin_ipc_test
PRIVATE
core_interface
univalue
)
target_sources(test_bitcoin
PRIVATE
ipc_tests.cpp
)
target_link_libraries(test_bitcoin bitcoin_ipc_test)
endif()
function(add_boost_test source_file)
if(NOT EXISTS ${source_file})
return()

Loading…
Cancel
Save