aboutsummaryrefslogtreecommitdiff
path: root/bindings
diff options
context:
space:
mode:
Diffstat (limited to 'bindings')
-rw-r--r--bindings/CMakeLists.txt2
-rw-r--r--bindings/mono/CMakeLists.txt203
-rw-r--r--bindings/mono/examples/CMakeLists.txt20
-rw-r--r--bindings/vala/CMakeLists.txt29
-rw-r--r--bindings/vala/examples/CMakeLists.txt27
5 files changed, 281 insertions, 0 deletions
diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt
new file mode 100644
index 0000000..b4fa5de
--- /dev/null
+++ b/bindings/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_subdirectory(vala)
+add_subdirectory(mono)
diff --git a/bindings/mono/CMakeLists.txt b/bindings/mono/CMakeLists.txt
new file mode 100644
index 0000000..2a9d990
--- /dev/null
+++ b/bindings/mono/CMakeLists.txt
@@ -0,0 +1,203 @@
+# ayatana-appindicator-sharp3-0.1.pc
+
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ayatana-appindicator-sharp3-0.1.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/ayatana-appindicator-sharp3-0.1.pc" @ONLY)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ayatana-appindicator-sharp3-0.1.pc" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig")
+
+# ayatana-appindicator-sharp.dll.config
+
+file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/ayatana-appindicator-sharp.dll.config" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/ayatana-appindicator-sharp.dll.config" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cli/ayatana-appindicator-sharp3-0.1")
+
+# app-indicator.sources.xml
+
+file(RELATIVE_PATH REL_BIN ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR})
+file(RELATIVE_PATH REL_SRC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/app-indicator.sources.xml.in" "${CMAKE_CURRENT_BINARY_DIR}/app-indicator.sources.xml" @ONLY)
+
+# libayatana-appindicator-api.raw
+
+find_program(GAPI3_PARSER gapi3-parser)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libayatana-appindicator-api.raw"
+ DEPENDS "src" "${CMAKE_CURRENT_BINARY_DIR}/app-indicator.sources.xml"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND
+ ${GAPI3_PARSER}
+ "${CMAKE_CURRENT_BINARY_DIR}/app-indicator.sources.xml"
+)
+
+# libayatana-appindicator-api.middle
+
+find_program(GAPI3_FIXUP gapi3-fixup)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libayatana-appindicator-api.middle"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libayatana-appindicator-api.raw"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND
+ ${CMAKE_COMMAND}
+ -E copy
+ "${CMAKE_CURRENT_BINARY_DIR}/libayatana-appindicator-api.raw"
+ "${CMAKE_CURRENT_BINARY_DIR}/libayatana-appindicator-api.middle"
+ COMMAND
+ ${GAPI3_FIXUP}
+ --api=libayatana-appindicator-api.middle
+ --metadata="${CMAKE_CURRENT_SOURCE_DIR}/libayatana-appindicator-api.metadata"
+)
+
+# libayatana-appindicator-api.xml
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libayatana-appindicator-api.xml"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libayatana-appindicator-api.middle"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ VERBATIM
+ COMMAND
+ sed
+ -e "s|PROP_ID_S|id|"
+ -e "s|PROP_STATUS_S|Status|"
+ -e "s|PROP_STATUS_S|status|"
+ -e "s|PROP_CATEGORY_S|Category|"
+ -e "s|PROP_CATEGORY_S|category|"
+ -e "s|PROP_ICON_NAME_S|icon-name|"
+ -e "s|PROP_ICON_DESC_S|IconDesc|"
+ -e "s|PROP_ICON_DESC_S|icon-desc|"
+ -e "s|PROP_ATTENTION_ICON_NAME_S|AttentionIconName|"
+ -e "s|PROP_ATTENTION_ICON_NAME_S|attention-icon-name|"
+ -e "s|PROP_ATTENTION_ICON_DESC_S|AttentionIconDesc|"
+ -e "s|PROP_ATTENTION_ICON_DESC_S|attention-icon-desc|"
+ -e "s|PROP_ICON_THEME_PATH_S|icon-theme-path|"
+ -e "s|PROP_MENU_S|menu|"
+ -e "s|PROP_CONNECTED_S|connected|"
+ -e "s|PROP_LABEL_S|label|"
+ -e "s|PROP_LABEL_GUIDE_S|label-guide|"
+ -e "s|PROP_ORDERING_INDEX_S|ordering-index|"
+ -e "s|PROP_DBUS_MENU_SERVER_S|DbusMenuServer|"
+ -e "s|PROP_DBUS_MENU_SERVER_S|dbus-menu-server|"
+ -e "s|PROP_TITLE_S|Title|"
+ -e "s|PROP_TITLE_S|title|"
+ "${CMAKE_CURRENT_BINARY_DIR}/libayatana-appindicator-api.middle" > "${CMAKE_CURRENT_BINARY_DIR}/libayatana-appindicator-api.xml"
+)
+
+# AppIndicatorCategory.cs
+# NewAttentionIconHandler.cs
+# NewStatusHandler.cs
+# AppIndicatorStatus.cs
+# NewIconHandler.cs
+# ObjectManager.cs
+# ApplicationIndicator.cs
+# NewIconThemePathHandler.cs
+# ScrollEventHandler.cs
+# ConnectionChangedHandler.cs
+# NewLabelHandler.cs
+
+pkg_check_modules(GTK_SHARP_3_0 REQUIRED gtk-sharp-3.0>=2.99)
+string(REPLACE ":" ";-I:" GTK_SHARP_3_0_INCLUDE_DIRS ${GTK_SHARP_3_0_INCLUDE_DIRS})
+find_program(GAPI3_CODEGEN gapi3-codegen)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/GtkSharp/ObjectManager.cs"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/AppIndicatorCategory.cs"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/NewAttentionIconHandler.cs"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/NewStatusHandler.cs"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/AppIndicatorStatus.cs"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/NewIconHandler.cs"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/ApplicationIndicator.cs"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/NewIconThemePathHandler.cs"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/ScrollEventHandler.cs"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/ConnectionChangedHandler.cs"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/NewLabelHandler.cs"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libayatana-appindicator-api.xml"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND
+ ${GAPI3_CODEGEN}
+ --generate libayatana-appindicator-api.xml
+ --outdir=${CMAKE_CURRENT_BINARY_DIR}
+ --assembly-name=ayatana-appindicator-sharp
+ ${GTK_SHARP_3_0_INCLUDE_DIRS}
+)
+
+# ayatana-appindicator-sharp.dll
+
+pkg_check_modules(MONO REQUIRED mono>=5.18)
+find_program(MCS mcs)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ayatana-appindicator-sharp.dll"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/GtkSharp/ObjectManager.cs"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/AppIndicatorCategory.cs"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/NewAttentionIconHandler.cs"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/NewStatusHandler.cs"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/AppIndicatorStatus.cs"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/NewIconHandler.cs"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/ApplicationIndicator.cs"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/NewIconThemePathHandler.cs"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/ScrollEventHandler.cs"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/ConnectionChangedHandler.cs"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/NewLabelHandler.cs"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND
+ ${MCS}
+ -keyfile:"${CMAKE_CURRENT_SOURCE_DIR}/ayatana-appindicator-sharp.snk"
+ -nowarn:0169,0612,0618
+ -unsafe
+ -out:"${CMAKE_CURRENT_BINARY_DIR}/ayatana-appindicator-sharp.dll"
+ -target:library
+ ${GTK_SHARP_3_0_LDFLAGS} "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator/*.cs" "${CMAKE_CURRENT_BINARY_DIR}/GtkSharp/ObjectManager.cs" "${CMAKE_CURRENT_SOURCE_DIR}/AssemblyInfo.cs" "${CMAKE_CURRENT_SOURCE_DIR}/ApplicationIndicatorCustom.cs"
+)
+
+find_program(GACUTIL gacutil)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ayatana-appindicator-sharp.dll" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cli/ayatana-appindicator-sharp3-0.1")
+install(CODE "execute_process(WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${GACUTIL} -i ${CMAKE_CURRENT_BINARY_DIR}/ayatana-appindicator-sharp.dll -package ayatana-appindicator-sharp -root ${CMAKE_INSTALL_FULL_LIBDIR})")
+
+# policy.0.0.ayatana-appindicator-sharp.config
+
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/policy.0.0.ayatana-appindicator-sharp.config.in" "${CMAKE_CURRENT_BINARY_DIR}/policy.0.0.ayatana-appindicator-sharp.config" @ONLY)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/policy.0.0.ayatana-appindicator-sharp.config" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cli/ayatana-appindicator-sharp3-0.1")
+
+# policy.0.0.ayatana-appindicator-sharp.dll
+
+find_program(AL al)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/policy.0.0.ayatana-appindicator-sharp.dll"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/ayatana-appindicator-sharp.dll"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND
+ ${AL}
+ -link:"${CMAKE_CURRENT_BINARY_DIR}/policy.0.0.ayatana-appindicator-sharp.config"
+ -out:"${CMAKE_CURRENT_BINARY_DIR}/policy.0.0.ayatana-appindicator-sharp.dll"
+ -keyfile:"${CMAKE_CURRENT_SOURCE_DIR}/ayatana-appindicator-sharp.snk"
+)
+
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/policy.0.0.ayatana-appindicator-sharp.dll" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cli/ayatana-appindicator-sharp3-0.1")
+install(CODE "execute_process(WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${GACUTIL} -i ${CMAKE_CURRENT_BINARY_DIR}/policy.0.0.ayatana-appindicator-sharp.dll -package ayatana-appindicator-sharp -root ${CMAKE_INSTALL_FULL_LIBDIR})")
+
+# policy.0.1.ayatana-appindicator-sharp.config
+
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/policy.0.1.ayatana-appindicator-sharp.config.in" "${CMAKE_CURRENT_BINARY_DIR}/policy.0.1.ayatana-appindicator-sharp.config" @ONLY)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/policy.0.1.ayatana-appindicator-sharp.config" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cli/ayatana-appindicator-sharp3-0.1")
+
+# policy.0.1.ayatana-appindicator-sharp.dll
+
+find_program(AL al)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/policy.0.1.ayatana-appindicator-sharp.dll"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/policy.0.0.ayatana-appindicator-sharp.dll"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND
+ ${AL}
+ -link:"${CMAKE_CURRENT_BINARY_DIR}/policy.0.1.ayatana-appindicator-sharp.config"
+ -out:"${CMAKE_CURRENT_BINARY_DIR}/policy.0.1.ayatana-appindicator-sharp.dll"
+ -keyfile:"${CMAKE_CURRENT_SOURCE_DIR}/ayatana-appindicator-sharp.snk"
+)
+
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/policy.0.1.ayatana-appindicator-sharp.dll" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cli/ayatana-appindicator-sharp3-0.1")
+
+add_custom_target("bindings-mono" ALL DEPENDS "policy.0.1.ayatana-appindicator-sharp.dll")
+
+if (ENABLE_TESTS)
+ add_subdirectory(examples)
+endif()
diff --git a/bindings/mono/examples/CMakeLists.txt b/bindings/mono/examples/CMakeLists.txt
new file mode 100644
index 0000000..431a654
--- /dev/null
+++ b/bindings/mono/examples/CMakeLists.txt
@@ -0,0 +1,20 @@
+# ayatana-indicator-example
+
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ayatana-indicator-example.in" "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-example" @ONLY)
+
+# AyatanaIndicatorExample.exe
+
+find_program(MONO mono)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIndicatorExample.exe"
+ DEPENDS "bindings-mono"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND
+ ${MCS}
+ -out:"${CMAKE_CURRENT_BINARY_DIR}/AyatanaIndicatorExample.exe"
+ -target:exe
+ ${GTK_SHARP_3_0_LDFLAGS} "-r:${CMAKE_BINARY_DIR}/bindings/mono/ayatana-appindicator-sharp.dll" "${CMAKE_CURRENT_SOURCE_DIR}/AyatanaIndicatorExample.cs"
+)
+
+add_custom_target("bindings-mono-examples" ALL DEPENDS "AyatanaIndicatorExample.exe")
diff --git a/bindings/vala/CMakeLists.txt b/bindings/vala/CMakeLists.txt
new file mode 100644
index 0000000..6d0aa5d
--- /dev/null
+++ b/bindings/vala/CMakeLists.txt
@@ -0,0 +1,29 @@
+# ayatana-appindicator3-0.1.deps
+
+install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/ayatana-appindicator3-0.1.deps" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/vala/vapi")
+
+# AyatanaAppIndicator3-0.1.vala
+
+find_package(Vala REQUIRED QUIET)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator3-0.1.vala"
+ DEPENDS "src" "${CMAKE_BINARY_DIR}/src/AyatanaAppIndicator3-0.1.typelib"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND
+ ${VAPI_GEN}
+ --library=ayatana-appindicator3-0.1
+ --pkg gtk+-3.0
+ --girdir="${CMAKE_SOURCE_DIR}/src"
+ --metadatadir "${CMAKE_SOURCE_DIR}/src"
+ "${CMAKE_BINARY_DIR}/src/AyatanaAppIndicator3-0.1.gir"
+ "${CMAKE_CURRENT_SOURCE_DIR}/ayatana-appindicator-0.1-custom.vala"
+)
+
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ayatana-appindicator3-0.1.vapi" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/vala/vapi")
+
+add_custom_target("bindings-vala" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicator3-0.1.vala")
+
+if (ENABLE_TESTS)
+ add_subdirectory(examples)
+endif()
diff --git a/bindings/vala/examples/CMakeLists.txt b/bindings/vala/examples/CMakeLists.txt
new file mode 100644
index 0000000..f393939
--- /dev/null
+++ b/bindings/vala/examples/CMakeLists.txt
@@ -0,0 +1,27 @@
+# ayatana-indicator-example.c
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-example.c"
+ DEPENDS "bindings-vala"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMAND
+ ${VALA_COMPILER}
+ --pkg ayatana-appindicator3-0.1
+ --pkg gtk+-3.0
+ --vapidir=${CMAKE_BINARY_DIR}/bindings/vala
+ -C ayatana-indicator-example.vala
+ --metadatadir "${CMAKE_SOURCE_DIR}/src"
+ --directory=${CMAKE_CURRENT_BINARY_DIR}
+ VERBATIM
+ COMMAND
+ sed
+ -i "s|#include\\s*<\\s*libayatana-appindicator/app-indicator.h\\s*>||g"
+ "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-example.c"
+)
+
+# ayatana-indicator-example
+
+set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-example.c" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -include ${CMAKE_SOURCE_DIR}/src/app-indicator.h")
+add_executable("ayatana-indicator-example" "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-example.c")
+target_include_directories("ayatana-indicator-example" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
+target_link_libraries("ayatana-indicator-example" "${PROJECT_DEPS_LIBRARIES} -layatana-appindicator3 -L${CMAKE_BINARY_DIR}/src")