Skip to content

Commit 9176f79

Browse files
Johnny Carlsonhebasto
authored andcommitted
qmltest: fix build and don't build when static linking
Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
1 parent e309568 commit 9176f79

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

build-aux/m4/bitcoin_qt.m4

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ dnl BITCOIN_QT_CONFIGURE([MINIMUM-VERSION])
108108
dnl
109109
dnl Outputs: See _BITCOIN_QT_FIND_LIBS
110110
dnl Outputs: Sets variables for all qt-related tools.
111-
dnl Outputs: bitcoin_enable_qt, bitcoin_enable_qt_dbus, bitcoin_enable_qt_test
111+
dnl Outputs: bitcoin_enable_qt, bitcoin_enable_qt_dbus, bitcoin_enable_qt_test, bitcoin_enable_qml_test
112112
AC_DEFUN([BITCOIN_QT_CONFIGURE],[
113113
qt_version=">= $1"
114114
qt_lib_prefix="Qt5"
@@ -321,7 +321,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
321321
bitcoin_enable_qt_test=no
322322
fi
323323
bitcoin_enable_qml_test=yes
324-
if test "$have_qml_test" = "no"; then
324+
if test "$have_quick_test" = "no" || test "$bitcoin_cv_static_qt" = "yes"; then
325325
bitcoin_enable_qml_test=no
326326
fi
327327
bitcoin_enable_qt_dbus=no
@@ -352,6 +352,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
352352
AC_SUBST(QT_LDFLAGS)
353353
AC_SUBST(QT_DBUS_INCLUDES)
354354
AC_SUBST(QT_TEST_INCLUDES)
355+
AC_SUBST(QT_QMLTEST_INCLUDES)
355356
AC_SUBST(QT_SELECT, qt5)
356357
AC_SUBST(MOC_DEFS)
357358
])
@@ -442,7 +443,7 @@ dnl _BITCOIN_QT_FIND_LIBS
442443
dnl ---------------------
443444
dnl
444445
dnl Outputs: All necessary QT_* variables are set.
445-
dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no.
446+
dnl Outputs: have_qt_test, have_quick_test, and have_qt_dbus are set (if applicable) to yes|no.
446447
AC_DEFUN([_BITCOIN_QT_FIND_LIBS],[
447448
BITCOIN_QT_CHECK([
448449
PKG_CHECK_MODULES([QT_CORE], [${qt_lib_prefix}Core${qt_lib_suffix} $qt_version], [QT_INCLUDES="$QT_CORE_CFLAGS $QT_INCLUDES" QT_LIBS="$QT_CORE_LIBS $QT_LIBS"],
@@ -486,7 +487,7 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS],[
486487
[BITCOIN_QT_FAIL([${qt_lib_prefix}QuickControls2${qt_lib_suffix} $qt_version not found])])
487488
])
488489
BITCOIN_QT_CHECK([
489-
PKG_CHECK_MODULES([QT_QUICKTEST], [${qt_lib_prefix}QuickTest${qt_lib_suffix} $qt_version], [QT_QMLTEST_INCLUDES="$QT_QUICKTEST_CFLAGS"; have_quick_test=yes],[have_quick_test=no])
490+
PKG_CHECK_MODULES([QT_QUICKTEST], [${qt_lib_prefix}QuickTest${qt_lib_suffix} $qt_version], [QT_QMLTEST_INCLUDES="$QT_QUICKTEST_CFLAGS"; have_quick_test=yes], [have_quick_test=no])
490491
])
491492
492493
AC_DEFINE([USE_QML], [1], [Define to 1 to use QML-based GUI])

ci/test/00_setup_env_mac_native.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export LC_ALL=C.UTF-8
99
export HOST=x86_64-apple-darwin
1010
export PIP_PACKAGES="zmq"
1111
export GOAL="install"
12-
export BITCOIN_CONFIG="--with-gui --with-miniupnpc --with-natpmp --enable-reduce-exports"
12+
export BITCOIN_CONFIG="--with-gui --with-miniupnpc --with-natpmp --enable-reduce-exports CXXFLAGS=-Wno-shadow-field"
1313
export CI_OS_NAME="macos"
1414
export NO_DEPENDS=1
1515
export OSX_SDK=""

configure.ac

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,7 @@ if test "$enable_fuzz" = "yes"; then
13141314
build_bitcoin_libs=no
13151315
bitcoin_enable_qt=no
13161316
bitcoin_enable_qt_test=no
1317+
bitcoin_enable_qml_test=no
13171318
bitcoin_enable_qt_dbus=no
13181319
use_bench=no
13191320
use_tests=no
@@ -1327,7 +1328,7 @@ if test "$enable_fuzz" = "yes"; then
13271328
else
13281329
BITCOIN_QT_INIT
13291330

1330-
dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus
1331+
dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qml_test, $bitcoin_enable_qt_dbus
13311332
BITCOIN_QT_CONFIGURE([5.11.3])
13321333

13331334
dnl Keep a copy of the original $QT_INCLUDES and use it when invoking qt's moc

src/Makefile.qmltest.include

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ TEST_QML_MOC_CPP = qml/test/moc_setup.cpp
1010
TEST_QML_H = qml/test/setup.h qml/test/testimageprovider.h
1111

1212
qml_test_test_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) \
13-
$(QT_INCLUDES) $(QT_QUICKTEST_INCLUDES) $(BOOST_CPPFLAGS) $(QT_QUICKTEST_CFLAGS)
13+
$(QT_INCLUDES) $(QT_QMLTEST_INCLUDES) $(BOOST_CPPFLAGS)
1414

1515
qml_test_test_bitcoin_qt_SOURCES = \
16-
qml/test/setup.cpp \
1716
qml/bitcoin_qml.qrc \
17+
qml/test/setup.cpp \
1818
qml/test/testimageprovider.cpp \
1919
$(TEST_QML_H)
2020

2121
nodist_qml_test_test_bitcoin_qt_SOURCES = $(TEST_QML_MOC_CPP) $(QML_QRC_CPP)
2222

23-
qml_test_test_bitcoin_qt_LDADD = $(QT_QUICKTEST_LIBS) $(QT_LIBS)
23+
qml_test_test_bitcoin_qt_LDADD = $(QT_LIBS) $(QT_QUICKTEST_LIBS)
2424
qml_test_test_bitcoin_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS)
2525
qml_test_test_bitcoin_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
2626

