aboutsummaryrefslogtreecommitdiff
path: root/bindings/vala
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-06-10 22:01:16 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-06-10 22:01:16 +0200
commit80245fc04e09148863c493af860a6b2710909888 (patch)
treeb12c83377af5017dcb2aa63cfc760209c279dc4e /bindings/vala
parent31484851efadc92f86fb117dcf9b6c81b053de10 (diff)
parentfd8225ec3949f2e94ea8278563c7fdbe427617c7 (diff)
downloadlibayatana-appindicator-80245fc04e09148863c493af860a6b2710909888.tar.gz
libayatana-appindicator-80245fc04e09148863c493af860a6b2710909888.tar.bz2
libayatana-appindicator-80245fc04e09148863c493af860a6b2710909888.zip
Merge branch 'tari01-pr/move-to-cmake'
Attributes GH PR #16: https://github.com/AyatanaIndicators/libayatana-appindicator/pull/16
Diffstat (limited to 'bindings/vala')
-rw-r--r--bindings/vala/CMakeLists.txt29
-rw-r--r--bindings/vala/Makefile.am41
-rw-r--r--bindings/vala/ayatana-appindicator3-0.1.deps3
-rw-r--r--bindings/vala/examples/CMakeLists.txt27
-rw-r--r--bindings/vala/examples/Makefile.am40
5 files changed, 59 insertions, 81 deletions
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/Makefile.am b/bindings/vala/Makefile.am
deleted file mode 100644
index 2763bc3..0000000
--- a/bindings/vala/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-if HAVE_INTROSPECTION
-if HAVE_VAPIGEN
-
-SUBDIRS = . examples
-
-#########################
-# VAPI Files
-#########################
-
-if USE_GTK3
-GTKVAPI = gtk+-3.0
-VER=3
-else
-GTKVAPI = gtk+-2.0
-VER=
-endif
-
-vapidir = $(datadir)/vala/vapi
-vapiprefix = ayatana-appindicator$(VER)-0.1
-vapi_DATA = $(vapiprefix).vapi $(vapiprefix).deps
-DEPS = $(GTKVAPI)
-
-$(vapiprefix).deps:
- echo $(DEPS) > $@
-
-$(vapiprefix).vapi: $(top_builddir)/src/AyatanaAppIndicator$(VER)-0.1.gir \
- $(top_builddir)/src/AyatanaAppIndicator$(VER)-0.1.metadata \
- ayatana-appindicator-0.1-custom.vala \
- $(vapiprefix).deps
- $(VALA_API_GEN) --library=$(vapiprefix) --girdir=$(srcdir)/src \
- $< $(srcdir)/ayatana-appindicator-0.1-custom.vala
-
-
-CLEANFILES = $(vapi_DATA)
-DISTCLEANFILES = Makefile.in
-
-endif
-endif
-
-EXTRA_DIST = \
- ayatana-appindicator-0.1-custom.vala
diff --git a/bindings/vala/ayatana-appindicator3-0.1.deps b/bindings/vala/ayatana-appindicator3-0.1.deps
new file mode 100644
index 0000000..f48ab98
--- /dev/null
+++ b/bindings/vala/ayatana-appindicator3-0.1.deps
@@ -0,0 +1,3 @@
+gtk+-3.0
+glib-2.0
+Dbusmenu-0.4
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")
diff --git a/bindings/vala/examples/Makefile.am b/bindings/vala/examples/Makefile.am
deleted file mode 100644
index 315447c..0000000
--- a/bindings/vala/examples/Makefile.am
+++ /dev/null
@@ -1,40 +0,0 @@
-if USE_GTK3
-VER=3
-else
-VER=
-endif
-
-VALAFILES = ayatana-indicator-example.vala
-EXTRA_DIST = $(VALAFILES)
-
-VALAFLAGS = \
- --pkg ayatana-appindicator$(VER)-0.1 \
- --vapidir=$(top_builddir)/bindings/vala \
- --save-temps
-
-if HAVE_VALAC
-
-BUILT_SOURCES = ayatana-indicator-example.c
-
-ayatana-indicator-example.c: $(VALAFILES) Makefile.am
- $(VALAC) $(VALAFLAGS) -C $< -o $@
- $(SED) -i "s|#include\s*<\s*libayatana-appindicator/app-indicator.h\s*>||g" $@
-
-nodist_ayatana_indicator_example_SOURCES = ayatana-indicator-example.c
-ayatana_indicator_example_CFLAGS = \
- $(LIBRARY_CFLAGS) \
- -Wall \
- -I$(top_srcdir)/src \
- -include $(top_srcdir)/src/app-indicator.h
-ayatana_indicator_example_LDADD = \
- $(LIBRARY_LIBS) \
- $(top_builddir)/src/libayatana-appindicator$(VER).la
-
-check_PROGRAMS = ayatana-indicator-example
-
-CLEANFILES = \
- *.c \
- ayatana-indicator-example
-DISTCLEANFILES = Makefile.in
-
-endif