Skip to content

Commit 5cd0be3

Browse files
Johnny Carlsonhebasto
authored and
Johnny Carlson
committed
qmltest: fix build and don't build when static linking
Co-authored-by: Hennadii Stepanov <[email protected]>
1 parent 9811c17 commit 5cd0be3

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

build-aux/m4/bitcoin_qt.m4

+5-4
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"
@@ -307,7 +307,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
307307
bitcoin_enable_qt_test=no
308308
fi
309309
bitcoin_enable_qml_test=yes
310-
if test "$have_qml_test" = "no"; then
310+
if test "$have_quick_test" = "no" || test "$bitcoin_cv_static_qt" = "yes"; then
311311
bitcoin_enable_qml_test=no
312312
fi
313313
bitcoin_enable_qt_dbus=no
@@ -338,6 +338,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
338338
AC_SUBST(QT_LDFLAGS)
339339
AC_SUBST(QT_DBUS_INCLUDES)
340340
AC_SUBST(QT_TEST_INCLUDES)
341+
AC_SUBST(QT_QMLTEST_INCLUDES)
341342
AC_SUBST(QT_SELECT, qt5)
342343
AC_SUBST(MOC_DEFS)
343344
])
@@ -428,7 +429,7 @@ dnl _BITCOIN_QT_FIND_LIBS
428429
dnl ---------------------
429430
dnl
430431
dnl Outputs: All necessary QT_* variables are set.
431-
dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no.
432+
dnl Outputs: have_qt_test, have_quick_test, and have_qt_dbus are set (if applicable) to yes|no.
432433
AC_DEFUN([_BITCOIN_QT_FIND_LIBS],[
433434
BITCOIN_QT_CHECK([
434435
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"],
@@ -472,7 +473,7 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS],[
472473
[BITCOIN_QT_FAIL([${qt_lib_prefix}QuickControls2${qt_lib_suffix} $qt_version not found])])
473474
])
474475
BITCOIN_QT_CHECK([
475-
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])
476+
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])
476477
])
477478
478479
AC_DEFINE([USE_QML], [1], [Define to 1 to use QML-based GUI])

ci/test/00_setup_env_mac_native_arm64.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export LC_ALL=C.UTF-8
99
export HOST=arm64-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

+2-1
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,7 @@ if test "$enable_fuzz" = "yes"; then
13181318
build_bitcoin_libs=no
13191319
bitcoin_enable_qt=no
13201320
bitcoin_enable_qt_test=no
1321+
bitcoin_enable_qml_test=no
13211322
bitcoin_enable_qt_dbus=no
13221323
use_bench=no
13231324
use_tests=no
@@ -1331,7 +1332,7 @@ if test "$enable_fuzz" = "yes"; then
13311332
else
13321333
BITCOIN_QT_INIT
13331334

1334-
dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus
1335+
dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qml_test, $bitcoin_enable_qt_dbus
13351336
BITCOIN_QT_CONFIGURE([5.11.3])
13361337

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

src/Makefile.qmltest.include

+6-7
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,27 @@ TEST_QML_MOC_CPP = qml/test/moc_setup.cpp
99

1010
TEST_QML_H = qml/test/setup.h qml/test/testimageprovider.h
1111

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

15-
qml_test_test_bitcoin_qt_SOURCES = \
15+
qml_test_test_bitcoin_qt_SOURCES = $(QML_QRC) \
1616
qml/test/setup.cpp \
17-
qml/bitcoin_qml.qrc \
1817
qml/test/testimageprovider.cpp \
1918
$(TEST_QML_H)
2019

2120
nodist_qml_test_test_bitcoin_qt_SOURCES = $(TEST_QML_MOC_CPP) $(QML_QRC_CPP)
2221

23-
qml_test_test_bitcoin_qt_LDADD = $(QT_QUICKTEST_LIBS) $(QT_LIBS)
22+
qml_test_test_bitcoin_qt_LDADD = $(QT_LIBS) $(QT_QUICKTEST_LIBS)
2423
qml_test_test_bitcoin_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS)
2524
qml_test_test_bitcoin_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
2625

2726
CLEAN_BITCOIN_QML_TEST = $(TEST_QML_MOC_CPP)
2827

2928
CLEANFILES += $(CLEAN_BITCOIN_QML_TEST)
3029

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

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

3635
test_bitcoin_qt_qml_clean: FORCE

src/qml/test/setup.cpp

+7
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)