summaryrefslogtreecommitdiff
path: root/src/common-lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/common-lib')
-rw-r--r--src/common-lib/CMakeLists.txt77
-rw-r--r--src/common-lib/common-lib.pro6
-rw-r--r--src/common-lib/configure.cmake74
-rw-r--r--src/common-lib/crashhandler.cpp9
-rw-r--r--src/common-lib/global.h3
-rw-r--r--src/common-lib/qt_cmdline.cmake8
6 files changed, 170 insertions, 7 deletions
diff --git a/src/common-lib/CMakeLists.txt b/src/common-lib/CMakeLists.txt
new file mode 100644
index 00000000..75d795d5
--- /dev/null
+++ b/src/common-lib/CMakeLists.txt
@@ -0,0 +1,77 @@
+# Generated from common-lib.pro.
+
+#####################################################################
+## AppManCommon Module:
+#####################################################################
+
+qt_find_package(WrapLibYaml PROVIDED_TARGETS WrapLibYaml::WrapLibYaml)
+
+# temporary hack to get around the "#pragma once not allowed in cpp" error
+set(QT_FEATURE_headersclean FALSE)
+
+qt_internal_add_module(AppManCommonPrivate
+ CONFIG_MODULE_NAME appman_common
+ STATIC
+ EXCEPTIONS
+ INTERNAL_MODULE
+ SOURCES
+ configcache.cpp configcache.h configcache_p.h
+ crashhandler.cpp crashhandler.h
+ dbus-utilities.cpp
+ error.h
+ exception.cpp exception.h
+ global.h
+ logging.cpp logging.h
+ processtitle.cpp processtitle.h
+ qml-utilities.cpp qml-utilities.h
+ qtyaml.cpp qtyaml.h
+ startuptimer.cpp startuptimer.h
+ unixsignalhandler.cpp unixsignalhandler.h
+ utilities.cpp utilities.h
+ PUBLIC_LIBRARIES
+ Qt::Concurrent
+ Qt::Core
+ Qt::CorePrivate
+ Qt::Network
+ Qt::Qml
+ Qt::QmlPrivate
+)
+
+qt_internal_extend_target(AppManCommonPrivate CONDITION TARGET Qt::GeniviExtras
+ DEFINES
+ AM_GENIVIEXTRAS_LAZY_INIT
+ PUBLIC_LIBRARIES
+ Qt::GeniviExtras
+)
+
+qt_internal_extend_target(AppManCommonPrivate CONDITION TARGET Qt::DBus
+ SOURCES
+ dbus-utilities.h
+ PUBLIC_LIBRARIES
+ Qt::DBus
+)
+
+qt_internal_extend_target(AppManCommonPrivate CONDITION LINUX
+ PUBLIC_LIBRARIES
+ dl
+)
+
+qt_internal_extend_target(AppManCommonPrivate CONDITION QT_FEATURE_libbacktrace
+ LIBRARIES
+ Qt::BundledBacktrace
+)
+
+qt_internal_extend_target(AppManCommonPrivate CONDITION QT_FEATURE_stackwalker
+ LIBRARIES
+ Qt::BundledStackwalker
+)
+
+qt_internal_extend_target(AppManCommonPrivate CONDITION QT_FEATURE_system_libyaml
+ LIBRARIES
+ WrapLibYaml::WrapLibYaml
+)
+
+qt_internal_extend_target(AppManCommonPrivate CONDITION NOT QT_FEATURE_system_libyaml
+ LIBRARIES
+ Qt::BundledLibYaml
+)
diff --git a/src/common-lib/common-lib.pro b/src/common-lib/common-lib.pro
index 4b1ffda6..d9efdd85 100644
--- a/src/common-lib/common-lib.pro
+++ b/src/common-lib/common-lib.pro
@@ -11,14 +11,12 @@ qtHaveModule(qml):QT *= qml qml-private
linux:LIBS += -ldl
-versionAtLeast(QT.geniviextras.VERSION, 1.1.0) {
- DEFINES += AM_GENIVIEXTRAS_LAZY_INIT
-}
+qtHaveModule(geniviextras):DEFINES *= AM_GENIVIEXTRAS_LAZY_INIT
CONFIG *= static internal_module
CONFIG -= create_cmake
-include($$SOURCE_DIR/3rdparty/libyaml.pri)
+include($$PWD/../../3rdparty/libyaml.pri)
contains(DEFINES, "AM_USE_LIBBACKTRACE"):include($$SOURCE_DIR/3rdparty/libbacktrace.pri)
contains(DEFINES, "AM_USE_STACKWALKER"):include($$SOURCE_DIR/3rdparty/stackwalker.pri)
diff --git a/src/common-lib/configure.cmake b/src/common-lib/configure.cmake
new file mode 100644
index 00000000..e20cf5f0
--- /dev/null
+++ b/src/common-lib/configure.cmake
@@ -0,0 +1,74 @@
+#### Inputs
+
+set(INPUT_libyaml "undefined" CACHE STRING "")
+set_property(CACHE INPUT_libyaml PROPERTY STRINGS undefined qt system)
+
+
+#### Libraries
+
+qt_find_package(WrapLibYaml PROVIDED_TARGETS WrapLibYaml::WrapLibYaml MODULE_NAME appman_common QMAKE_LIB yaml)
+
+
+#### Tests
+
+
+#### Features
+
+qt_feature("system-libyaml" PRIVATE
+ LABEL "Using system libyaml"
+ CONDITION WrapLibYaml_FOUND
+ ENABLE INPUT_libyaml STREQUAL 'system'
+ DISABLE INPUT_libyaml STREQUAL 'qt'
+)
+
+qt_feature("multi-process" PUBLIC
+ LABEL "Multi-process mode"
+ CONDITION TARGET Qt::DBus AND TARGET Qt::WaylandCompositor AND LINUX
+ ENABLE INPUT_force_mode STREQUAL 'multi'
+ DISABLE INPUT_force_mode STREQUAL 'single'
+)
+qt_feature_definition("multi-process" "AM_MULTI_PROCESS")
+
+qt_feature("installer" PRIVATE
+ LABEL "Enable the installer component"
+ CONDITION QT_FEATURE_ssl
+ DISABLE INPUT_installer STREQUAL 'no'
+)
+qt_feature_definition("installer" "AM_DISABLE_INSTALLER" NEGATE)
+
+qt_feature("external-dbus-interfaces" PRIVATE
+ LABEL "Enable external DBus interfaces"
+ CONDITION NOT INPUT_external_dbus_interfaces STREQUAL 'no' AND TARGET Qt::DBus
+)
+qt_feature_definition("external-dbus-interfaces" "AM_DISABLE_EXTERNAL_DBUS_INTERFACES" NEGATE)
+
+qt_feature("tools-only" PRIVATE
+ LABEL "Tools only build"
+ CONDITION INPUT_tools_only STREQUAL 'yes'
+)
+
+qt_feature("libbacktrace" PRIVATE
+ LABEL "Enable support for libbacktrace"
+ CONDITION LINUX AND ( ( INPUT_libbacktrace STREQUAL 'yes' ) OR ( ( CMAKE_BUILD_TYPE STREQUAL "Debug" ) AND ( NOT INPUT_libbacktrace STREQUAL 'no' ) ) )
+ EMIT_IF LINUX
+)
+qt_feature_definition("libbacktrace" "AM_USE_LIBBACKTRACE")
+
+qt_feature("stackwalker" PRIVATE
+ LABEL "Enable support for StackWalker"
+ CONDITION WIN32 AND ( ( INPUT_stackwalker STREQUAL 'yes' ) OR ( ( CMAKE_BUILD_TYPE STREQUAL "Debug") AND (NOT INPUT_stackwalker STREQUAL 'no' ) ) )
+ EMIT_IF WIN32
+)
+qt_feature_definition("stackwalker" "AM_USE_STACKWALKER")
+
+qt_configure_add_summary_section(NAME "Qt Application Manager")
+qt_configure_add_summary_entry(ARGS "system-libyaml")
+qt_configure_add_summary_entry(ARGS "multi-process")
+qt_configure_add_summary_entry(ARGS "installer")
+qt_configure_add_summary_entry(ARGS "external-dbus-interfaces")
+qt_configure_add_summary_entry(ARGS "tools-only")
+qt_configure_add_summary_entry(ARGS "libbacktrace")
+qt_configure_add_summary_entry(ARGS "stackwalker")
+qt_configure_end_summary_section() # end of "Qt ApplicationManger" section
+
+qt_extra_definition("AM_VERSION" "\"${PROJECT_VERSION}\"" PUBLIC)
diff --git a/src/common-lib/crashhandler.cpp b/src/common-lib/crashhandler.cpp
index 128616c8..bde599fb 100644
--- a/src/common-lib/crashhandler.cpp
+++ b/src/common-lib/crashhandler.cpp
@@ -30,6 +30,7 @@
****************************************************************************/
#include <inttypes.h>
+#include <typeinfo>
#if defined(QT_QML_LIB)
# include <QPointer>
@@ -57,6 +58,9 @@
# define STDERR_FILENO _fileno(stderr)
# endif
# define write(a, b, c) _write(a, b, static_cast<unsigned int>(c))
+# if defined(Q_CC_MINGW)
+# include <cxxabi.h>
+# endif
#endif
QT_BEGIN_NAMESPACE_AM
@@ -117,7 +121,6 @@ static struct InitBacktrace
# pragma warning(pop)
# elif defined(Q_OS_WINDOWS) && defined(Q_CC_MINGW)
-# include <cxxabi.h>
// this will make it run before all other static constructor functions
static void initBacktrace() __attribute__((constructor(101)));
@@ -656,7 +659,9 @@ static void logCrashInfo(LogToDestination logTo, const char *why, int stackFrame
// SDK used to compile this code
typedef HRESULT(WINAPI* GetThreadDescriptionType)(HANDLE hThread, PWSTR *description);
if (auto GetThreadDescriptionFunc = reinterpret_cast<GetThreadDescriptionType>(
- GetProcAddress(::GetModuleHandle(L"kernel32.dll"), "GetThreadDescription"))) {
+ reinterpret_cast<QFunctionPointer>(
+ GetProcAddress(::GetModuleHandle(L"kernel32.dll"),
+ "GetThreadDescription")))) {
WCHAR *desc = nullptr;
if (SUCCEEDED(GetThreadDescriptionFunc(GetCurrentThread(), &desc)))
wcscpy_s(threadName, sizeof(threadName) / sizeof(*threadName), desc);
diff --git a/src/common-lib/global.h b/src/common-lib/global.h
index 62ff6989..8b5afe29 100644
--- a/src/common-lib/global.h
+++ b/src/common-lib/global.h
@@ -30,7 +30,8 @@
****************************************************************************/
#pragma once
-#include <qglobal.h>
+#include <QtCore/qglobal.h>
+#include <QtAppManCommon/qtappman_common-config.h>
#define QT_BEGIN_NAMESPACE_AM namespace QtAM {
#define QT_END_NAMESPACE_AM }
diff --git a/src/common-lib/qt_cmdline.cmake b/src/common-lib/qt_cmdline.cmake
new file mode 100644
index 00000000..f3641516
--- /dev/null
+++ b/src/common-lib/qt_cmdline.cmake
@@ -0,0 +1,8 @@
+qt_commandline_option(force-single-process TYPE enum NAME force_mode VALUE single)
+qt_commandline_option(force-multi-process TYPE enum NAME force_mode VALUE multi)
+qt_commandline_option(installer TYPE boolean)
+qt_commandline_option(external-dbus-interfaces TYPE boolean)
+qt_commandline_option(tools-only TYPE boolean)
+qt_commandline_option(libbacktrace TYPE boolean)
+qt_commandline_option(stackwalker TYPE boolean)
+qt_commandline_option(libyaml TYPE enum VALUES qt system)