aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.build.yml48
-rw-r--r--CMakeLists.txt68
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/main.cpp6
-rw-r--r--src/notifications.cpp6
-rw-r--r--src/snap.cpp2
-rw-r--r--tests/CMakeLists.txt31
7 files changed, 96 insertions, 71 deletions
diff --git a/.build.yml b/.build.yml
index 6f85e29..73a0815 100644
--- a/.build.yml
+++ b/.build.yml
@@ -28,6 +28,7 @@ requires:
- gtk-doc-tools
- libaccountsservice
# - lomiri-schemas
+# - lomiri-sounds
debian:
# Useful URL: https://salsa.debian.org/debian-ayatana-team/ayatana-ido
@@ -56,6 +57,8 @@ requires:
- gtk-doc-tools
- libaccountsservice-dev
- liblomiri-url-dispatcher-dev
+# - lomiri-schemas
+# - lomiri-sounds
# for the test harness:
- libgtest-dev
- libdbustest1-dev
@@ -69,7 +72,6 @@ requires:
- systemd
- lcov
- gcovr
-# - lomiri-schemas
ubuntu:
- clang
@@ -85,6 +87,8 @@ requires:
- gobject-introspection
- libgirepository1.0-dev
- liblomiri-url-dispatcher-dev
+# - lomiri-schemas
+# - lomiri-sounds
- valac
- libglib2.0-dev
- libnotify-dev
@@ -109,7 +113,6 @@ requires:
- systemd
- lcov
- gcovr
-# - lomiri-schemas
ubuntu:focal:
- clang
@@ -125,6 +128,8 @@ requires:
- gobject-introspection
- libgirepository1.0-dev
# - liblomiri-url-dispatcher-dev
+# - lomiri-schemas
+# - lomiri-sounds
- valac
- libglib2.0-dev
- libnotify-dev
@@ -149,7 +154,6 @@ requires:
- systemd
- lcov
- gcovr
-# - lomiri-schemas
variables:
- 'CHECKERS="
@@ -192,25 +196,41 @@ before_scripts:
- cd -
- rm -Rf ayatana-indicator-messages-build/
-
- - cd ${START_DIR}
- - if [ ! -d lomiri-schemas-build ]; then
- - git clone --depth 1 https://gitlab.com/ubports/core/lomiri-schemas.git lomiri-schemas-build
+ - if [ ${DISTRO_NAME} == "debian" ];then
+ - cd ${START_DIR}
+ - if [ ! -d lomiri-schemas-build ]; then
+ - git clone --depth 1 https://gitlab.com/ubports/core/lomiri-schemas.git lomiri-schemas-build
+ - fi
+ - cd lomiri-schemas-build
+ - cmake . -DCMAKE_INSTALL_PREFIX=/usr
+ - make
+ - make install
+ - cd -
+ - rm -Rf lomiri-schemas-build/
+ -
+ - cd ${START_DIR}
+ - if [ ! -d lomiri-sounds-build ]; then
+ - git clone --depth 1 https://gitlab.com/ubports/core/lomiri-sounds.git lomiri-sounds-build
+ - fi
+ - cd lomiri-sounds-build
+ - cmake . -DCMAKE_INSTALL_PREFIX=/usr
+ - make
+ - make install
+ - cd -
+ - rm -Rf lomiri-sounds-build/
- fi
- - cd lomiri-schemas-build
- - cmake . -DCMAKE_INSTALL_PREFIX=/usr
- - make
- - make install
- - cd -
- - rm -Rf lomiri-schemas-build/
build_scripts:
- if [ ${DISTRO_NAME} == "debian" ];then
- export CFLAGS+=" -Wsign-compare -Wunused-parameter"
- - cppcheck --enable=warning,style,performance,portability,information,missingInclude .
+# FIXME: uninitMemberVar can perhaps be fixed in the source and dropped here
+ - cppcheck --enable=warning,style,performance,portability,information --suppress=uninitMemberVar --suppress=missingInclude .
- fi
-
- if [ -e ./CMakeLists.txt ]; then
- - if [ ${DISTRO_NAME} == "debian" ] || [ ${DISTRO_NAME} == "ubuntu" ]; then
+ - if [ ${DISTRO_NAME} == "debian" ]; then
+ - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTS=ON -DENABLE_LOMIRI_FEATURES=ON
+ - elif [ ${DISTRO_NAME} == "ubuntu" ]; then
- scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTS=ON
- else
- scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3370b06..8bb9042 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,6 +14,7 @@ set (PACKAGE ${CMAKE_PROJECT_NAME})
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)
@@ -43,11 +44,6 @@ set (GETTEXT_PACKAGE "ayatana-indicator-datetime")
add_definitions (-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}"
-DLOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}")
-set(ALARM_DEFAULT_SOUND "/usr/share/sounds/lomiri/ringtones/Alarm clock.ogg")
-set(CALENDAR_DEFAULT_SOUND "/usr/share/sounds/lomiri/ringtones/Marimbach.ogg")
-add_definitions(-DALARM_DEFAULT_SOUND="${ALARM_DEFAULT_SOUND}"
- -DCALENDAR_DEFAULT_SOUND="${CALENDAR_DEFAULT_SOUND}")
-
##
## Check for prerequisites
##
@@ -56,33 +52,44 @@ find_package (PkgConfig REQUIRED)
include (CheckIncludeFile)
include (FindPkgConfig)
-pkg_check_modules (SERVICE_DEPS REQUIRED
- libayatana-common>=0.9.3
- glib-2.0>=2.36
- gio-unix-2.0>=2.36
- libical>=0.48
- libecal-2.0>=3.16
- libedataserver-1.2>=3.5
- gstreamer-1.0>=1.2
- libnotify>=0.7.6
- properties-cpp>=0.0.1
- libaccounts-glib>=1.18
- messaging-menu>=0.8.2
- uuid>=2.25)
+set (
+ SERVICE_DEPS
+ libayatana-common>=0.9.3
+ glib-2.0>=2.36
+ gio-unix-2.0>=2.36
+ libical>=0.48
+ libecal-2.0>=3.16
+ libedataserver-1.2>=3.5
+ gstreamer-1.0>=1.2
+ libnotify>=0.7.6
+ properties-cpp>=0.0.1
+ libaccounts-glib>=1.18
+ messaging-menu>=0.8.2
+ uuid>=2.25
+)
+
+if (ENABLE_LOMIRI_FEATURES)
+ list (
+ APPEND
+ SERVICE_DEPS
+ lomiri-url-dispatcher>=0
+ )
+
+ add_definitions (
+ -DLOMIRI_FEATURES_ENABLED
+ -DALARM_DEFAULT_SOUND="/usr/share/sounds/lomiri/ringtones/Alarm clock.ogg"
+ -DCALENDAR_DEFAULT_SOUND="/usr/share/sounds/lomiri/ringtones/Marimbach.ogg"
+ )
+else ()
+ add_definitions (
+ -DALARM_DEFAULT_SOUND="dummy"
+ -DCALENDAR_DEFAULT_SOUND="dummy"
+ )
+endif ()
+
+pkg_check_modules (SERVICE_DEPS REQUIRED ${SERVICE_DEPS})
include_directories (SYSTEM ${SERVICE_DEPS_INCLUDE_DIRS})
-# lomiri-url-dispatcher
-
-pkg_check_modules(URLDISPATCHER lomiri-url-dispatcher>=0)
-include_directories(${URLDISPATCHER_INCLUDE_DIRS})
-
-if(URLDISPATCHER_FOUND)
- add_definitions( -DHAS_URLDISPATCHER )
-endif()
-
-pkg_check_modules(LOMIRI_SOUNDS lomiri-sounds)
-pkg_check_modules(LOMIRI_SCHEMAS lomiri-schemas)
-
##
## custom targets
##
@@ -148,3 +155,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 d6d6844..5409c91 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -47,11 +47,11 @@ set(SERVICE_GENERATED_SOURCES)
add_gdbus_codegen(SERVICE_GENERATED_SOURCES dbus-alarm-properties
org.ayatana.indicator
${CMAKE_SOURCE_DIR}/data/org.ayatana.indicator.datetime.AlarmProperties.xml)
-if(LOMIRI_SCHEMAS_FOUND)
+
+if (ENABLE_LOMIRI_FEATURES)
add_gdbus_codegen(SERVICE_GENERATED_SOURCES dbus-accounts-sound
com.lomiri.touch
/usr/share/accountsservice/interfaces/com.lomiri.touch.AccountsService.Sound.xml)
- add_definitions (-DHAS_LOMIRI_SCHEMAS)
endif()
# add warnings/coverage info on handwritten files
@@ -70,5 +70,5 @@ link_directories (${SERVICE_DEPS_LIBRARY_DIRS})
add_executable (${SERVICE_EXEC} main.cpp)
set_source_files_properties(${SERVICE_SOURCES} main.cpp PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
-target_link_libraries (${SERVICE_EXEC} ${SERVICE_LIB} ${SERVICE_DEPS_LIBRARIES} ${URLDISPATCHER_LIBRARIES})
+target_link_libraries (${SERVICE_EXEC} ${SERVICE_LIB} ${SERVICE_DEPS_LIBRARIES})
install (TARGETS ${SERVICE_EXEC} RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_PKGLIBEXECDIR})
diff --git a/src/main.cpp b/src/main.cpp
index 0dc7198..4590e84 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -32,7 +32,7 @@
#include <datetime/planner-snooze.h>
#include <datetime/planner-range.h>
#include <datetime/settings-live.h>
-#ifdef HAS_LOMIRI_SCHEMAS
+#ifdef LOMIRI_FEATURES_ENABLED
#include <datetime/snap.h>
#endif
#include <datetime/state.h>
@@ -95,7 +95,7 @@ namespace
return state;
}
-#ifdef HAS_LOMIRI_SCHEMAS
+#ifdef LOMIRI_FEATURES_ENABLED
std::shared_ptr<AlarmQueue> create_simple_alarm_queue(const std::shared_ptr<Clock>& clock,
const std::shared_ptr<Planner>& snooze_planner,
const std::shared_ptr<Engine>& engine,
@@ -149,7 +149,7 @@ main(int /*argc*/, char** /*argv*/)
auto actions = std::make_shared<LiveActions>(state);
MenuFactory factory(actions, state);
-#ifdef HAS_LOMIRI_SCHEMAS
+#ifdef LOMIRI_FEATURES_ENABLED
// set up the snap decisions
auto snooze_planner = std::make_shared<SnoozePlanner>(state->settings, state->clock);
auto notification_engine = std::make_shared<ain::Engine>("ayatana-indicator-datetime-service");
diff --git a/src/notifications.cpp b/src/notifications.cpp
index f21b5e8..e38e5dc 100644
--- a/src/notifications.cpp
+++ b/src/notifications.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2014 Canonical Ltd.
+ * Copyright 2021 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,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <notifications/notifications.h>
@@ -24,7 +26,7 @@
#include <messaging-menu/messaging-menu-app.h>
#include <messaging-menu/messaging-menu-message.h>
-#ifdef HAS_URLDISPATCHER
+#ifdef LOMIRI_FEATURES_ENABLED
#include <lomiri-url-dispatcher.h>
#endif
@@ -462,7 +464,7 @@ private:
static std::string calendar_app_id()
{
-#ifdef HAS_URLDISPATCHER
+#ifdef LOMIRI_FEATURES_ENABLED
auto urls = g_strsplit("calendar://", ",", 0);
auto appids = lomiri_url_dispatch_url_appid(const_cast<const gchar**>(urls));
g_strfreev(urls);
diff --git a/src/snap.cpp b/src/snap.cpp
index e306dea..46f1d7b 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -19,7 +19,7 @@
* Robert Tari <robert@tari.in>
*/
-#ifdef HAS_LOMIRI_SCHEMAS
+#ifdef LOMIRI_FEATURES_ENABLED
#include "dbus-accounts-sound.h"
#include <datetime/snap.h>
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 7a6a301..247761f 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -41,45 +41,40 @@ function(add_test_by_name name)
add_executable (${TEST_NAME} ${TEST_NAME}.cpp gschemas.compiled)
target_link_options(${TEST_NAME} PRIVATE -no-pie)
add_test (${TEST_NAME} ${TEST_NAME})
- target_link_libraries (${TEST_NAME} indicatordatetimeservice ${DBUSTEST_LIBRARIES} ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} ${URLDISPATCHER_LIBRARIES})
+ target_link_libraries (${TEST_NAME} indicatordatetimeservice ${DBUSTEST_LIBRARIES} ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES})
endfunction()
add_test_by_name(test-datetime)
-if(LOMIRI_SCHEMAS_FOUND)
- if(LOMIRI_SOUNDS_FOUND)
- add_test_by_name(test-sound)
- add_test_by_name(test-notification)
- endif()
+
+if (ENABLE_LOMIRI_FEATURES)
+ add_test_by_name(test-sound)
+ # This one only succeeds on Lomiri because it needs hfd-service
+ # add_test_by_name(test-notification)
add_test_by_name(test-notification-response)
endif()
+
add_test_by_name(test-actions)
add_test_by_name(test-alarm-queue)
add_test(NAME dear-reader-the-next-test-takes-60-seconds COMMAND true)
add_test_by_name(test-clock)
-
-if (NOT DEFINED ENV{CI})
- #add_test_by_name(test-exporter)
-endif()
-
+# This one is fine, but hangs on Travis CI
+# add_test_by_name(test-exporter)
add_test_by_name(test-formatter)
add_test_by_name(test-live-actions)
add_test_by_name(test-locations)
add_test_by_name(test-menu-appointments)
-
-if (NOT DEFINED ENV{CI})
- #add_test_by_name(test-menus)
-endif()
-
+# This one is fine, but hangs on Travis CI
+# add_test_by_name(test-menus)
add_test_by_name(test-planner)
add_test_by_name(test-settings)
add_test_by_name(test-timezone-timedated)
add_test_by_name(test-utils)
-if(LOMIRI_SCHEMAS_FOUND)
+if (ENABLE_LOMIRI_FEATURES)
set (TEST_NAME manual-test-snap)
set (COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} ${TEST_NAME})
add_executable (${TEST_NAME} ${TEST_NAME}.cpp)
target_link_options(${TEST_NAME} PRIVATE -no-pie)
- target_link_libraries (${TEST_NAME} indicatordatetimeservice ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} ${URLDISPATCHER_LIBRARIES})
+ target_link_libraries (${TEST_NAME} indicatordatetimeservice ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES})
endif()
##