aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-07-13 23:43:41 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-07-13 23:43:41 -0500
commit35a8b1720631a6b700bf9a234d0444c3457ce197 (patch)
treeac78e5550187fd3d9f703209441d7d11cc8a7852
parent3f29c1a35113bfd2461dca76235f1812c8dfd6ef (diff)
downloadayatana-indicator-power-35a8b1720631a6b700bf9a234d0444c3457ce197.tar.gz
ayatana-indicator-power-35a8b1720631a6b700bf9a234d0444c3457ce197.tar.bz2
ayatana-indicator-power-35a8b1720631a6b700bf9a234d0444c3457ce197.zip
replace autoconf/automake with cmake
-rw-r--r--CMakeLists.txt96
-rw-r--r--Makefile.am43
-rw-r--r--Makefile.am.coverage48
-rwxr-xr-xautogen.sh27
-rw-r--r--cmake/GCov.cmake51
-rw-r--r--cmake/GdbusCodegen.cmake36
-rw-r--r--cmake/Translations.cmake41
-rw-r--r--cmake/UseGSettings.cmake23
-rw-r--r--configure.ac138
-rw-r--r--data/CMakeLists.txt69
-rw-r--r--data/Makefile.am58
-rw-r--r--m4/gcov.m486
-rw-r--r--m4/gtest.m463
-rw-r--r--src/CMakeLists.txt45
-rw-r--r--src/Makefile.am83
-rw-r--r--src/device-provider-upower.h2
-rw-r--r--tests/CMakeLists.txt46
-rw-r--r--tests/Makefile.am71
18 files changed, 409 insertions, 617 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..9f80294
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,96 @@
+project(indicator-power C CXX)
+cmake_minimum_required(VERSION 2.8.9)
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
+
+set(PROJECT_VERSION "14.10.0")
+set(PACKAGE ${CMAKE_PROJECT_NAME})
+set(GETTEXT_PACKAGE "indicator-power")
+add_definitions (-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}"
+ -DGNOMELOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}")
+
+option (enable_tests "Build the package's automatic tests." ON)
+option (enable_lcov "Generate lcov code coverage reports." ON)
+
+##
+## GNU standard installation directories
+##
+
+include (GNUInstallDirs)
+if (EXISTS "/etc/debian_version") # Workaround for libexecdir on debian
+ set (CMAKE_INSTALL_LIBEXECDIR "${CMAKE_INSTALL_LIBDIR}")
+ set (CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_FULL_LIBDIR}")
+endif ()
+set (CMAKE_INSTALL_PKGLIBEXECDIR "${CMAKE_INSTALL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}")
+set (CMAKE_INSTALL_FULL_PKGLIBEXECDIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}")
+
+##
+## Check for prerequisites
+##
+
+find_package (PkgConfig REQUIRED)
+include (CheckIncludeFile)
+include (FindPkgConfig)
+
+pkg_check_modules(SERVICE_DEPS REQUIRED
+ glib-2.0>=2.36
+ gio-2.0>=2.36
+ gio-unix-2.0>=2.36
+ gudev-1.0>=204
+ url-dispatcher-1>=1)
+
+include_directories (SYSTEM ${SERVICE_DEPS_INCLUDE_DIRS})
+
+##
+## custom targets
+##
+
+set (ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
+add_custom_target (dist
+ COMMAND bzr export --root=${ARCHIVE_NAME} ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.gz
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+
+add_custom_target (clean-coverage
+ COMMAND find ${CMAKE_BINARY_DIR} -name '*.gcda' | xargs rm -f)
+
+add_custom_target (cppcheck COMMAND cppcheck --enable=all -q --error-exitcode=2 --inline-suppr
+ ${CMAKE_SOURCE_DIR}/src
+ ${CMAKE_SOURCE_DIR}/tests)
+
+##
+## Actual building
+##
+
+# those GActionEntry structs tickle -Wmissing-field-initializers
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set(C_WARNING_ARGS "${C_WARNING_ARGS} -Weverything -Wno-c++98-compat")
+ set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-documentation") # gtk-doc != doxygen
+else()
+ set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wall -Wextra -Wpedantic -Wformat=2")
+endif()
+set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-missing-field-initializers") # GActionEntry
+
+
+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
+include_directories (${CMAKE_CURRENT_BINARY_DIR}/include)
+
+# testing & coverage
+if (${enable_tests})
+ pkg_check_modules (DBUSTEST REQUIRED dbustest-1>=14.04.0)
+ set (GTEST_SOURCE_DIR /usr/src/gtest/src)
+ set (GTEST_INCLUDE_DIR ${GTEST_SOURCE_DIR}/..)
+ set (GTEST_LIBS -lpthread)
+ enable_testing ()
+ if (${enable_lcov})
+ include(GCov)
+ endif ()
+endif ()
+
+# actually build things
+add_subdirectory(src)
+add_subdirectory(data)
+add_subdirectory(po)
+if (${enable_tests})
+ add_subdirectory(tests)
+endif ()
+
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index fbf05ca..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-SUBDIRS = po data src
-
-if BUILD_TESTS
-SUBDIRS += tests
-# build src first
-tests: src
-endif
-
-
-############################################################
-
-dist_noinst_SCRIPTS = \
- autogen.sh
-
-############################################################
-
-dist-hook:
- @if test -d "$(top_srcdir)/.bzr"; \
- then \
- echo Creating ChangeLog && \
- ( cd "$(top_srcdir)" && \
- echo '# Generated by Makefile. Do not edit.'; echo; \
- $(top_srcdir)/build-aux/missing --run bzr log --gnu-changelog ) > ChangeLog.tmp \
- && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
- || (rm -f ChangeLog.tmp; \
- echo Failed to generate ChangeLog >&2 ); \
- else \
- echo Failed to generate ChangeLog: not a branch >&2; \
- fi
- @if test -d "$(top_srcdir)/.bzr"; \
- then \
- echo Creating AUTHORS && \
- ( cd "$(top_srcdir)" && \
- echo '# Generated by Makefile. Do not edit.'; echo; \
- $(top_srcdir)/build-aux/missing --run bzr log --long --levels=0 | grep -e "^\s*author:" -e "^\s*committer:" | cut -d ":" -f 2 | cut -d "<" -f 1 | sort -u) > AUTHORS.tmp \
- && mv -f AUTHORS.tmp $(top_distdir)/AUTHORS \
- || (rm -f AUTHORS.tmp; \
- echo Failed to generate AUTHORS >&2 ); \
- else \
- echo Failed to generate AUTHORS: not a branch >&2; \
- fi
-
-include $(top_srcdir)/Makefile.am.coverage
diff --git a/Makefile.am.coverage b/Makefile.am.coverage
deleted file mode 100644
index fb97747..0000000
--- a/Makefile.am.coverage
+++ /dev/null
@@ -1,48 +0,0 @@
-
-# Coverage targets
-
-.PHONY: clean-gcno clean-gcda \
- coverage-html generate-coverage-html clean-coverage-html \
- coverage-gcovr generate-coverage-gcovr clean-coverage-gcovr
-
-clean-local: clean-gcno clean-coverage-html clean-coverage-gcovr
-
-if HAVE_GCOV
-
-clean-gcno:
- @echo Removing old coverage instrumentation
- -find -name '*.gcno' -print | xargs -r rm
-
-clean-gcda:
- @echo Removing old coverage results
- -find -name '*.gcda' -print | xargs -r rm
-
-coverage-html: clean-gcda
- -$(MAKE) $(AM_MAKEFLAGS) -k check
- $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html
-
-generate-coverage-html:
- @echo Collecting coverage data
- $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool
- LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
-
-clean-coverage-html: clean-gcda
- -$(LCOV) --directory $(top_builddir) -z
- -rm -rf coverage.info coveragereport
-
-if HAVE_GCOVR
-
-coverage-gcovr: clean-gcda
- -$(MAKE) $(AM_MAKEFLAGS) -k check
- $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr
-
-generate-coverage-gcovr:
- @echo Generating coverage GCOVR report
- $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml
-
-clean-coverage-gcovr: clean-gcda
- -rm -rf $(top_builddir)/coverage.xml
-
-endif # HAVE_GCOVR
-
-endif # HAVE_GCOV
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index 1912c87..0000000
--- a/autogen.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-
-test -n "$srcdir" || srcdir=`dirname "$0"`
-test -n "$srcdir" || srcdir=.
-
-olddir=`pwd`
-cd $srcdir
-
-AUTORECONF=`which autoreconf`
-if test -z $AUTORECONF; then
- echo "*** No autoreconf found, please intall it ***"
- exit 1
-fi
-
-INTLTOOLIZE=`which intltoolize`
-if test -z $INTLTOOLIZE; then
- echo "*** No intltoolize found, please install the intltool package ***"
- exit 1
-fi
-
-mkdir -p build-aux
-
-autopoint --force
-AUTOPOINT='intltoolize --automake --copy' autoreconf --force --install --verbose
-
-cd $olddir
-test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/cmake/GCov.cmake b/cmake/GCov.cmake
new file mode 100644
index 0000000..81c0c40
--- /dev/null
+++ b/cmake/GCov.cmake
@@ -0,0 +1,51 @@
+if (CMAKE_BUILD_TYPE MATCHES coverage)
+ set(GCOV_FLAGS "${GCOV_FLAGS} --coverage")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCOV_FLAGS}")
+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${GCOV_FLAGS}")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GCOV_FLAGS}")
+ set(GCOV_LIBS ${GCOV_LIBS} gcov)
+
+ find_program(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin")
+ if (NOT GCOVR_EXECUTABLE)
+ message(STATUS "Gcovr binary was not found, can not generate XML coverage info.")
+ else ()
+ message(STATUS "Gcovr found, can generate XML coverage info.")
+ add_custom_target (coverage-xml
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMAND "${GCOVR_EXECUTABLE}" --exclude="test.*" -x -r "${CMAKE_SOURCE_DIR}"
+ --object-directory=${CMAKE_BINARY_DIR} -o coverage.xml)
+ endif()
+
+ find_program(LCOV_EXECUTABLE lcov HINTS ${LCOV_ROOT} "${GCOVR_ROOT}/bin")
+ find_program(GENHTML_EXECUTABLE genhtml HINTS ${GENHTML_ROOT})
+ if (NOT LCOV_EXECUTABLE)
+ message(STATUS "Lcov binary was not found, can not generate HTML coverage info.")
+ else ()
+ if(NOT GENHTML_EXECUTABLE)
+ message(STATUS "Genthml binary not found, can not generate HTML coverage info.")
+ else()
+ message(STATUS "Lcov and genhtml found, can generate HTML coverage info.")
+ add_custom_target (coverage-html
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMAND "${CMAKE_CTEST_COMMAND}" --force-new-ctest-process --verbose
+ COMMAND "${LCOV_EXECUTABLE}" --directory ${CMAKE_BINARY_DIR} --capture | ${CMAKE_SOURCE_DIR}/trim-lcov.py > dconf-lcov.info
+ COMMAND "${LCOV_EXECUTABLE}" -r dconf-lcov.info /usr/include/\\* -o nosys-lcov.info
+ COMMAND LANG=C "${GENHTML_EXECUTABLE}" --prefix ${CMAKE_BINARY_DIR} --output-directory lcov-html --legend --show-details nosys-lcov.info
+ COMMAND ${CMAKE_COMMAND} -E echo ""
+ COMMAND ${CMAKE_COMMAND} -E echo "file://${CMAKE_BINARY_DIR}/lcov-html/index.html"
+ COMMAND ${CMAKE_COMMAND} -E echo "")
+ #COMMAND "${LCOV_EXECUTABLE}" --directory ${CMAKE_BINARY_DIR} --capture --output-file coverage.info --no-checksum
+ #COMMAND "${GENHTML_EXECUTABLE}" --prefix ${CMAKE_BINARY_DIR} --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
+ #COMMAND ${CMAKE_COMMAND} -E echo "\\#define foo \\\"bar\\\""
+ #)
+ endif()
+ endif()
+endif()
+
+
+ #$(MAKE) $(AM_MAKEFLAGS) check
+ #lcov --directory $(top_builddir) --capture --test-name dconf | $(top_srcdir)/trim-lcov.py > dconf-lcov.info
+ #LANG=C genhtml --prefix $(top_builddir) --output-directory lcov-html --legend --show-details dconf-lcov.info
+ #@echo
+ #@echo " file://$(abs_top_builddir)/lcov-html/index.html"
+ #@echo
diff --git a/cmake/GdbusCodegen.cmake b/cmake/GdbusCodegen.cmake
new file mode 100644
index 0000000..ddb2995
--- /dev/null
+++ b/cmake/GdbusCodegen.cmake
@@ -0,0 +1,36 @@
+cmake_minimum_required(VERSION 2.6)
+if(POLICY CMP0011)
+ cmake_policy(SET CMP0011 NEW)
+endif(POLICY CMP0011)
+
+find_program(GDBUS_CODEGEN NAMES gdbus-codegen DOC "gdbus-codegen executable")
+if(NOT GDBUS_CODEGEN)
+ message(FATAL_ERROR "Excutable gdbus-codegen not found")
+endif()
+
+macro(add_gdbus_codegen outfiles name prefix service_xml)
+ add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.h" "${CMAKE_CURRENT_BINARY_DIR}/${name}.c"
+ COMMAND "${GDBUS_CODEGEN}"
+ --interface-prefix "${prefix}"
+ --generate-c-code "${name}"
+ "${service_xml}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS ${ARGN} "${service_xml}"
+ )
+ list(APPEND ${outfiles} "${CMAKE_CURRENT_BINARY_DIR}/${name}.c")
+endmacro(add_gdbus_codegen)
+
+macro(add_gdbus_codegen_with_namespace outfiles name prefix namespace service_xml)
+ add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.h" "${CMAKE_CURRENT_BINARY_DIR}/${name}.c"
+ COMMAND "${GDBUS_CODEGEN}"
+ --interface-prefix "${prefix}"
+ --generate-c-code "${name}"
+ --c-namespace "${namespace}"
+ "${service_xml}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS ${ARGN} "${service_xml}"
+ )
+ list(APPEND ${outfiles} "${CMAKE_CURRENT_BINARY_DIR}/${name}.c")
+endmacro(add_gdbus_codegen_with_namespace)
diff --git a/cmake/Translations.cmake b/cmake/Translations.cmake
new file mode 100644
index 0000000..d41f04e
--- /dev/null
+++ b/cmake/Translations.cmake
@@ -0,0 +1,41 @@
+# Translations.cmake, CMake macros written for Marlin, feel free to re-use them
+
+macro(add_translations_directory NLS_PACKAGE)
+ add_custom_target (i18n ALL)
+ find_program (MSGFMT_EXECUTABLE msgfmt)
+ file (GLOB PO_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.po)
+ foreach (PO_INPUT ${PO_FILES})
+ get_filename_component (PO_INPUT_BASE ${PO_INPUT} NAME_WE)
+ set (MO_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PO_INPUT_BASE}.mo)
+ add_custom_command (TARGET i18n COMMAND ${MSGFMT_EXECUTABLE} -o ${MO_OUTPUT} ${PO_INPUT})
+
+ install (FILES ${MO_OUTPUT} DESTINATION
+ ${CMAKE_INSTALL_LOCALEDIR}/${PO_INPUT_BASE}/LC_MESSAGES
+ RENAME ${NLS_PACKAGE}.mo)
+ endforeach (PO_INPUT ${PO_FILES})
+endmacro(add_translations_directory)
+
+
+macro(add_translations_catalog NLS_PACKAGE)
+ add_custom_target (pot COMMENT “Building translation catalog.”)
+ find_program (XGETTEXT_EXECUTABLE xgettext)
+
+
+ set(C_SOURCE "")
+
+ foreach(FILES_INPUT ${ARGN})
+ file (GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.c)
+ foreach(C_FILE ${SOURCE_FILES})
+ set(C_SOURCE ${C_SOURCE} ${C_FILE})
+ endforeach()
+ file (GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.vala)
+ foreach(C_FILE ${SOURCE_FILES})
+ set(C_SOURCE ${C_SOURCE} ${C_FILE})
+ endforeach()
+ endforeach()
+
+ add_custom_command (TARGET pot COMMAND
+ ${XGETTEXT_EXECUTABLE} -d ${NLS_PACKAGE} -o ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_PACKAGE}.pot
+ ${VALA_SOURCE} ${C_SOURCE} --keyword="_" --keyword="N_" --from-code=UTF-8
+ )
+endmacro()
diff --git a/cmake/UseGSettings.cmake b/cmake/UseGSettings.cmake
new file mode 100644
index 0000000..3b61523
--- /dev/null
+++ b/cmake/UseGSettings.cmake
@@ -0,0 +1,23 @@
+# GSettings.cmake, CMake macros written for Marlin, feel free to re-use them.
+
+macro(add_schema SCHEMA_NAME)
+
+ set(PKG_CONFIG_EXECUTABLE pkg-config)
+ set(GSETTINGS_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/glib-2.0/schemas")
+
+ # Run the validator and error if it fails
+ execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_compile_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process (COMMAND ${_glib_compile_schemas} --dry-run --schema-file=${SCHEMA_NAME} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if (_schemas_invalid)
+ message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
+ endif (_schemas_invalid)
+
+ # Actually install and recomple schemas
+ message (STATUS "${GSETTINGS_DIR} is the GSettings install dir")
+ install (FILES ${SCHEMA_NAME} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
+
+ install (CODE "message (STATUS \"Compiling GSettings schemas\")")
+ install (CODE "execute_process (COMMAND ${_glib_compile_schemas} ${GSETTINGS_DIR})")
+endmacro()
+
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index ca7e793..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,138 +0,0 @@
-AC_INIT([indicator-power],
- [13.10.0],
- [http://bugs.launchpad.net/indicator-power],
- [indicator-power],
- [http://launchpad.net/indicator-power])
-AC_COPYRIGHT([Copyright 2011-2013 Canonical])
-
-AC_PREREQ([2.64])
-
-AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_SRCDIR([src/device.c])
-AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_AUX_DIR([build-aux])
-
-AM_INIT_AUTOMAKE([1.11 -Wall foreign dist-xz check-news])
-AM_MAINTAINER_MODE([enable])
-
-AM_SILENT_RULES([yes])
-
-# Check for programs
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_PROG_CXX
-AM_PROG_AR
-
-# Initialize libtool
-LT_PREREQ([2.2.6])
-LT_INIT
-
-
-###########################
-# Dependencies
-###########################
-
-GLIB_REQUIRED_VERSION=2.35.4
-GIO_REQUIRED_VERSION=2.26
-GIO_UNIX_REQUIRED_VERSION=2.26
-GUDEV_REQUIRED_VERSION=204
-
-PKG_CHECK_MODULES([SERVICE_DEPS],[glib-2.0 >= $GLIB_REQUIRED_VERSION
- gio-2.0 >= $GIO_REQUIRED_VERSION
- gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
- gudev-1.0 >= $GUDEV_REQUIRED_VERSION
- url-dispatcher-1])
-
-###########################
-# GSETTINGS
-###########################
-
-GLIB_GSETTINGS
-
-###########################
-# Google Test framework
-###########################
-
-AC_ARG_ENABLE([tests],
- [AS_HELP_STRING([--disable-tests], [Disable test scripts and tools (default=auto)])],
- [enable_tests=${enableval}],
- [enable_tests=auto])
-if test "x$enable_tests" != "xno"; then
- m4_include([m4/gtest.m4])
- CHECK_GTEST
- if test "x$enable_tests" = "xauto"; then
- enable_tests=${have_gtest}
- elif test "x$enable_tests" = "xyes" && test "x$have_gtest" != "xyes"; then
- AC_MSG_ERROR([tests were requested but gtest is not installed.])
- fi
-fi
-AM_CONDITIONAL([BUILD_TESTS],[test "x$enable_tests" = "xyes"])
-
-###########################
-# gcov coverage reporting
-###########################
-
-m4_include([m4/gcov.m4])
-AC_TDD_GCOV
-AM_CONDITIONAL([HAVE_GCOV], [test "x$ac_cv_check_gcov" = xyes])
-AM_CONDITIONAL([HAVE_LCOV], [test "x$ac_cv_check_lcov" = xyes])
-AM_CONDITIONAL([HAVE_GCOVR], [test "x$ac_cv_check_gcovr" = xyes])
-AC_SUBST(COVERAGE_CFLAGS)
-AC_SUBST(COVERAGE_CXXFLAGS)
-AC_SUBST(COVERAGE_LDFLAGS)
-
-##############################
-# Custom Junk
-##############################
-
-AC_DEFUN([AC_DEFINE_PATH], [
- test "x$prefix" = xNONE && prefix="$ac_default_prefix"
- test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
- ac_define_path=`eval echo [$]$2`
- ac_define_path=`eval echo [$]ac_define_path`
- $1="$ac_define_path"
- AC_SUBST($1)
- ifelse($3, ,
- AC_DEFINE_UNQUOTED($1, "$ac_define_path"),
- AC_DEFINE_UNQUOTED($1, "$ac_define_path", $3))
-])
-
-###########################
-# Internationalization
-###########################
-
-IT_PROG_INTLTOOL([0.50.0])
-
-AM_GNU_GETTEXT([external])
-AM_GNU_GETTEXT_VERSION([0.17])
-
-AC_SUBST([GETTEXT_PACKAGE],[${PACKAGE_TARNAME}])
-AC_DEFINE([GETTEXT_PACKAGE],[PACKAGE_TARNAME],[Define to the gettext package name.])
-AC_DEFINE_PATH([GNOMELOCALEDIR],"${datadir}/locale",[locale directory])
-
-###########################
-# Files
-###########################
-
-AC_CONFIG_FILES([
-Makefile
-po/Makefile.in
-data/Makefile
-src/Makefile
-tests/Makefile
-])
-AC_OUTPUT
-
-###########################
-# Results
-###########################
-
-AC_MSG_NOTICE([
-
-Power Indicator Configuration:
-
- Prefix: $prefix
- Unit Tests: $enable_tests
- gcov: $use_gcov
-
-])
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
new file mode 100644
index 0000000..51fc415
--- /dev/null
+++ b/data/CMakeLists.txt
@@ -0,0 +1,69 @@
+##
+## GSettings schema
+##
+
+include (UseGSettings)
+set (SCHEMA_NAME "com.canonical.indicator.power.gschema.xml")
+set (SCHEMA_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SCHEMA_NAME}")
+set (SCHEMA_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME}.in")
+
+# generate the .xml file using intltool
+set (ENV{LC_ALL} "C")
+execute_process (COMMAND intltool-merge -quiet --xml-style --utf8 --no-translations "${SCHEMA_FILE_IN}" "${SCHEMA_FILE}")
+
+# let UseGSettings do the rest
+add_schema (${SCHEMA_FILE})
+
+##
+## Upstart Job File
+##
+
+# where to install
+set (UPSTART_JOB_DIR "${CMAKE_INSTALL_FULL_DATADIR}/upstart/sessions")
+message (STATUS "${UPSTART_JOB_DIR} is the Upstart Job File install dir")
+
+set (UPSTART_JOB_NAME "${CMAKE_PROJECT_NAME}.conf")
+set (UPSTART_JOB_FILE "${CMAKE_CURRENT_BINARY_DIR}/${UPSTART_JOB_NAME}")
+set (UPSTART_JOB_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${UPSTART_JOB_NAME}.in")
+
+# build it
+set (pkglibexecdir "${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}")
+configure_file ("${UPSTART_JOB_FILE_IN}" "${UPSTART_JOB_FILE}")
+
+# install it
+install (FILES "${UPSTART_JOB_FILE}"
+ DESTINATION "${UPSTART_JOB_DIR}")
+
+##
+## XDG Autostart File
+##
+
+# where to install
+set (XDG_AUTOSTART_DIR "/etc/xdg/autostart")
+message (STATUS "${XDG_AUTOSTART_DIR} is the DBus Service File install dir")
+
+set (XDG_AUTOSTART_NAME "${CMAKE_PROJECT_NAME}.desktop")
+set (XDG_AUTOSTART_FILE "${CMAKE_CURRENT_BINARY_DIR}/${XDG_AUTOSTART_NAME}")
+set (XDG_AUTOSTART_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${XDG_AUTOSTART_NAME}.in")
+
+# build it
+set (pkglibexecdir "${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}")
+configure_file ("${XDG_AUTOSTART_FILE_IN}" "${XDG_AUTOSTART_FILE}")
+
+# install it
+install (FILES "${XDG_AUTOSTART_FILE}"
+ DESTINATION "${XDG_AUTOSTART_DIR}")
+
+##
+## Unity Indicator File
+##
+
+# where to install
+set (UNITY_INDICATOR_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/unity/indicators")
+message (STATUS "${UNITY_INDICATOR_DIR} is the Unity Indicator install dir")
+
+set (UNITY_INDICATOR_NAME "com.canonical.indicator.power")
+set (UNITY_INDICATOR_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${UNITY_INDICATOR_NAME}")
+
+install (FILES "${UNITY_INDICATOR_FILE}"
+ DESTINATION "${UNITY_INDICATOR_DIR}")
diff --git a/data/Makefile.am b/data/Makefile.am
deleted file mode 100644
index 9a4caca..0000000
--- a/data/Makefile.am
+++ /dev/null
@@ -1,58 +0,0 @@
-BUILT_SOURCES=
-CLEANFILES=
-EXTRA_DIST=
-
-#
-# the indicator bus file
-#
-
-indicatorsdir = $(prefix)/share/unity/indicators
-dist_indicators_DATA = com.canonical.indicator.power
-
-#
-# the upstart job file
-#
-
-upstart_jobsdir = $(datadir)/upstart/sessions
-upstart_jobs_DATA = indicator-power.conf
-upstart_jobs_in = $(upstart_jobs_DATA:.conf=.conf.in)
-$(upstart_jobs_DATA): $(upstart_jobs_in)
- $(AM_V_GEN) $(SED) -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@
-BUILT_SOURCES += $(upstart_jobs_DATA)
-CLEANFILES += $(upstart_jobs_DATA)
-EXTRA_DIST += $(upstart_jobs_in)
-
-#
-# the xdg autostart job file
-#
-
-xdg_autostartdir = /etc/xdg/autostart
-xdg_autostart_DATA = indicator-power.desktop
-xdg_autostart_in = $(xdg_autostart_DATA:.desktop=.desktop.in)
-$(xdg_autostart_DATA): $(xdg_autostart_in)
- $(AM_V_GEN) $(SED) -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@
-BUILT_SOURCES += $(xdg_autostart_DATA)
-CLEANFILES += $(xdg_autostart_DATA)
-EXTRA_DIST += $(xdg_autostart_in)
-
-#
-# the gettings
-#
-
-gsettings_in_file = com.canonical.indicator.power.gschema.xml.in
-gsettings_SCHEMAS = $(gsettings_in_file:.xml.in=.xml)
-CLEANFILES += $(gsettings_SCHEMAS)
-
-@INTLTOOL_XML_NOMERGE_RULE@
-
-@GSETTINGS_RULES@
-
-dist_noinst_DATA = \
- com.canonical.indicator.power.gschema.xml \
- $(gsettings_in_file)
-
-CLEANFILES += \
- $(gsettings_SCHEMAS)
-
-MAINTAINERCLEANFILES = \
- $(gsettings_SCHEMAS:.xml=.valid)
diff --git a/m4/gcov.m4 b/m4/gcov.m4
deleted file mode 100644
index bd96386..0000000
--- a/m4/gcov.m4
+++ /dev/null
@@ -1,86 +0,0 @@
-# Checks for existence of coverage tools:
-# * gcov
-# * lcov
-# * genhtml
-# * gcovr
-#
-# Sets ac_cv_check_gcov to yes if tooling is present
-# and reports the executables to the variables LCOV, GCOVR and GENHTML.
-AC_DEFUN([AC_TDD_GCOV],
-[
- AC_ARG_ENABLE(gcov,
- AS_HELP_STRING([--enable-gcov],
- [enable coverage testing with gcov]),
- [use_gcov=$enableval], [use_gcov=no])
-
- if test "x$use_gcov" = "xyes"; then
- # we need gcc:
- if test "$GCC" != "yes"; then
- AC_MSG_ERROR([GCC is required for --enable-gcov])
- fi
-
- # Check if ccache is being used
- AC_CHECK_PROG(SHTOOL, shtool, shtool)
- case `$SHTOOL path $CC` in
- *ccache*[)] gcc_ccache=yes;;
- *[)] gcc_ccache=no;;
- esac
-
- if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
- AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
- fi
-
- lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11"
- AC_CHECK_PROG(LCOV, lcov, lcov)
- AC_CHECK_PROG(GENHTML, genhtml, genhtml)
-
- if test "$LCOV"; then
- AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [
- glib_cv_lcov_version=invalid
- lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'`
- for lcov_check_version in $lcov_version_list; do
- if test "$lcov_version" = "$lcov_check_version"; then
- glib_cv_lcov_version="$lcov_check_version (ok)"
- fi
- done
- ])
- else
- lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list"
- AC_MSG_ERROR([$lcov_msg])
- fi
-
- case $glib_cv_lcov_version in
- ""|invalid[)]
- lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)."
- AC_MSG_ERROR([$lcov_msg])
- LCOV="exit 0;"
- ;;
- esac
-
- if test -z "$GENHTML"; then
- AC_MSG_ERROR([Could not find genhtml from the lcov package])
- fi
-
- ac_cv_check_gcov=yes
- ac_cv_check_lcov=yes
-
- # Remove all optimization flags from CFLAGS
- changequote({,})
- CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
- changequote([,])
-
- # Add the special gcc flags
- COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage"
- COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage"
- COVERAGE_LDFLAGS="-lgcov"
-
- # Check availability of gcovr
- AC_CHECK_PROG(GCOVR, gcovr, gcovr)
- if test -z "$GCOVR"; then
- ac_cv_check_gcovr=no
- else
- ac_cv_check_gcovr=yes
- fi
-
-fi
-]) # AC_TDD_GCOV
diff --git a/m4/gtest.m4 b/m4/gtest.m4
deleted file mode 100644
index 2de334c..0000000
--- a/m4/gtest.m4
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright (C) 2012 Canonical, Ltd.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-# Checks whether the gtest source is available on the system. Allows for
-# adjusting the include and source path. Sets have_gtest=yes if the source is
-# present. Sets GTEST_CPPFLAGS and GTEST_SOURCE to the preprocessor flags and
-# source location respectively.
-AC_DEFUN([CHECK_GTEST],
-[
- AC_ARG_WITH([gtest-include-path],
- [AS_HELP_STRING([--with-gtest-include-path],
- [location of the Google test headers])],
- [GTEST_CPPFLAGS="-I$withval"])
-
- AC_ARG_WITH([gtest-source-path],
- [AS_HELP_STRING([--with-gtest-source-path],
- [location of the Google test sources, defaults to /usr/src/gtest])],
- [GTEST_SOURCE="$withval"],
- [GTEST_SOURCE="/usr/src/gtest"])
-
- GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$GTEST_SOURCE"
-
- AC_LANG_PUSH([C++])
-
- tmp_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $GTEST_CPPFLAGS"
-
- AC_CHECK_HEADER([gtest/gtest.h])
-
- CPPFLAGS="$tmp_CPPFLAGS"
-
- AC_LANG_POP
-
- AC_CHECK_FILES([$GTEST_SOURCE/src/gtest-all.cc]
- [$GTEST_SOURCE/src/gtest_main.cc],
- [have_gtest_source=yes],
- [have_gtest_source=no])
-
- AS_IF([test "x$ac_cv_header_gtest_gtest_h" = xyes -a \
- "x$have_gtest_source" = xyes],
- [have_gtest=yes]
- [AC_SUBST(GTEST_CPPFLAGS)]
- [AC_SUBST(GTEST_SOURCE)],
- [have_gtest=no])
-]) # CHECK_GTEST
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..a39b945
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,45 @@
+set (SERVICE_LIB "indicatorpowerservice")
+set (SERVICE_EXEC "indicator-power-service")
+
+add_definitions(-DG_LOG_DOMAIN="Indicator-Power")
+
+# handwritten sources
+set(SERVICE_MANUAL_SOURCES
+ device-provider-upower.c
+ ib-brightness-control.c
+ ib-brightness-uscreen-control.c
+ device-provider.c
+ device.c
+ service.c)
+
+# generated sources
+include(GdbusCodegen)
+set(SERVICE_GENERATED_SOURCES)
+add_gdbus_codegen_with_namespace(SERVICE_GENERATED_SOURCES dbus-upower
+ org.freedesktop
+ Dbus
+ ${CMAKE_CURRENT_SOURCE_DIR}/org.freedesktop.UPower.xml)
+# add the bin dir to our include path so the code can find the generated header files
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+
+# add warnings/coverage info on handwritten files
+# but not the autogenerated ones...
+set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-bad-function-cast") # g_clear_object()
+set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-disabled-macro-expansion") # G_DEFINE_TYPE
+set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-assign-enum") # GParamFlags
+set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-switch-enum")
+set_source_files_properties(${SERVICE_MANUAL_SOURCES}
+ PROPERTIES COMPILE_FLAGS "${C_WARNING_ARGS} ${GCOV_FLAGS} -g -std=c99")
+
+# the service library for tests to link against (basically, everything except main())
+add_library(${SERVICE_LIB} STATIC ${SERVICE_MANUAL_SOURCES} ${SERVICE_GENERATED_SOURCES})
+include_directories(${CMAKE_SOURCE_DIR})
+link_directories(${SERVICE_DEPS_LIBRARY_DIRS})
+
+# the executable: lib + main()
+add_executable (${SERVICE_EXEC} main.c)
+set_source_files_properties(${SERVICE_SOURCES} main.c PROPERTIES COMPILE_FLAGS "${C_WARNING_ARGS} -g -std=c99")
+target_link_libraries (${SERVICE_EXEC} ${SERVICE_LIB} ${SERVICE_DEPS_LIBRARIES} ${GCOV_LIBS})
+install (TARGETS ${SERVICE_EXEC} RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_PKGLIBEXECDIR})
+
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644
index 3f71b60..0000000
--- a/src/Makefile.am
+++ /dev/null
@@ -1,83 +0,0 @@
-BUILT_SOURCES =
-EXTRA_DIST =
-CLEANFILES =
-
-SHARED_CFLAGS = \
- -Wall -Wextra -Werror \
- $(SERVICE_DEPS_CFLAGS) \
- -DG_LOG_DOMAIN=\"Indicator-Power\"
-
-###
-###
-
-upower_dbus_sources = \
- dbus-upower.c \
- dbus-upower.h
-
-$(upower_dbus_sources): org.freedesktop.UPower.xml
- $(AM_V_GEN) gdbus-codegen \
- --c-namespace Dbus \
- --interface-prefix org.freedesktop \
- --generate-c-code dbus-upower \
- $^
-
-BUILT_SOURCES += $(upower_dbus_sources)
-CLEANFILES += $(upower_dbus_sources)
-EXTRA_DIST += org.freedesktop.UPower.xml
-
-###
-###
-###
-
-noinst_LIBRARIES = libindicatorpower-upower.a libindicatorpower-service.a
-
-libindicatorpower_upower_a_SOURCES = \
- $(upower_dbus_sources) \
- device-provider-upower.c \
- device-provider-upower.h
-
-libindicatorpower_upower_a_CFLAGS = \
- $(SHARED_CFLAGS) \
- -Wno-unused-parameter \
- $(COVERAGE_CFLAGS)
-
-libindciatorpower_upower_a_LDFLAGS = $(COVERAGE_LDFLAGS)
-
-libindicatorpower_service_a_SOURCES = \
- ib-brightness-control.c \
- ib-brightness-control.h \
- ib-brightness-uscreen-control.c \
- ib-brightness-uscreen-control.h \
- device-provider.c \
- device-provider.h \
- device.c \
- device.h \
- service.c \
- service.h
-
-libindicatorpower_service_a_CFLAGS = \
- $(SHARED_CFLAGS) \
- -Wno-missing-field-initializers \
- $(COVERAGE_CFLAGS)
-
-libindicatorpower_service_a_LDFLAGS = $(COVERAGE_LDFLAGS)
-
-###
-###
-###
-
-pkglibexec_PROGRAMS = indicator-power-service
-
-indicator_power_service_SOURCES = main.c
-
-indicator_power_service_CFLAGS = \
- $(SHARED_CFLAGS) \
- $(COVERAGE_CFLAGS)
-
-indicator_power_service_LDADD = \
- libindicatorpower-upower.a \
- libindicatorpower-service.a \
- $(SERVICE_DEPS_LIBS)
-
-indicator_power_service_LDFLAGS = \
- $(COVERAGE_LDFLAGS)
diff --git a/src/device-provider-upower.h b/src/device-provider-upower.h
index 7bdd5d5..7bfecd9 100644
--- a/src/device-provider-upower.h
+++ b/src/device-provider-upower.h
@@ -65,6 +65,8 @@ struct _IndicatorPowerDeviceProviderUPowerClass
GObjectClass parent_class;
};
+GType indicator_power_device_provider_upower_get_type (void);
+
IndicatorPowerDeviceProvider * indicator_power_device_provider_upower_new (void);
G_END_DECLS
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 0000000..c5ad09d
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,46 @@
+# build libgtest
+add_library (gtest STATIC
+ ${GTEST_SOURCE_DIR}/gtest-all.cc
+ ${GTEST_SOURCE_DIR}/gtest_main.cc)
+set_target_properties (gtest PROPERTIES INCLUDE_DIRECTORIES ${INCLUDE_DIRECTORIES} ${GTEST_INCLUDE_DIR})
+set_target_properties (gtest PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS} -w)
+
+# add warnings
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g ${C_WARNING_ARGS}")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-weak-vtables -Wno-global-constructors") # Google Test
+
+# build the necessary schemas
+set_directory_properties (PROPERTIES
+ ADDITIONAL_MAKE_CLEAN_FILES gschemas.compiled)
+set_source_files_properties (gschemas.compiled GENERATED)
+
+# GSettings:
+# compile the indicator-power schema into a gschemas.compiled file in this directory,
+# and help the tests to find that file by setting -DSCHEMA_DIR
+set (SCHEMA_DIR ${CMAKE_CURRENT_BINARY_DIR})
+add_definitions(-DSCHEMA_DIR="${SCHEMA_DIR}")
+execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas
+ OUTPUT_VARIABLE COMPILE_SCHEMA_EXECUTABLE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+add_custom_command (OUTPUT gschemas.compiled
+ DEPENDS ${CMAKE_BINARY_DIR}/data/com.canonical.indicator.power.gschema.xml
+ COMMAND cp -f ${CMAKE_BINARY_DIR}/data/*gschema.xml ${SCHEMA_DIR}
+ COMMAND ${COMPILE_SCHEMA_EXECUTABLE} ${SCHEMA_DIR})
+
+# look for headers in our src dir, and also in the directories where we autogenerate files...
+include_directories (${CMAKE_SOURCE_DIR}/src)
+include_directories (${CMAKE_BINARY_DIR}/src)
+include_directories (${CMAKE_CURRENT_BINARY_DIR})
+
+###
+###
+
+function(add_test_by_name name)
+ set (TEST_NAME ${name})
+ add_executable (${TEST_NAME} ${TEST_NAME}.cc gschemas.compiled)
+ add_test (${TEST_NAME} ${TEST_NAME})
+ add_dependencies (${TEST_NAME} libindicatorpowerservice)
+ target_link_libraries (${TEST_NAME} indicatorpowerservice gtest ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBS})
+endfunction()
+add_test_by_name(test-device)
+
diff --git a/tests/Makefile.am b/tests/Makefile.am
deleted file mode 100644
index 483bb8c..0000000
--- a/tests/Makefile.am
+++ /dev/null
@@ -1,71 +0,0 @@
-TESTS =
-CLEANFILES =
-BUILT_SOURCES =
-check_PROGRAMS =
-
-###
-### tests: stock tests on user-visible strings
-###
-
-include $(srcdir)/Makefile.am.strings
-
-###
-### gtest library
-###
-
-check_LIBRARIES = libgtest.a
-nodist_libgtest_a_SOURCES = \
- $(GTEST_SOURCE)/src/gtest-all.cc \
- $(GTEST_SOURCE)/src/gtest_main.cc
-
-AM_CPPFLAGS = $(GTEST_CPPFLAGS) -I${top_srcdir}/src -Wall -Werror -std=c++11
-AM_CXXFLAGS = $(GTEST_CXXFLAGS)
-
-###
-### tests: indicator-power-device
-###
-
-dear-reader-please-note-the-next-test-takes-90-seconds:
- @echo "#!/bin/bash" > $@
- @echo "exit 0" >> $@
- @chmod +x $@
-TESTS += dear-reader-please-note-the-next-test-takes-90-seconds
-CLEANFILES += dear-reader-please-note-the-next-test-takes-90-seconds
-
-TEST_LIBS = $(COVERAGE_LDFLAGS) libgtest.a -lpthread
-TEST_CPPFLAGS = $(SERVICE_DEPS_CFLAGS) $(AM_CPPFLAGS)
-
-TESTS += test-device
-check_PROGRAMS += test-device
-test_device_SOURCES = test-device.cc
-test_device_CPPFLAGS = $(TEST_CPPFLAGS) -Wall -Werror -Wextra
-test_device_LDADD = \
- $(top_builddir)/src/libindicatorpower-service.a \
- $(SERVICE_DEPS_LIBS) \
- $(TEST_LIBS)
-
-
-# (FIXME: incomplete)
-#
-###
-### tests: indicator-power-service
-###
-#
-# build a local copy of the GSettings schemas
-#BUILT_SOURCES += gschemas.compiled
-#CLEANFILES += gschemas.compiled
-#gschemas.compiled: Makefile
-# @glib-compile-schemas --targetdir=$(abs_builddir) $(top_builddir)/data
-#
-#TESTS += test-service
-#check_PROGRAMS += test-service
-#test_service_SOURCES = test-service.cc
-#test_service_LDADD = $(TEST_LIBS)
-#test_service_CPPFLAGS = $(TEST_CPPFLAGS) -DSCHEMA_DIR="\"$(top_builddir)/tests/\""
-#
-#TESTS += test-dbus-listener
-#check_PROGRAMS += test-dbus-listener
-#test_dbus_listener_SOURCES = test-dbus-listener.cc
-#test_dbus_listener_LDADD = $(TEST_LIBS)
-#test_dbus_listener_CPPFLAGS = $(TEST_CPPFLAGS)
-#