summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@pelagicore.com>2019-07-05 18:27:49 +0200
committerRobert Griebl <robert.griebl@pelagicore.com>2019-08-01 12:39:06 +0200
commita31642125c01e8bf4bfd48e14b40952506da46bb (patch)
treee73291324b9e16deed912990a80dca6e06d6415d
parent9f07efec1cf09c629e7fc04417e6a5ccca2687bc (diff)
Fix headless compilation
(backported from 5.13) Change-Id: I4eb3fae767066dcfb64f3f6fc126680768a10ecc Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
-rw-r--r--application-manager.pro8
-rw-r--r--examples/applicationmanager/applicationmanager.pro4
-rw-r--r--qmake-features/am-config.prf4
-rw-r--r--src/main-lib/main.cpp6
-rw-r--r--src/manager-lib/qmlinprocessruntime.h2
-rw-r--r--src/manager-lib/systemreader.cpp2
-rw-r--r--src/monitor-lib/frametimer.h4
-rw-r--r--src/monitor-lib/gpustatus.h3
-rw-r--r--src/monitor-lib/monitor-lib.pro13
-rw-r--r--src/shared-main-lib/sharedmain.cpp11
-rw-r--r--src/src.pro4
-rw-r--r--src/tools/launcher-qml/launcher-qml.cpp10
-rw-r--r--src/tools/testrunner/testrunner.pro2
-rw-r--r--tests/qml/qml.pro4
14 files changed, 63 insertions, 14 deletions
diff --git a/application-manager.pro b/application-manager.pro
index 38694938..62771a35 100644
--- a/application-manager.pro
+++ b/application-manager.pro
@@ -22,10 +22,12 @@ else:contains(QT_BUILD_PARTS, "examples"):CONFIG += enable-examples
load(configure)
qtCompileTest(libarchive)
qtCompileTest(libyaml)
- !headless:qtCompileTest(touchemulation)
+ !headless:qtHaveModule(gui):qtCompileTest(touchemulation)
}
-qtHaveModule(waylandcompositor):CONFIG += am_compatible_compositor
+qtHaveModule(waylandcompositor):qtHaveModule(quick):qtConfig(opengl):CONFIG += am_compatible_compositor
+
+load(am-config)
force-single-process:force-multi-process:error("You cannot both specify force-single-process and force-multi-process")
force-multi-process:!headless:!am_compatible_compositor:error("You forced multi-process mode, but the QtCompositor module is not available")
@@ -34,8 +36,6 @@ if(linux|force-libcrypto) {
!if(contains(QT_CONFIG,"openssl")|contains(QT_CONFIG,"openssl-linked")|contains(QT_CONFIG,"ssl")):error("Qt was built without OpenSSL support.")
}
-load(am-config)
-
!config_libyaml|no-system-libyaml {
force-system-libyaml:error("Could not find a system installation for libyaml.")
else:SUBDIRS += 3rdparty/libyaml/libyaml.pro
diff --git a/examples/applicationmanager/applicationmanager.pro b/examples/applicationmanager/applicationmanager.pro
index 8231c457..49cc2c82 100644
--- a/examples/applicationmanager/applicationmanager.pro
+++ b/examples/applicationmanager/applicationmanager.pro
@@ -1,3 +1,7 @@
+load(am-config)
+
+requires(!headless)
+
TEMPLATE = subdirs
SUBDIRS = \
diff --git a/qmake-features/am-config.prf b/qmake-features/am-config.prf
index 3ddfe8b2..d115eb63 100644
--- a/qmake-features/am-config.prf
+++ b/qmake-features/am-config.prf
@@ -5,6 +5,10 @@ CONFIG *= no_private_qt_headers_warning hide_symbols
CONFIG -= app_bundle qml_debug
CONFIG += exceptions
+!qtHaveModule(gui)|!qtHaveModule(quick)|!qtConfig(opengl) {
+ CONFIG *= headless
+}
+
DEFINES += QT_MESSAGELOGCONTEXT
win32-msvc*:QMAKE_CXXFLAGS += /FS /wd4290 /DNOMINMAX /D_CRT_SECURE_NO_WARNINGS
diff --git a/src/main-lib/main.cpp b/src/main-lib/main.cpp
index 11a85d83..8a4c9788 100644
--- a/src/main-lib/main.cpp
+++ b/src/main-lib/main.cpp
@@ -627,8 +627,10 @@ void Main::setupQmlEngine(const QStringList &importPaths, const QString &quickCo
// monitor-lib
qmlRegisterType<CpuStatus>("QtApplicationManager", 2, 0, "CpuStatus");
+#if !defined(AM_HEADLESS)
qmlRegisterType<FrameTimer>("QtApplicationManager", 2, 0, "FrameTimer");
qmlRegisterType<GpuStatus>("QtApplicationManager", 2, 0, "GpuStatus");
+#endif
qmlRegisterType<IoStatus>("QtApplicationManager", 2, 0, "IoStatus");
qmlRegisterType<MemoryStatus>("QtApplicationManager", 2, 0, "MemoryStatus");
qmlRegisterType<MonitorModel>("QtApplicationManager", 2, 0, "MonitorModel");
@@ -694,6 +696,9 @@ void Main::setupWindowManager(const QString &waylandSocketName, bool slowAnimati
void Main::setupTouchEmulation(bool enableTouchEmulation)
{
+#if defined(AM_HEADLESS)
+ Q_UNUSED(enableTouchEmulation)
+#else
if (enableTouchEmulation) {
if (TouchEmulation::isSupported()) {
TouchEmulation::createInstance();
@@ -704,6 +709,7 @@ void Main::setupTouchEmulation(bool enableTouchEmulation)
"build time or the platform does not support it.";
}
}
+#endif
}
void Main::loadQml(bool loadDummyData) Q_DECL_NOEXCEPT_EXPR(false)
diff --git a/src/manager-lib/qmlinprocessruntime.h b/src/manager-lib/qmlinprocessruntime.h
index 8c0281dc..f2d57eb6 100644
--- a/src/manager-lib/qmlinprocessruntime.h
+++ b/src/manager-lib/qmlinprocessruntime.h
@@ -82,7 +82,9 @@ public:
public slots:
bool start() override;
void stop(bool forceKill = false) override;
+#if !defined(AM_HEADLESS)
void stopIfNoVisibleSurfaces();
+#endif
signals:
void aboutToStop(); // used for the ApplicationInterface
diff --git a/src/manager-lib/systemreader.cpp b/src/manager-lib/systemreader.cpp
index cab1fa56..efd3fb94 100644
--- a/src/manager-lib/systemreader.cpp
+++ b/src/manager-lib/systemreader.cpp
@@ -71,11 +71,11 @@ QT_END_NAMESPACE_AM
# include <QSocketNotifier>
# include <QProcess>
# include <QCoreApplication>
+# include <QAtomicInteger>
# if !defined(AM_HEADLESS)
# include <QOffscreenSurface>
# include <QOpenGLContext>
# include <QOpenGLFunctions>
-# include <QAtomicInteger>
# endif
# include <sys/eventfd.h>
diff --git a/src/monitor-lib/frametimer.h b/src/monitor-lib/frametimer.h
index 65d1cee1..fe0ce2d3 100644
--- a/src/monitor-lib/frametimer.h
+++ b/src/monitor-lib/frametimer.h
@@ -42,6 +42,8 @@
#pragma once
+#if !defined(AM_HEADLESS)
+
#include <QElapsedTimer>
#include <QObject>
#include <QPointer>
@@ -135,3 +137,5 @@ private:
};
QT_END_NAMESPACE_AM
+
+#endif // !AM_HEADLESS
diff --git a/src/monitor-lib/gpustatus.h b/src/monitor-lib/gpustatus.h
index 16f95077..9f44ba82 100644
--- a/src/monitor-lib/gpustatus.h
+++ b/src/monitor-lib/gpustatus.h
@@ -42,6 +42,8 @@
#pragma once
+#if !defined(AM_HEADLESS)
+
#include <QtAppManCommon/global.h>
#include <QtAppManManager/systemreader.h>
@@ -78,3 +80,4 @@ private:
QT_END_NAMESPACE_AM
+#endif // !AM_HEADLESS
diff --git a/src/monitor-lib/monitor-lib.pro b/src/monitor-lib/monitor-lib.pro
index 792c85de..dc55c715 100644
--- a/src/monitor-lib/monitor-lib.pro
+++ b/src/monitor-lib/monitor-lib.pro
@@ -16,8 +16,6 @@ CONFIG *= static internal_module
HEADERS += \
cpustatus.h \
- frametimer.h \
- gpustatus.h \
iostatus.h \
memorystatus.h \
monitormodel.h \
@@ -26,12 +24,19 @@ HEADERS += \
SOURCES += \
cpustatus.cpp \
- frametimer.cpp \
- gpustatus.cpp \
iostatus.cpp \
memorystatus.cpp \
monitormodel.cpp \
processreader.cpp \
processstatus.cpp \
+!headless:HEADERS += \
+ frametimer.h \
+ gpustatus.h \
+
+!headless:SOURCES += \
+ frametimer.cpp \
+ gpustatus.cpp \
+
+
load(qt_module)
diff --git a/src/shared-main-lib/sharedmain.cpp b/src/shared-main-lib/sharedmain.cpp
index 6e63e69b..6780efe5 100644
--- a/src/shared-main-lib/sharedmain.cpp
+++ b/src/shared-main-lib/sharedmain.cpp
@@ -49,7 +49,6 @@
#include <QVariant>
#include <QFileInfo>
#include <QLibrary>
-#include <QIcon>
#include <QStandardPaths>
#include <QQmlDebuggingEnabler>
#include <QQmlComponent>
@@ -59,6 +58,7 @@
#if !defined(AM_HEADLESS)
# include <QGuiApplication>
+# include <QIcon>
# include <private/qopenglcontext_p.h>
#endif
@@ -123,8 +123,13 @@ int &SharedMain::preConstructor(int &argc)
void SharedMain::setupIconTheme(const QStringList &themeSearchPaths, const QString &themeName)
{
+#if defined(AM_HEADLESS)
+ Q_UNUSED(themeSearchPaths)
+ Q_UNUSED(themeName)
+#else
QIcon::setThemeSearchPaths(themeSearchPaths);
QIcon::setThemeName(themeName);
+#endif
}
void SharedMain::setupQmlDebugging(bool qmlDebugging)
@@ -156,7 +161,9 @@ void SharedMain::setupLoggingRules(bool verbose, const QStringList &loggingRules
void SharedMain::setupOpenGL(const QVariantMap &openGLConfiguration)
{
-#if !defined(AM_HEADLESS)
+#if defined(AM_HEADLESS)
+ Q_UNUSED(openGLConfiguration)
+#else
QString profileName = openGLConfiguration.value(qSL("desktopProfile")).toString();
int majorVersion = openGLConfiguration.value(qSL("esMajorVersion"), -1).toInt();
int minorVersion = openGLConfiguration.value(qSL("esMinorVersion"), -1).toInt();
diff --git a/src/src.pro b/src/src.pro
index 480a19ab..9b51de64 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -104,7 +104,9 @@ SUBDIRS = \
qtHaveModule(qml):qtHaveModule(dbus):SUBDIRS += \
launcher_lib \
- # This tool links against everything to extract the Qml type information
+
+ # This tool links against everything to extract the Qml type information
+ qtHaveModule(qml):qtHaveModule(dbus):!headless:SUBDIRS += \
tools_dumpqmltypes \
multi-process:qtHaveModule(qml):qtHaveModule(dbus):SUBDIRS += \
diff --git a/src/tools/launcher-qml/launcher-qml.cpp b/src/tools/launcher-qml/launcher-qml.cpp
index f5fcfbd0..ccaa78da 100644
--- a/src/tools/launcher-qml/launcher-qml.cpp
+++ b/src/tools/launcher-qml/launcher-qml.cpp
@@ -94,8 +94,10 @@
// monitor-lib
#include "cpustatus.h"
-#include "frametimer.h"
-#include "gpustatus.h"
+#if !defined(AM_HEADLESS)
+# include "frametimer.h"
+# include "gpustatus.h"
+#endif
#include "iostatus.h"
#include "memorystatus.h"
#include "monitormodel.h"
@@ -185,8 +187,10 @@ Controller::Controller(LauncherMain *a, bool quickLaunched, const QString &direc
// monitor-lib
qmlRegisterType<CpuStatus>("QtApplicationManager", 2, 0, "CpuStatus");
+#if !defined(AM_HEADLESS)
qmlRegisterType<FrameTimer>("QtApplicationManager", 2, 0, "FrameTimer");
qmlRegisterType<GpuStatus>("QtApplicationManager", 2, 0, "GpuStatus");
+#endif
qmlRegisterType<IoStatus>("QtApplicationManager", 2, 0, "IoStatus");
qmlRegisterType<MemoryStatus>("QtApplicationManager", 2, 0, "MemoryStatus");
qmlRegisterType<MonitorModel>("QtApplicationManager", 2, 0, "MonitorModel");
@@ -361,6 +365,7 @@ void Controller::startApplication(const QString &baseDir, const QString &qmlFile
LauncherMain::instance(), &LauncherMain::setSlowAnimations);
}
+#if !defined(AM_HEADLESS)
// Going through the LauncherMain instance here is a bit weird, and should be refactored
// sometime. Having the flag there makes sense though, because this class can also be used for
// custom launchers.
@@ -371,6 +376,7 @@ void Controller::startApplication(const QString &baseDir, const QString &qmlFile
// we need to catch all show events to apply the slow-animations
QCoreApplication::instance()->installEventFilter(this);
+#endif
QStringList startupPluginFiles = variantToStringList(m_configuration.value(qSL("plugins")).toMap().value(qSL("startup")));
auto startupPlugins = loadPlugins<StartupInterface>("startup", startupPluginFiles);
diff --git a/src/tools/testrunner/testrunner.pro b/src/tools/testrunner/testrunner.pro
index aa4817bd..c097dba8 100644
--- a/src/tools/testrunner/testrunner.pro
+++ b/src/tools/testrunner/testrunner.pro
@@ -1,5 +1,7 @@
include(../appman/appman.pro)
+requires(!headless)
+
TARGET = appman-qmltestrunner
DEFINES += AM_TESTRUNNER
diff --git a/tests/qml/qml.pro b/tests/qml/qml.pro
index 78ac75a5..ad01fcb8 100644
--- a/tests/qml/qml.pro
+++ b/tests/qml/qml.pro
@@ -1,3 +1,7 @@
+load(am-config)
+
+requires(!headless)
+
TEMPLATE = subdirs
SUBDIRS = \
simple \