aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-10-25 23:31:54 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-10-26 12:03:59 +0100
commite672e51267ff87405700cbb80807aa6a678a06a5 (patch)
tree1fbce8d79376d671010533fe5045475464b3ec64 /src
parentd720a7987adee52f4da1d316270be5188331d6f8 (diff)
downloadayatana-indicator-bluetooth-e672e51267ff87405700cbb80807aa6a678a06a5.tar.gz
ayatana-indicator-bluetooth-e672e51267ff87405700cbb80807aa6a678a06a5.tar.bz2
ayatana-indicator-bluetooth-e672e51267ff87405700cbb80807aa6a678a06a5.zip
Port from autotools to CMake.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt180
-rw-r--r--src/Makefile.am39
2 files changed, 180 insertions, 39 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..d718180
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,180 @@
+###########################
+# Vala Generation
+###########################
+
+set(HEADER_PATH "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-bluetooth-service.h")
+set(SYMBOLS_PATH "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-bluetooth-service.def")
+set(VAPI_PATH "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-bluetooth-service.vapi")
+
+if(URLDISPATCHER_FOUND)
+ set (VALA_DEFINE_URLDISPATCHER "--define=HAS_URLDISPATCHER")
+ set (VALA_PKG_URLDISPATCHER "url-dispatcher")
+endif()
+
+vala_init(ayatana-indicator-bluetooth-service
+ DEPENDS
+ PACKAGES
+ config
+ rfkill
+ posix
+ gio-2.0
+ gio-unix-2.0
+ ${VALA_PKG_URLDISPATCHER}
+ OPTIONS
+ --ccode
+ --target-glib=${GLIB_2_0_REQUIRED_VERSION}
+ --vapidir=${CMAKE_SOURCE_DIR}/vapi/
+ --vapidir=.
+ ${VALA_DEFINE_URLDISPATCHER}
+)
+
+vala_add(ayatana-indicator-bluetooth-service
+main.vala
+ DEPENDS
+ service
+ bluetooth
+ device
+ bluez
+ killswitch
+)
+
+vala_add(ayatana-indicator-bluetooth-service
+ bluetooth.vala
+ DEPENDS
+ device
+)
+
+vala_add(ayatana-indicator-bluetooth-service
+ bluez.vala
+ DEPENDS
+ bluetooth
+ killswitch
+ device
+)
+
+vala_add(ayatana-indicator-bluetooth-service
+ desktop.vala
+ DEPENDS
+ profile
+ bluetooth
+ device
+)
+
+vala_add(ayatana-indicator-bluetooth-service
+ device.vala
+)
+
+vala_add(ayatana-indicator-bluetooth-service
+ killswitch.vala
+)
+
+vala_add(ayatana-indicator-bluetooth-service
+ phone.vala
+ DEPENDS
+ profile
+ bluetooth
+ device
+)
+
+vala_add(ayatana-indicator-bluetooth-service
+ profile.vala
+ DEPENDS
+ bluetooth
+ device
+)
+
+vala_add(ayatana-indicator-bluetooth-service
+ service.vala
+ DEPENDS
+ bluetooth
+ profile
+ device
+ phone
+ desktop
+)
+
+vala_finish(ayatana-indicator-bluetooth-service
+ SOURCES
+ project_VALA_SOURCES
+ OUTPUTS
+ project_VALA_C
+ GENERATE_HEADER
+ ${HEADER_PATH}
+ GENERATE_SYMBOLS
+ ${SYMBOLS_PATH}
+ GENERATE_VAPI
+ ${VAPI_PATH}
+)
+
+set_source_files_properties(
+ ${project_VALA_SOURCES}
+ PROPERTIES
+ HEADER_FILE_ONLY TRUE
+)
+
+set(
+ INDICATOR_BLUETOOTH_SOURCES
+ ${project_VALA_SOURCES}
+ ${project_VALA_C}
+ ${SYMBOLS_PATH}
+)
+
+###########################
+# Lib
+###########################
+
+add_definitions(
+ -w
+ -DG_LOG_DOMAIN="ayatana-indicator-bluetooth"
+)
+
+add_library(
+ ayatana-indicator-bluetooth-service-lib STATIC
+ ${INDICATOR_BLUETOOTH_SOURCES}
+)
+
+target_link_libraries(
+ ayatana-indicator-bluetooth-service-lib
+ ${BLUETOOTHSERVICE_LIBRARIES}
+ ${URLDISPATCHER_LIBRARIES}
+ -lm
+)
+
+###########################
+# Executable
+###########################
+
+include_directories(${CMAKE_BINARY_DIR})
+
+add_executable(
+ ayatana-indicator-bluetooth-service-bin
+ ${project_VALA_C}
+)
+
+set_target_properties(
+ ayatana-indicator-bluetooth-service-bin
+ PROPERTIES
+ OUTPUT_NAME "ayatana-indicator-bluetooth-service"
+)
+
+target_link_libraries(
+ ayatana-indicator-bluetooth-service-bin
+ ayatana-indicator-bluetooth-service-lib
+)
+
+###########################
+# Installation
+###########################
+
+install(
+ TARGETS ayatana-indicator-bluetooth-service-bin
+ RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/ayatana-indicator-bluetooth/
+)
+
+# coverage reporting
+set(COVERAGE_TARGETS
+ ${COVERAGE_TARGETS}
+ ayatana-indicator-bluetooth-service-lib
+ ayatana-indicator-bluetooth-service-bin
+ PARENT_SCOPE
+)
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644
index 44d6406..0000000
--- a/src/Makefile.am
+++ /dev/null
@@ -1,39 +0,0 @@
-pkglibexec_PROGRAMS = ayatana-indicator-bluetooth-service
-
-ayatana_indicator_bluetooth_service_SOURCES = \
- bluetooth.vala \
- bluez.vala \
- desktop.vala \
- device.vala \
- main.vala \
- phone.vala \
- profile.vala \
- killswitch.vala \
- service.vala
-
-ayatana_indicator_bluetooth_service_VALAFLAGS = \
- --ccode \
- --vapidir=$(top_srcdir)/vapi/ \
- --vapidir=./ \
- --pkg config \
- --pkg rfkill \
- --pkg url-dispatcher \
- --pkg posix \
- --pkg glib-2.0 \
- --pkg gio-2.0
-
-# -w to disable warnings for vala-generated code
-ayatana_indicator_bluetooth_service_CFLAGS = \
- -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
- -DLOCALE_DIR=\"$(datadir)/locale\" \
- -w \
- $(URL_DISPATCHER_CFLAGS) \
- $(SERVICE_DEPS_CFLAGS)
-
-ayatana_indicator_bluetooth_service_LDADD = \
- $(URL_DISPATCHER_LIBS) \
- $(SERVICE_DEPS_LIBS)
-
-CLEANFILES = \
- $(patsubst %.vala,%.c,$(filter %.vala, $(SOURCES))) \
- *_vala.stamp