From 082b543ec3aa699ee76093d204a17defd5ff87c3 Mon Sep 17 00:00:00 2001 From: Johnny Carlson Date: Thu, 12 Jan 2023 20:48:18 -0500 Subject: [PATCH] qmltest: configure to only compile with qml and tests enabled --- build-aux/m4/bitcoin_qt.m4 | 7 +++++-- configure.ac | 12 +++++++++++- src/Makefile.am | 5 ++++- src/Makefile.qmltest.include | 4 ++-- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 index 2851007a4e..d803a38df2 100644 --- a/build-aux/m4/bitcoin_qt.m4 +++ b/build-aux/m4/bitcoin_qt.m4 @@ -306,6 +306,10 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ if test "$have_qt_test" = "no"; then bitcoin_enable_qt_test=no fi + bitcoin_enable_qml_test=yes + if test "$have_qml_test" = "no"; then + bitcoin_enable_qml_test=no + fi bitcoin_enable_qt_dbus=no if test "$use_dbus" != "no" && test "$have_qt_dbus" = "yes"; then bitcoin_enable_qt_dbus=yes @@ -468,8 +472,7 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS],[ [BITCOIN_QT_FAIL([${qt_lib_prefix}QuickControls2${qt_lib_suffix} $qt_version not found])]) ]) BITCOIN_QT_CHECK([ - PKG_CHECK_MODULES([QT_QUICKTEST], [${qt_lib_prefix}QuickTest${qt_lib_suffix} $qt_version], [QT_INCLUDES="$QT_QUICKTEST_CFLAGS $QT_INCLUDES" QT_LIBS="$QT_QUICKTEST_LIBS $QT_LIBS"], - [BITCOIN_QT_FAIL([${qt_lib_prefix}QuickTest${qt_lib_suffix} $qt_version not found])]) + 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]) ]) AC_DEFINE([USE_QML], [1], [Define to 1 to use QML-based GUI]) diff --git a/configure.ac b/configure.ac index ca9e856425..d7910eae56 100644 --- a/configure.ac +++ b/configure.ac @@ -1812,8 +1812,9 @@ fi dnl these are only used when qt is enabled BUILD_TEST_QT="" +BUILD_TEST_QML="" if test "$use_qml" != "no"; then - use_gui_tests=no + bitcoin_enable_qt_test=no fi if test "$bitcoin_enable_qt" != "no"; then dnl enable dbus support @@ -1849,6 +1850,14 @@ if test "$bitcoin_enable_qt" != "no"; then else AC_MSG_RESULT([no]) fi + + AC_MSG_CHECKING([whether to build qml/test_bitcoin-qt]) + if test "$use_gui_tests$bitcoin_enable_qml_test" = "yesyes"; then + AC_MSG_RESULT([yes]) + BUILD_TEST_QML="yes" + else + AC_MSG_RESULT([no]) + fi fi AM_CONDITIONAL([ENABLE_ZMQ], [test "$use_zmq" = "yes"]) @@ -1889,6 +1898,7 @@ AM_CONDITIONAL([ENABLE_FUZZ], [test "$enable_fuzz" = "yes"]) AM_CONDITIONAL([ENABLE_FUZZ_BINARY], [test "$enable_fuzz_binary" = "yes"]) AM_CONDITIONAL([ENABLE_QT], [test "$bitcoin_enable_qt" = "yes"]) AM_CONDITIONAL([ENABLE_QT_TESTS], [test "$BUILD_TEST_QT" = "yes"]) +AM_CONDITIONAL([ENABLE_QML_TESTS], [test "$BUILD_TEST_QML" = "yes"]) AM_CONDITIONAL([ENABLE_BENCH], [test "$use_bench" = "yes"]) AM_CONDITIONAL([USE_QRCODE], [test "$use_qr" = "yes"]) AM_CONDITIONAL([USE_LCOV], [test "$use_lcov" = "yes"]) diff --git a/src/Makefile.am b/src/Makefile.am index 2db9b646d5..39bbccc8fb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1104,11 +1104,14 @@ endif if ENABLE_QT include Makefile.qt.include -include Makefile.qmltest.include endif if ENABLE_QT_TESTS include Makefile.qttest.include endif +if ENABLE_QML_TESTS +include Makefile.qmltest.include +endif + include Makefile.univalue.include diff --git a/src/Makefile.qmltest.include b/src/Makefile.qmltest.include index d8fe413017..c6d53cc119 100644 --- a/src/Makefile.qmltest.include +++ b/src/Makefile.qmltest.include @@ -10,7 +10,7 @@ TEST_QML_MOC_CPP = qml/test/moc_onboardingtests.cpp TEST_QML_H = qml/test/onboardingtests.h qml/test/imageprovider.h qml_test_test_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ - $(QT_INCLUDES) $(QT_TEST_INCLUDES) $(QT_QUICKTEST_INCLUDES) $(BOOST_CPPFLAGS) + $(QT_INCLUDES) $(QT_TEST_INCLUDES) $(QT_QUICKTEST_INCLUDES) $(BOOST_CPPFLAGS) $(QT_QUICKTEST_CFLAGS) qml_test_test_bitcoin_qt_SOURCES = \ qml/test/onboardingtests.cpp \ @@ -24,7 +24,7 @@ qml_test_test_bitcoin_qt_LDADD = $(QT_QUICKTEST_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) qml_test_test_bitcoin_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) qml_test_test_bitcoin_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) -CLEAN_BITCOIN_QML_TEST = $(TEST_QML_MOC_CPP) qml/test/*.gcda qml/test/*.gcno +CLEAN_BITCOIN_QML_TEST = $(TEST_QML_MOC_CPP) CLEANFILES += $(CLEAN_BITCOIN_QML_TEST)