aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt45
-rw-r--r--src/Makefile.am83
-rw-r--r--src/device-provider-upower.h2
3 files changed, 47 insertions, 83 deletions
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