2727
CLEAN_BITCOIN_QML_TEST = $(TEST_QML_MOC_CPP)
2828

2929
CLEANFILES += $(CLEAN_BITCOIN_QML_TEST)
3030

31-
test_bitcoin_qt_qml : qml/test/test_bitcoin-qt-qml$(EXEEXT)
31+
test_bitcoin_qt_qml: qml/test/test_bitcoin-qt$(EXEEXT)
3232

33-
test_bitcoin_qt_qml_check : qt/test/test_bitcoin-qt-qml$(EXEEXT) FORCE
33+
test_bitcoin_qt_qml_check: qml/test/test_bitcoin-qt$(EXEEXT) FORCE
3434
$(MAKE) check-TESTS TESTS=$^
3535

3636
test_bitcoin_qt_qml_clean: FORCE

src/qml/test/setup.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
// Copyright (c) 2023 The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
45
#include <qml/test/setup.h>
56

7+
#if defined(HAVE_CONFIG_H)
8+
#include <config/bitcoin-config.h>
9+
#endif
10+
611
#include <QtQuickTest>
12+
#include <QtTest>
13+
#include <QtTest/qtestcase.h>
714
#include <QQmlEngine>
815
#include <QQmlContext>
916
#include <qml/test/testimageprovider.h>

0 commit comments

Comments
 (0)