diff options
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | debian/control | 4 | ||||
-rw-r--r-- | src/CMakeLists.txt | 57 | ||||
-rw-r--r-- | src/main.cpp | 10 |
4 files changed, 49 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e068f4..1390f44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,7 @@ set (CMAKE_INSTALL_FULL_PKGLIBEXECDIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/${CMAKE_ ## find_package (PkgConfig REQUIRED) +include (CheckIncludeFile) include (FindPkgConfig) pkg_check_modules (SERVICE_DEPS REQUIRED @@ -42,7 +43,12 @@ pkg_check_modules (SERVICE_DEPS REQUIRED url-dispatcher-1>=1 properties-cpp>=0.0.1) include_directories (SYSTEM ${SERVICE_DEPS_INCLUDE_DIRS}) -set (SERVICE_DEPS_LIBRARIES -lubuntu_platform_hardware_api ${SERVICE_DEPS_LIBRARIES}) + +CHECK_INCLUDE_FILE(ubuntu/hardware/alarm.h HAVE_UBUNTU_HW_ALARM_H) +if (HAVE_UBUNTU_HW_ALARM_H) + set (SERVICE_DEPS_LIBRARIES -lubuntu_platform_hardware_api ${SERVICE_DEPS_LIBRARIES}) + add_definitions(-DHAVE_UBUNTU_HW_ALARM_H) +endif () ## ## custom targets diff --git a/debian/control b/debian/control index 4ba02e4..96498ec 100644 --- a/debian/control +++ b/debian/control @@ -19,8 +19,8 @@ Build-Depends: cmake, libedataserver1.2-dev (>= 3.5), liburl-dispatcher1-dev, libproperties-cpp-dev, - libplatform-hardware-api-headers, - libplatform-hardware-api1-dev, + libplatform-hardware-api-headers [armhf i386 amd64], + libplatform-hardware-api1-dev [armhf i386 amd64], libdbustest1-dev, locales, Standards-Version: 3.9.3 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 924e538..ffa1523 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,32 +7,37 @@ SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g ${CXX_WARNING_ARGS} ${GCO add_definitions (-DTIMEZONE_FILE="/etc/timezone" -DG_LOG_DOMAIN="Indicator-Datetime") -add_library (${SERVICE_LIB} STATIC - actions.cpp - actions-live.cpp - alarm-queue-simple.cpp - appointment.cpp - clock.cpp - clock-live.cpp - date-time.cpp - engine-eds.cpp - exporter.cpp - formatter.cpp - formatter-desktop.cpp - locations.cpp - locations-settings.cpp - menu.cpp - planner-month.cpp - planner-range.cpp - planner-upcoming.cpp - settings-live.cpp - snap.cpp - timezone-file.cpp - timezone-geoclue.cpp - timezones-live.cpp - utils.c - wakeup-timer-uha.cpp - wakeup-timer-mainloop.cpp) +set (SERVICE_SOURCES + actions.cpp + actions-live.cpp + alarm-queue-simple.cpp + appointment.cpp + clock.cpp + clock-live.cpp + date-time.cpp + engine-eds.cpp + exporter.cpp + formatter.cpp + formatter-desktop.cpp + locations.cpp + locations-settings.cpp + menu.cpp + planner-month.cpp + planner-range.cpp + planner-upcoming.cpp + settings-live.cpp + snap.cpp + timezone-file.cpp + timezone-geoclue.cpp + timezones-live.cpp + utils.c + wakeup-timer-mainloop.cpp) + +if (HAVE_UBUNTU_HW_ALARM_H) + set (SERVICE_SOURCES ${SERVICE_SOURCES} wakeup-timer-uha.cpp) +endif () + +add_library (${SERVICE_LIB} STATIC ${SERVICE_SOURCES}) include_directories (${CMAKE_SOURCE_DIR}) link_directories (${SERVICE_DEPS_LIBRARY_DIRS}) diff --git a/src/main.cpp b/src/main.cpp index e35c5da..adbd371 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,7 +32,13 @@ #include <datetime/timezone-file.h> #include <datetime/timezones-live.h> #include <datetime/wakeup-timer-mainloop.h> -#include <datetime/wakeup-timer-uha.h> + +#ifdef HAVE_UBUNTU_HW_ALARM_H + #warning using hw alarms + #include <datetime/wakeup-timer-uha.h> +#else + #warning not using hw arlarms +#endif #include <glib/gi18n.h> // bindtextdomain() #include <gio/gio.h> @@ -64,9 +70,11 @@ namespace { std::shared_ptr<WakeupTimer> wakeup_timer; +#ifdef HAVE_UBUNTU_HW_ALARM_H if (UhaWakeupTimer::is_supported()) // prefer to use the platform API wakeup_timer = std::make_shared<UhaWakeupTimer>(clock); else +#endif wakeup_timer = std::make_shared<MainloopWakeupTimer>(clock); return wakeup_timer; |