From e672e51267ff87405700cbb80807aa6a678a06a5 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sun, 25 Oct 2020 23:31:54 +0100 Subject: Port from autotools to CMake. --- src/CMakeLists.txt | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 src/CMakeLists.txt (limited to 'src/CMakeLists.txt') 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 +) -- cgit v1.2.3