aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-03-04 22:46:49 +0100
committerRobert Tari <robert@tari.in>2021-05-06 23:08:48 +0200
commit5f5d6d713e353488085ad2bd5eeaa07881e3fdc9 (patch)
treeb9a411131aa6843a08306294f508458c47d73de9
parent65be49deecac3b6790ca709dfbf75af55b7861fb (diff)
downloadayatana-indicator-application-5f5d6d713e353488085ad2bd5eeaa07881e3fdc9.tar.gz
ayatana-indicator-application-5f5d6d713e353488085ad2bd5eeaa07881e3fdc9.tar.bz2
ayatana-indicator-application-5f5d6d713e353488085ad2bd5eeaa07881e3fdc9.zip
Add CMakeLists.txt files
-rw-r--r--CMakeLists.txt55
-rw-r--r--data/CMakeLists.txt19
-rw-r--r--src/CMakeLists.txt112
3 files changed, 186 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..dfc1576
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,55 @@
+cmake_minimum_required(VERSION 3.13)
+project(ayatana-appindicator-application C)
+
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ SET(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE)
+endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+
+option(ENABLE_TESTS "Enable all tests and checks" OFF)
+option(ENABLE_COVERAGE "Enable coverage reports (includes enabling all tests and checks)" OFF)
+
+if(ENABLE_COVERAGE)
+ set(ENABLE_TESTS ON)
+ set(CMAKE_BUILD_TYPE "Coverage")
+else()
+ set(CMAKE_BUILD_TYPE "Release")
+endif()
+
+# Check for prerequisites
+
+set(CMAKE_BUILD_TYPE "Release")
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(PROJECT_DEPS REQUIRED glib-2.0>=2.58 ayatana-indicator3-0.4>=0.6.2 gtk+-3.0>=3.24 ayatana-appindicator3-0.1>=0.5.3 dbus-glib-1>=0.110 dbusmenu-gtk3-0.4)
+
+# Set global variables
+
+include(GNUInstallDirs)
+set(PROJECT_VERSION "0.8.0")
+set(PROJECT_NAME "ayatana-appindicator-application")
+
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+
+ set(COMPILE_FLAGS "${COMPILE_FLAGS} -Weverything")
+ set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-c++98-compat -Wno-padded")
+ set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-documentation")
+
+else()
+
+ set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall")
+
+endif()
+
+# Make everything
+
+add_subdirectory(data)
+add_subdirectory(src)
+
+if (ENABLE_TESTS)
+ include(CTest)
+ enable_testing()
+endif()
+
+# Display config info
+
+message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
+message(STATUS "Unit tests: ${ENABLE_TESTS}")
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
new file mode 100644
index 0000000..123c63e
--- /dev/null
+++ b/data/CMakeLists.txt
@@ -0,0 +1,19 @@
+# ayatana-indicator-application.service
+
+pkg_check_modules(SYSTEMD systemd)
+
+if (${SYSTEMD_FOUND})
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ayatana-indicator-application.service.in" "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-application.service" @ONLY)
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-application.service" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/systemd/user")
+endif()
+
+# ayatana-indicator-application.desktop
+
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ayatana-indicator-application.desktop.in" "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-application.desktop" @ONLY)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-application.desktop" DESTINATION "${CMAKE_INSTALL_PREFIX}/etc/xdg/autostart")
+
+# ordering-override.keyfile
+
+install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/ordering-override.keyfile" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/ayatana-indicator-application")
+
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..e328688
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,112 @@
+# gen-ayatana-application-service.xml.h
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/gen-ayatana-application-service.xml.h" "extern const char * _ayatana_application_service;")
+
+# gen-ayatana-application-service.xml.c
+
+file(READ "${CMAKE_CURRENT_SOURCE_DIR}/ayatana-application-service.xml" GEN_AYATANA_APPLICATION_SERVICE_XML_C)
+string(REPLACE "\"" "\\\"" GEN_AYATANA_APPLICATION_SERVICE_XML_C ${GEN_AYATANA_APPLICATION_SERVICE_XML_C})
+string(REPLACE "\n" "\\n\"\n\"" GEN_AYATANA_APPLICATION_SERVICE_XML_C ${GEN_AYATANA_APPLICATION_SERVICE_XML_C})
+string(REGEX REPLACE "\n\"$" "\n" GEN_AYATANA_APPLICATION_SERVICE_XML_C ${GEN_AYATANA_APPLICATION_SERVICE_XML_C})
+string(PREPEND GEN_AYATANA_APPLICATION_SERVICE_XML_C "const char * _ayatana_application_service = \n\"")
+string(APPEND GEN_AYATANA_APPLICATION_SERVICE_XML_C "\;")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/gen-ayatana-application-service.xml.c" ${GEN_AYATANA_APPLICATION_SERVICE_XML_C})
+
+# ayatana-application-service-marshal.h
+
+find_program(GLIB_GENMARSHAL glib-genmarshal)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ayatana-application-service-marshal.h"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMAND
+ ${GLIB_GENMARSHAL}
+ --prefix=_ayatana_application_service_marshal
+ --header ayatana-application-service-marshal.list
+ --quiet
+ --output="${CMAKE_CURRENT_BINARY_DIR}/ayatana-application-service-marshal.h"
+)
+
+# ayatana-application-service-marshal.c
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ayatana-application-service-marshal.c"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/ayatana-application-service-marshal.h"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMAND
+ ${GLIB_GENMARSHAL}
+ --prefix=_ayatana_application_service_marshal
+ --body ayatana-application-service-marshal.list
+ --include-header=ayatana-application-service-marshal.h
+ --quiet
+ --output="${CMAKE_CURRENT_BINARY_DIR}/ayatana-application-service-marshal.c"
+)
+
+# ayatana-notification-watcher-server.h
+
+find_program(DBUS_BINDING_TOOL dbus-binding-tool)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ayatana-notification-watcher-server.h"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/ayatana-application-service-marshal.c"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMAND
+ ${DBUS_BINDING_TOOL}
+ --prefix=_ayatana_notification_watcher_server
+ --mode=glib-server
+ --output="${CMAKE_CURRENT_BINARY_DIR}/ayatana-notification-watcher-server.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/ayatana-notification-watcher.xml"
+)
+
+# ayatana-notification-watcher-client.h
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ayatana-notification-watcher-client.h"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/ayatana-notification-watcher-server.h"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMAND
+ ${DBUS_BINDING_TOOL}
+ --prefix=_ayatana_notification_watcher_client
+ --mode=glib-client
+ --output="${CMAKE_CURRENT_BINARY_DIR}/ayatana-notification-watcher-client.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/ayatana-notification-watcher.xml"
+)
+
+add_custom_target("src-generated" DEPENDS "ayatana-notification-watcher-client.h")
+
+# libayatana-application.so
+
+set(SOURCES
+ ayatana-application-service-marshal.c
+ indicator-application.c
+)
+
+set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
+add_library("ayatana-application" SHARED ${SOURCES})
+target_compile_definitions("ayatana-application" PUBLIC G_LOG_DOMAIN="Ayatana-Indicator-Application")
+target_include_directories("ayatana-application" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
+target_include_directories("ayatana-application" PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
+target_link_libraries("ayatana-application" ${PROJECT_DEPS_LIBRARIES})
+add_dependencies("ayatana-application" "src-generated")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libayatana-application.so" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/ayatana-indicators3/7")
+
+# ayatana-indicator-application-service
+
+set(SOURCES
+ application-service.c
+ application-service-appstore.c
+ ayatana-application-service-marshal.c
+ application-service-watcher.c
+ gen-ayatana-application-service.xml.c
+ generate-id.c
+)
+
+set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
+add_executable("ayatana-indicator-application-service" ${SOURCES})
+target_compile_definitions("ayatana-indicator-application-service" PUBLIC DATADIR="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/ayatana-indicator-application")
+target_compile_definitions("ayatana-indicator-application-service" PUBLIC G_LOG_DOMAIN="ayatana-indicator-application-service")
+target_include_directories("ayatana-indicator-application-service" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
+target_include_directories("ayatana-indicator-application-service" PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
+target_link_libraries("ayatana-indicator-application-service" ${PROJECT_DEPS_LIBRARIES})
+add_dependencies("ayatana-indicator-application-service" "ayatana-application")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-application-service" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}/ayatana-indicator-application")