aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-06-10 23:04:52 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-06-10 23:04:52 -0500
commit3f7fad001e4fe74a89b60d2e217750baaf3b0392 (patch)
tree0815572c8e67e0920e08b3f98277fab30a19b380 /src
parent49772635dc8dddeaea5a8f209bd7aac030a8a132 (diff)
downloadayatana-indicator-datetime-3f7fad001e4fe74a89b60d2e217750baaf3b0392.tar.gz
ayatana-indicator-datetime-3f7fad001e4fe74a89b60d2e217750baaf3b0392.tar.bz2
ayatana-indicator-datetime-3f7fad001e4fe74a89b60d2e217750baaf3b0392.zip
Don't build the hw-alarms pieces if ubuntu/hardware/alarm.h can't be found. Don't require libplatform-hardware-api-* unless the arch is armhf, i386, or amd64.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt57
-rw-r--r--src/main.cpp10
2 files changed, 40 insertions, 27 deletions
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;