aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2022-12-15 20:27:55 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2022-12-15 20:27:55 +0100
commit59f1574888865b4f0d0b14af76817a7c5fc5d111 (patch)
tree9b165708018df6286637774fec71f789080fbf0a
parent796525b933045a6477f57a60aff394cdd5f62a32 (diff)
parent260817c0b15a1bf209ffd3c5d0b84c93eadd47ae (diff)
downloadayatana-indicator-display-59f1574888865b4f0d0b14af76817a7c5fc5d111.tar.gz
ayatana-indicator-display-59f1574888865b4f0d0b14af76817a7c5fc5d111.tar.bz2
ayatana-indicator-display-59f1574888865b4f0d0b14af76817a7c5fc5d111.zip
Merge branch 'tari01-pr/add-lomiri-features-flag'
Attribute GH PR #67: https://github.com/AyatanaIndicators/ayatana-indicator-display/pull/67
-rw-r--r--.build.yml2
-rw-r--r--CMakeLists.txt10
-rw-r--r--src/CMakeLists.txt32
-rw-r--r--src/main.cpp13
-rw-r--r--tests/CMakeLists.txt9
5 files changed, 46 insertions, 20 deletions
diff --git a/.build.yml b/.build.yml
index 70aaf78..ee0496f 100644
--- a/.build.yml
+++ b/.build.yml
@@ -166,7 +166,7 @@ build_scripts:
-
- if [ -e ./CMakeLists.txt ]; then
- if [ ${DISTRO_NAME} == "debian" ] || [ ${DISTRO_NAME} == "ubuntu" ];then
- - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON -DENABLE_TESTS=ON
+ - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON -DENABLE_TESTS=ON -DENABLE_LOMIRI_FEATURES=ON
- else
- scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON
- fi
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 34fda26..ba7f022 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,6 +20,7 @@ set(SERVICE_EXEC "${PACKAGE}-service")
option(ENABLE_TESTS "Enable all tests and checks" OFF)
option(ENABLE_COVERAGE "Enable coverage reports (includes enabling all tests and checks)" OFF)
option(ENABLE_WERROR "Treat all build warnings as errors" OFF)
+option(ENABLE_LOMIRI_FEATURES "Build with Lomiri-specific libraries, schemas and media" OFF)
if(ENABLE_COVERAGE)
set(ENABLE_TESTS ON)
@@ -65,12 +66,18 @@ find_package(PkgConfig REQUIRED)
# glib...
set(GLIB_MINIMUM 2.36)
-set (SERVICE_DEPS libayatana-common>=0.9.3 gio-unix-2.0>=${GLIB_MINIMUM} glib-2.0>=${GLIB_MINIMUM} gudev-1.0)
+set (SERVICE_DEPS libayatana-common>=0.9.3 gio-unix-2.0>=${GLIB_MINIMUM} glib-2.0>=${GLIB_MINIMUM})
if (ENABLE_TESTS)
list (APPEND SERVICE_DEPS properties-cpp>=0.0.1)
endif ()
+if (ENABLE_LOMIRI_FEATURES)
+ find_package(Qt5Core REQUIRED)
+ list (APPEND SERVICE_DEPS gudev-1.0)
+ add_definitions (-DLOMIRI_FEATURES_ENABLED)
+endif ()
+
pkg_check_modules (SERVICE_DEPS REQUIRED ${SERVICE_DEPS})
include_directories (SYSTEM
@@ -115,3 +122,4 @@ endif()
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Unit tests: ${ENABLE_TESTS}")
message(STATUS "Build with -Werror: ${ENABLE_WERROR}")
+message(STATUS "Build with Lomiri features: ${ENABLE_LOMIRI_FEATURES}")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b7e91aa..33e42c3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -4,19 +4,29 @@ add_compile_options(
${CXX_WARNING_ARGS}
)
-add_library(
- ${SERVICE_LIB}
- STATIC
- adbd-client.cpp
- exporter.cpp
- greeter.cpp
- indicator.cpp
- rotation-lock.cpp
- usb-manager.cpp
- usb-monitor.cpp
- usb-snap.cpp
+set (SERVICE_LIB_SOURCES
+ exporter.cpp
+ indicator.cpp
+ rotation-lock.cpp
)
+if (ENABLE_LOMIRI_FEATURES)
+ list (APPEND
+ SERVICE_LIB_SOURCES
+ greeter.cpp
+ adbd-client.cpp
+ usb-manager.cpp
+ usb-monitor.cpp
+ usb-snap.cpp
+ )
+endif ()
+
+add_library (${SERVICE_LIB} STATIC ${SERVICE_LIB_SOURCES})
+
+if (ENABLE_LOMIRI_FEATURES)
+ target_link_libraries(${SERVICE_LIB} Qt5::Core)
+endif ()
+
add_executable(
${SERVICE_EXEC}
main.cpp
diff --git a/src/main.cpp b/src/main.cpp
index f145504..03c72c6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2014 Canonical Ltd.
+ * Copyright 2022 Robert Tari
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
@@ -15,21 +16,23 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <src/exporter.h>
#include <src/rotation-lock.h>
+#ifdef LOMIRI_FEATURES_ENABLED
#include <src/greeter.h>
#include <src/usb-manager.h>
#include <src/usb-monitor.h>
+#include <sys/stat.h>
+#include <errno.h>
+#endif
#include <glib/gi18n.h> // bindtextdomain()
#include <gio/gio.h>
-
#include <locale.h>
-#include <sys/stat.h>
-#include <errno.h>
extern "C"
{
@@ -65,6 +68,8 @@ main(int /*argc*/, char** /*argv*/)
exporters.push_back(exporter);
}
+#ifdef LOMIRI_FEATURES_ENABLED
+
gboolean bHasSocket = FALSE;
if (ayatana_common_utils_is_lomiri())
@@ -92,6 +97,8 @@ main(int /*argc*/, char** /*argv*/)
g_message("No /dev/socket/adbd socket found, skipping UsbManager");
}
+#endif
+
// let's go!
g_main_loop_run(loop);
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 33684d6..6b25955 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,7 +1,6 @@
set(CMAKE_AUTOMOC ON)
find_package(GMock REQUIRED)
-find_package(Qt5Core REQUIRED)
find_package(Qt5Test REQUIRED)
find_package(Qt5DBus COMPONENTS Qt5DBusMacros REQUIRED)
@@ -31,9 +30,11 @@ add_compile_options(${CXX_WARNING_ARGS})
add_test(cppcheck cppcheck --enable=all -USCHEMA_DIR --error-exitcode=2 --inline-suppr --library=qt -I${CMAKE_SOURCE_DIR} -i${CMAKE_SOURCE_DIR}/tests/utils/qmain.cpp -i${CMAKE_SOURCE_DIR}/tests/gmock ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests --suppress=missingIncludeSystem --suppress=uninitDerivedMemberVar --suppress=unmatchedSuppression --suppress=constParameter --suppress=unusedFunction)
-add_subdirectory(integration)
-add_subdirectory(unit)
-add_subdirectory(utils)
+if (ENABLE_LOMIRI_FEATURES)
+ add_subdirectory (integration)
+ add_subdirectory (unit)
+ add_subdirectory (utils)
+endif ()
set(COVERAGE_TEST_TARGETS
${COVERAGE_TEST_TARGETS}