mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
cmake: Build test_bitcoin-qt
executable
This commit is contained in:
parent
10fcc668a3
commit
975d67369b
3 changed files with 66 additions and 0 deletions
|
@ -152,6 +152,7 @@ if(WITH_QRENCODE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
cmake_dependent_option(WITH_DBUS "Enable DBus support." ON "CMAKE_SYSTEM_NAME STREQUAL \"Linux\" AND BUILD_GUI" OFF)
|
cmake_dependent_option(WITH_DBUS "Enable DBus support." ON "CMAKE_SYSTEM_NAME STREQUAL \"Linux\" AND BUILD_GUI" OFF)
|
||||||
|
cmake_dependent_option(BUILD_GUI_TESTS "Build test_bitcoin-qt executable." ON "BUILD_GUI;BUILD_TESTS" OFF)
|
||||||
if(BUILD_GUI)
|
if(BUILD_GUI)
|
||||||
set(qt_components Core Gui Widgets LinguistTools)
|
set(qt_components Core Gui Widgets LinguistTools)
|
||||||
if(ENABLE_WALLET)
|
if(ENABLE_WALLET)
|
||||||
|
@ -161,6 +162,9 @@ if(BUILD_GUI)
|
||||||
list(APPEND qt_components DBus)
|
list(APPEND qt_components DBus)
|
||||||
set(USE_DBUS TRUE)
|
set(USE_DBUS TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
if(BUILD_GUI_TESTS)
|
||||||
|
list(APPEND qt_components Test)
|
||||||
|
endif()
|
||||||
find_package(Qt5 5.11.3 MODULE REQUIRED
|
find_package(Qt5 5.11.3 MODULE REQUIRED
|
||||||
COMPONENTS ${qt_components}
|
COMPONENTS ${qt_components}
|
||||||
)
|
)
|
||||||
|
@ -208,6 +212,7 @@ if(BUILD_FOR_FUZZING)
|
||||||
set(WITH_MINIUPNPC OFF)
|
set(WITH_MINIUPNPC OFF)
|
||||||
set(WITH_ZMQ OFF)
|
set(WITH_ZMQ OFF)
|
||||||
set(BUILD_TESTS OFF)
|
set(BUILD_TESTS OFF)
|
||||||
|
set(BUILD_GUI_TESTS OFF)
|
||||||
set(BUILD_BENCH OFF)
|
set(BUILD_BENCH OFF)
|
||||||
set(BUILD_FUZZ_BINARY ON)
|
set(BUILD_FUZZ_BINARY ON)
|
||||||
|
|
||||||
|
@ -506,6 +511,7 @@ message(" QR code (GUI) ....................... ${WITH_QRENCODE}")
|
||||||
message(" DBus (GUI, Linux only) .............. ${WITH_DBUS}")
|
message(" DBus (GUI, Linux only) .............. ${WITH_DBUS}")
|
||||||
message("Tests:")
|
message("Tests:")
|
||||||
message(" test_bitcoin ........................ ${BUILD_TESTS}")
|
message(" test_bitcoin ........................ ${BUILD_TESTS}")
|
||||||
|
message(" test_bitcoin-qt ..................... ${BUILD_GUI_TESTS}")
|
||||||
message(" bench_bitcoin ....................... ${BUILD_BENCH}")
|
message(" bench_bitcoin ....................... ${BUILD_BENCH}")
|
||||||
message(" fuzz binary ......................... ${BUILD_FUZZ_BINARY}")
|
message(" fuzz binary ......................... ${BUILD_FUZZ_BINARY}")
|
||||||
message("")
|
message("")
|
||||||
|
|
|
@ -243,6 +243,10 @@ if(WIN32)
|
||||||
set_target_properties(bitcoin-qt PROPERTIES WIN32_EXECUTABLE TRUE)
|
set_target_properties(bitcoin-qt PROPERTIES WIN32_EXECUTABLE TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_GUI_TESTS)
|
||||||
|
add_subdirectory(test)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Gets sources to be parsed to gather translatable strings.
|
# Gets sources to be parsed to gather translatable strings.
|
||||||
function(get_translatable_sources var)
|
function(get_translatable_sources var)
|
||||||
|
|
56
src/qt/test/CMakeLists.txt
Normal file
56
src/qt/test/CMakeLists.txt
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
# 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_executable(test_bitcoin-qt
|
||||||
|
apptests.cpp
|
||||||
|
optiontests.cpp
|
||||||
|
rpcnestedtests.cpp
|
||||||
|
test_main.cpp
|
||||||
|
uritests.cpp
|
||||||
|
util.cpp
|
||||||
|
../../init/bitcoin-qt.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(test_bitcoin-qt
|
||||||
|
core_interface
|
||||||
|
bitcoinqt
|
||||||
|
test_util
|
||||||
|
bitcoin_node
|
||||||
|
Boost::headers
|
||||||
|
Qt5::Test
|
||||||
|
)
|
||||||
|
|
||||||
|
import_plugins(test_bitcoin-qt)
|
||||||
|
|
||||||
|
if(ENABLE_WALLET)
|
||||||
|
target_sources(test_bitcoin-qt
|
||||||
|
PRIVATE
|
||||||
|
addressbooktests.cpp
|
||||||
|
wallettests.cpp
|
||||||
|
../../wallet/test/wallet_test_fixture.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT QT_IS_STATIC)
|
||||||
|
add_custom_command(
|
||||||
|
TARGET test_bitcoin-qt POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_PROPERTY:Qt5::QMinimalIntegrationPlugin,LOCATION_$<UPPER_CASE:$<CONFIG>>> $<TARGET_FILE_DIR:test_bitcoin-qt>/plugins/platforms
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_test(NAME test_bitcoin-qt
|
||||||
|
COMMAND test_bitcoin-qt
|
||||||
|
)
|
||||||
|
if(WIN32 AND VCPKG_TARGET_TRIPLET)
|
||||||
|
# On Windows, vcpkg configures Qt with `-opengl dynamic`, which makes
|
||||||
|
# the "minimal" platform plugin unusable due to internal Qt bugs.
|
||||||
|
set_tests_properties(test_bitcoin-qt PROPERTIES
|
||||||
|
ENVIRONMENT "QT_QPA_PLATFORM=windows"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install(TARGETS test_bitcoin-qt
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
)
|
Loading…
Add table
Reference in a new issue