From bfb679de31ba276e0155153fc3efff9b8aacbbf6 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 12 May 2021 13:27:15 +0200 Subject: Bring back GTK+-2.0 and GTK+-3.0 build flavours. --- CMakeLists.txt | 35 ++++++- data/CMakeLists.txt | 26 ++++-- data/ayatana-indicator.pc.in | 15 +++ data/ayatana-indicator3-0.4.pc.in | 15 --- data/ayatana-indicator3.pc.in | 15 +++ src/CMakeLists.txt | 50 +++++++--- tests/CMakeLists.txt | 190 +++++++++++--------------------------- tools/CMakeLists.txt | 19 ++-- 8 files changed, 186 insertions(+), 179 deletions(-) create mode 100644 data/ayatana-indicator.pc.in delete mode 100644 data/ayatana-indicator3-0.4.pc.in create mode 100644 data/ayatana-indicator3.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index e580790..7b509db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,11 +17,44 @@ endif() # Check for prerequisites -set(DEPS glib-2.0>=2.58 gtk+-3.0>=3.24 libayatana-ido3-0.4>=0.8.2) +option(FLAVOUR_GTK2 "Build against GTK+-2.0" OFF) +option(FLAVOUR_GTK3 "Build against GTK+-3.0" ON) + +if (FLAVOUR_GTK2) + set (FLAVOUR_GTK3 OFF) +endif() +if (FLAVOUR_GTK3) + set (FLAVOUR_GTK2 OFF) +endif() + +if (FLAVOUR_GTK3) + set(DEPS + glib-2.0>=2.37 + gtk+-3.0>=3.24 + gmodule-2.0 + gio-unix-2.0 + libayatana-ido3-0.4>=0.8.2 + ) +endif() +if (FLAVOUR_GTK2) + set(DEPS + glib-2.0>=2.37 + gtk+-2.0>=2.18 + gmodule-2.0 + gio-unix-2.0 + ) +endif() find_package (PkgConfig REQUIRED) pkg_check_modules(PROJECT_DEPS REQUIRED ${DEPS}) +include(CheckLibraryExists) + +CHECK_LIBRARY_EXISTS(m sin "" HAVE_LIB_M) +if (HAVE_LIB_M) + set(EXTRA_LIBS ${EXTRA_LIBS} m) +endif (HAVE_LIB_M) + # Set global variables include(GNUInstallDirs) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index f6c71d9..8e10313 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -1,12 +1,26 @@ # ayatana-indicator3-0.4.pc -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ayatana-indicator3-0.4.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator3-0.4.pc" @ONLY) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator3-0.4.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig/") +if (FLAVOUR_GTK3) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ayatana-indicator3.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator3-0.${API_VERSION}.pc" @ONLY) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator3-0.${API_VERSION}.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig/") +else() + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ayatana-indicator.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-0.${API_VERSION}.pc" @ONLY) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-0.${API_VERSION}.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig/") +endif() + +# ayatana-indicators.target (only required once, so let's do it with FLAVOUR_GTK3) + +if (FLAVOUR_GTK3) -# ayatana-indicators.target + pkg_check_modules(SYSTEMD systemd) -pkg_check_modules(SYSTEMD systemd) + if (${SYSTEMD_FOUND}) + if (${SYSTEMD_VERSION} VERSION_LESS 247) + set(SYSTEMD_USER_UNIT_DIR ${CMAKE_INSTALL_PREFIX}/lib/systemd/user) + else() + pkg_get_variable(SYSTEMD_USER_UNIT_DIR systemd systemd_user_unit_dir) + endif() + install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/ayatana-indicators.target" DESTINATION "${SYSTEMD_USER_UNIT_DIR}") + endif() -if (${SYSTEMD_FOUND}) - install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/ayatana-indicators.target" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/systemd/user") endif() diff --git a/data/ayatana-indicator.pc.in b/data/ayatana-indicator.pc.in new file mode 100644 index 0000000..e4f06a2 --- /dev/null +++ b/data/ayatana-indicator.pc.in @@ -0,0 +1,15 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ +bindir=${exec_prefix}/@CMAKE_INSTALL_BINDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ +indicatordir=${exec_prefix}/lib/ayatana-indicators/@ABI_VERSION@/ +iconsdir=${prefix}/@CMAKE_INSTALL_DATADIR@/@PROJECT_NAME@/icons/ + +Cflags: -I${includedir}/libayatana-indicator-0.@API_VERSION@ +Requires: gtk+-2.0 +Libs: -layatana-indicator + +Name: libayatana-indicator +Description: libayatana-indicator. +Version: @PROJECT_VERSION@ diff --git a/data/ayatana-indicator3-0.4.pc.in b/data/ayatana-indicator3-0.4.pc.in deleted file mode 100644 index 231fa71..0000000 --- a/data/ayatana-indicator3-0.4.pc.in +++ /dev/null @@ -1,15 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ -bindir=${exec_prefix}/@CMAKE_INSTALL_BINDIR@ -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ -indicatordir=${exec_prefix}/lib/ayatana-indicators3/@ABI_VERSION@/ -iconsdir=${prefix}/@CMAKE_INSTALL_DATADIR@/@PROJECT_NAME@/icons/ - -Cflags: -I${includedir}/libayatana-indicator3-0.@API_VERSION@ -Requires: gtk+-3.0 -Libs: -layatana-indicator3 - -Name: libayatana-indicator3 -Description: libayatana-indicator3. -Version: @PROJECT_VERSION@ diff --git a/data/ayatana-indicator3.pc.in b/data/ayatana-indicator3.pc.in new file mode 100644 index 0000000..231fa71 --- /dev/null +++ b/data/ayatana-indicator3.pc.in @@ -0,0 +1,15 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ +bindir=${exec_prefix}/@CMAKE_INSTALL_BINDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ +indicatordir=${exec_prefix}/lib/ayatana-indicators3/@ABI_VERSION@/ +iconsdir=${prefix}/@CMAKE_INSTALL_DATADIR@/@PROJECT_NAME@/icons/ + +Cflags: -I${includedir}/libayatana-indicator3-0.@API_VERSION@ +Requires: gtk+-3.0 +Libs: -layatana-indicator3 + +Name: libayatana-indicator3 +Description: libayatana-indicator3. +Version: @PROJECT_VERSION@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d6c6647..d396ed9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,22 +21,33 @@ set(HEADERS indicator-object.h indicator-service.h indicator-service-manager.h - indicator-ng.h ) +if (FLAVOUR_GTK3) + set(HEADERS + ${HEADERS} + indicator-ng.h + ) +endif() + set(SOURCES gen-indicator-service.xml.c indicator-desktop-shortcuts.c indicator-image-helper.c - indicator-ng.c indicator-object.c indicator-object-enum-types.c indicator-object-marshal.c indicator-service.c indicator-service-manager.c - ) +if (FLAVOUR_GTK3) + set(SOURCES + ${SOURCES} + indicator-ng.c + ) +endif() + # indicator-object-enum-types.h find_program(GLIB_MKENUMS glib-mkenums) @@ -111,17 +122,26 @@ string(PREPEND GEN_INDICATOR_SERVICE_XML_C "const char * _indicator_service = \n string(APPEND GEN_INDICATOR_SERVICE_XML_C "\;") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/gen-indicator-service.xml.c" ${GEN_INDICATOR_SERVICE_XML_C}) -# libayatana-indicator3.so + +if (FLAVOUR_GTK3) + # libayatana-indicator3.so + set (ayatana_indicator_gtkver "ayatana-indicator3") +else() + # libayatana-indicator.so + set (ayatana_indicator_gtkver "ayatana-indicator") +endif() + +# libayatana-indicator{,3}.so set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("ayatana-indicator3" SHARED ${SOURCES}) -set_target_properties("ayatana-indicator3" PROPERTIES VERSION 7.0.0 SOVERSION 7) -target_compile_definitions("ayatana-indicator3" PUBLIC DG_LOG_DOMAIN="libayatana-indicator") -target_include_directories("ayatana-indicator3" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("ayatana-indicator3" PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -target_include_directories("ayatana-indicator3" PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) -target_link_libraries("ayatana-indicator3" ${PROJECT_DEPS_LIBRARIES}) -add_dependencies("ayatana-indicator3" "src-generated") -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libayatana-indicator3.so" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libayatana-indicator3.so.7" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libayatana-indicator3.so.7.0.0" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") +add_library("${ayatana_indicator_gtkver}" SHARED ${SOURCES}) +set_target_properties("${ayatana_indicator_gtkver}" PROPERTIES VERSION ${ABI_VERSION}.0.0 SOVERSION ${ABI_VERSION}) +target_compile_definitions("${ayatana_indicator_gtkver}" PUBLIC DG_LOG_DOMAIN="libayatana-indicator") +target_include_directories("${ayatana_indicator_gtkver}" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) +target_include_directories("${ayatana_indicator_gtkver}" PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories("${ayatana_indicator_gtkver}" PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries("${ayatana_indicator_gtkver}" ${PROJECT_DEPS_LIBRARIES} ${EXTRA_LIBS}) +add_dependencies("${ayatana_indicator_gtkver}" "src-generated") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lib${ayatana_indicator_gtkver}.so" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lib${ayatana_indicator_gtkver}.so.${ABI_VERSION}" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lib${ayatana_indicator_gtkver}.so.${ABI_VERSION}.0.0" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bb9c0f4..4c24321 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,121 +1,39 @@ -# dummy-indicator-blank - -set_source_files_properties(dummy-indicator-blank.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("dummy-indicator-blank" SHARED dummy-indicator-blank.c) -target_include_directories("dummy-indicator-blank" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("dummy-indicator-blank" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# dummy-indicator-entry-func - -set_source_files_properties(dummy-indicator-entry-func.h PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("dummy-indicator-entry-func" SHARED dummy-indicator-entry-func.c) -target_include_directories("dummy-indicator-entry-func" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("dummy-indicator-entry-func" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# dummy-indicator-null - -set_source_files_properties(dummy-indicator-null.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("dummy-indicator-null" SHARED dummy-indicator-null.c) -target_include_directories("dummy-indicator-null" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("dummy-indicator-null" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# dummy-indicator-signaller - -set_source_files_properties(dummy-indicator-signaler.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("dummy-indicator-signaler" SHARED dummy-indicator-signaler.c) -target_include_directories("dummy-indicator-signaler" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("dummy-indicator-signaler" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# dummy-indicator-simple - -set_source_files_properties(dummy-indicator-simple.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("dummy-indicator-simple" SHARED dummy-indicator-simple.c) -target_include_directories("dummy-indicator-simple" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("dummy-indicator-simple" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# dummy-indicator-visible - -set_source_files_properties(dummy-indicator-visible.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("dummy-indicator-visible" SHARED dummy-indicator-visible.c) -target_include_directories("dummy-indicator-visible" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("dummy-indicator-visible" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# service-manager-connect - -set_source_files_properties(service-manager-connect.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("service-manager-connect" SHARED service-manager-connect.c) -target_include_directories("service-manager-connect" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("service-manager-connect" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# service-manager-connect-service - -set_source_files_properties(service-manager-connect-service.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("service-manager-connect-service" SHARED service-manager-connect-service.c) -target_include_directories("service-manager-connect-service" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("service-manager-connect-service" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# service-manager-no-connect - -set_source_files_properties(service-manager-no-connect.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("service-manager-no-connect" SHARED service-manager-no-connect.c) -target_include_directories("service-manager-no-connect" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("service-manager-no-connect" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# service-manager-nostart-connect - -set_source_files_properties(service-manager-nostart-connect.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("service-manager-nostart-connect" SHARED service-manager-nostart-connect.c) -target_include_directories("service-manager-nostart-connect" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("service-manager-nostart-connect" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# service-shutdown-timeout - -set_source_files_properties(service-shutdown-timeout.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("service-shutdown-timeout" SHARED service-shutdown-timeout.c) -target_include_directories("service-shutdown-timeout" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("service-shutdown-timeout" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# service-version-bad-service - -set_source_files_properties(service-version-bad-service.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("service-version-bad-service" SHARED service-version-bad-service.c) -target_include_directories("service-version-bad-service" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("service-version-bad-service" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# service-version-good-service - -set_source_files_properties(service-version-good-service.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("service-version-good-service" SHARED service-version-good-service.c) -target_include_directories("service-version-good-service" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("service-version-good-service" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# service-version-manager - -set_source_files_properties(service-version-manager.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("service-version-manager" SHARED service-version-manager.c) -target_include_directories("service-version-manager" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("service-version-manager" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# service-version-multiwatch-manager - -set_source_files_properties(service-version-multiwatch-manager.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("service-version-multiwatch-manager" SHARED service-version-multiwatch-manager.c) -target_include_directories("service-version-multiwatch-manager" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("service-version-multiwatch-manager" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# service-version-multiwatch-manager-impolite - -set_source_files_properties(service-version-multiwatch-manager-impolite.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("service-version-multiwatch-manager-impolite" SHARED service-version-multiwatch-manager-impolite.c) -target_include_directories("service-version-multiwatch-manager-impolite" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("service-version-multiwatch-manager-impolite" PUBLIC "${CMAKE_SOURCE_DIR}/src") - -# service-version-multiwatch-service - -set_source_files_properties(service-version-multiwatch-service.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_library("service-version-multiwatch-service" SHARED service-version-multiwatch-service.c) -target_include_directories("service-version-multiwatch-service" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("service-version-multiwatch-service" PUBLIC "${CMAKE_SOURCE_DIR}/src") +if (FLAVOUR_GTK3) + # libayatana-indicator3.so + set (ayatana_indicator_gtkver "ayatana-indicator3") +else() + # libayatana-indicator.so + set (ayatana_indicator_gtkver "ayatana-indicator") +endif() + +function(add_test_helper_by_name name) + set (TEST_HELPER_NAME ${name}) + set_source_files_properties(${TEST_HELPER_NAME}.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) + add_library("${TEST_HELPER_NAME}" SHARED ${TEST_HELPER_NAME}.c) + target_include_directories("${TEST_HELPER_NAME}" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) + target_include_directories("${TEST_HELPER_NAME}" PUBLIC "${CMAKE_SOURCE_DIR}/src") + target_link_libraries("${TEST_HELPER_NAME}" ${PROJECT_DEPS_LIBRARIES} -l${ayatana_indicator_gtkver}) + target_link_directories("${TEST_HELPER_NAME}" PUBLIC "${CMAKE_BINARY_DIR}/src") + add_dependencies("${TEST_HELPER_NAME}" "${ayatana_indicator_gtkver}") +endfunction() + +add_test_helper_by_name(dummy-indicator-blank) +add_test_helper_by_name(dummy-indicator-entry-func) +add_test_helper_by_name(dummy-indicator-null) +add_test_helper_by_name(dummy-indicator-signaler) +add_test_helper_by_name(dummy-indicator-simple) +add_test_helper_by_name(dummy-indicator-visible) +add_test_helper_by_name(service-manager-connect) +add_test_helper_by_name(service-manager-connect-service) +add_test_helper_by_name(service-manager-no-connect) +add_test_helper_by_name(service-manager-nostart-connect) +add_test_helper_by_name(service-shutdown-timeout) +add_test_helper_by_name(service-version-bad-service) +add_test_helper_by_name(service-version-good-service) +add_test_helper_by_name(service-version-manager) +add_test_helper_by_name(service-version-multiwatch-manager) +add_test_helper_by_name(service-version-multiwatch-manager-impolite) +add_test_helper_by_name(service-version-multiwatch-service) # test-desktop-shortcuts @@ -125,24 +43,11 @@ target_compile_definitions("test-desktop-shortcuts" PUBLIC BUILD_DIR="${CMAKE_CU target_compile_definitions("test-desktop-shortcuts" PUBLIC SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories("test-desktop-shortcuts" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) target_include_directories("test-desktop-shortcuts" PUBLIC "${CMAKE_SOURCE_DIR}/src") -target_link_libraries("test-desktop-shortcuts" ${PROJECT_DEPS_LIBRARIES} -layatana-indicator3) +target_link_libraries("test-desktop-shortcuts" ${PROJECT_DEPS_LIBRARIES} -l${ayatana_indicator_gtkver}) target_link_directories("test-desktop-shortcuts" PUBLIC "${CMAKE_BINARY_DIR}/src") -add_dependencies("test-desktop-shortcuts" "ayatana-indicator3") +add_dependencies("test-desktop-shortcuts" "${ayatana_indicator_gtkver}") add_test("test-desktop-shortcuts" "test-desktop-shortcuts") -# test-indicator-ng - -set_source_files_properties(test-indicator-ng.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_executable("test-indicator-ng" test-indicator-ng.c) -target_compile_definitions("test-indicator-ng" PUBLIC BUILD_DIR="${CMAKE_CURRENT_BINARY_DIR}") -target_compile_definitions("test-indicator-ng" PUBLIC SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}") -target_include_directories("test-indicator-ng" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("test-indicator-ng" PUBLIC "${CMAKE_SOURCE_DIR}/src") -target_link_libraries("test-indicator-ng" ${PROJECT_DEPS_LIBRARIES} -layatana-indicator3) -target_link_directories("test-indicator-ng" PUBLIC "${CMAKE_BINARY_DIR}/src") -add_dependencies("test-indicator-ng" "ayatana-indicator3") -add_test("test-indicator-ng" "test-indicator-ng") - # test-loader set_source_files_properties(test-loader.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) @@ -150,7 +55,22 @@ add_executable("test-loader" test-loader.c) target_compile_definitions("test-loader" PUBLIC BUILD_DIR="${CMAKE_CURRENT_BINARY_DIR}") target_include_directories("test-loader" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) target_include_directories("test-loader" PUBLIC "${CMAKE_SOURCE_DIR}/src") -target_link_libraries("test-loader" ${PROJECT_DEPS_LIBRARIES} -layatana-indicator3) +target_link_libraries("test-loader" ${PROJECT_DEPS_LIBRARIES} -l${ayatana_indicator_gtkver}) target_link_directories("test-loader" PUBLIC "${CMAKE_BINARY_DIR}/src") -add_dependencies("test-loader" "ayatana-indicator3") +add_dependencies("test-loader" "${ayatana_indicator_gtkver}") add_test("test-loader" "test-loader") + +# test-indicator-ng + +if (FLAVOUR_GTK3) + set_source_files_properties(test-indicator-ng.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) + add_executable("test-indicator-ng" test-indicator-ng.c) + target_compile_definitions("test-indicator-ng" PUBLIC BUILD_DIR="${CMAKE_CURRENT_BINARY_DIR}") + target_compile_definitions("test-indicator-ng" PUBLIC SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}") + target_include_directories("test-indicator-ng" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) + target_include_directories("test-indicator-ng" PUBLIC "${CMAKE_SOURCE_DIR}/src") + target_link_libraries("test-indicator-ng" ${PROJECT_DEPS_LIBRARIES} -l${ayatana_indicator_gtkver}) + target_link_directories("test-indicator-ng" PUBLIC "${CMAKE_BINARY_DIR}/src") + add_dependencies("test-indicator-ng" "${ayatana_indicator_gtkver}") + add_test("test-indicator-ng" "test-indicator-ng") +endif() diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 4120f31..3be325d 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,8 +1,13 @@ -# ayatana-indicator-loader3 +if (FLAVOUR_GTK3) + # ayatana-indicator-loader3 -set_source_files_properties(indicator-loader.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_executable("ayatana-indicator-loader3" indicator-loader.c) -target_include_directories("ayatana-indicator-loader3" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("ayatana-indicator-loader3" PUBLIC "${CMAKE_SOURCE_DIR}/src") -target_link_libraries("ayatana-indicator-loader3" ${PROJECT_DEPS_LIBRARIES} "-L${CMAKE_BINARY_DIR}/src" -layatana-indicator3) -add_dependencies("ayatana-indicator-loader3" "ayatana-indicator3") + set_source_files_properties(indicator-loader.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) + add_executable("ayatana-indicator-loader3" indicator-loader.c) + target_include_directories("ayatana-indicator-loader3" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) + target_include_directories("ayatana-indicator-loader3" PUBLIC "${CMAKE_SOURCE_DIR}/src") + target_link_libraries("ayatana-indicator-loader3" ${PROJECT_DEPS_LIBRARIES} "-L${CMAKE_BINARY_DIR}/src" -layatana-indicator3) + add_dependencies("ayatana-indicator-loader3" "ayatana-indicator3") + + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-loader3" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME}") + install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/80indicator-debugging" DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}") +endif() -- cgit v1.2.3