aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
Diffstat (limited to 'example')
-rw-r--r--example/CMakeLists.txt37
-rw-r--r--example/Makefile.am63
2 files changed, 37 insertions, 63 deletions
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
new file mode 100644
index 0000000..ba8839e
--- /dev/null
+++ b/example/CMakeLists.txt
@@ -0,0 +1,37 @@
+# simple-client-vala.c
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/simple-client-vala.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 simple-client-vala.vala
+ --directory=${CMAKE_CURRENT_BINARY_DIR}
+ VERBATIM
+ COMMAND
+ sed
+ -i "s|#include\\s*<\\s*libayatana-appindicator/app-indicator.h\\s*>||g"
+ "${CMAKE_CURRENT_BINARY_DIR}/simple-client-vala.c"
+)
+
+# simple-client-vala
+
+set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/simple-client-vala.c" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -include ${CMAKE_SOURCE_DIR}/src/app-indicator.h")
+add_executable("simple-client-vala" "${CMAKE_CURRENT_BINARY_DIR}/simple-client-vala.c")
+target_include_directories("simple-client-vala" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
+target_link_libraries("simple-client-vala" "${PROJECT_DEPS_LIBRARIES} -layatana-appindicator3 -L${CMAKE_BINARY_DIR}/src")
+add_dependencies("simple-client-vala" "ayatana-appindicator3")
+
+# simple-client
+
+set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/simple-client.c" PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
+add_executable("simple-client" "${CMAKE_CURRENT_SOURCE_DIR}/simple-client.c")
+target_compile_definitions("simple-client" PUBLIC LOCAL_ICON="${CMAKE_CURRENT_SOURCE_DIR}/simple-client-test-icon.png")
+target_include_directories("simple-client" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
+target_include_directories("simple-client" PUBLIC "${CMAKE_SOURCE_DIR}/src")
+target_link_libraries("simple-client" "${PROJECT_DEPS_LIBRARIES} -layatana-appindicator3 -L${CMAKE_BINARY_DIR}/src")
+add_dependencies("simple-client" "ayatana-appindicator3")
diff --git a/example/Makefile.am b/example/Makefile.am
deleted file mode 100644
index 0509e3e..0000000
--- a/example/Makefile.am
+++ /dev/null
@@ -1,63 +0,0 @@
-if USE_GTK3
-VER=3
-else
-VER=
-endif
-
-CLEANFILES =
-DISTCLEANFILES = Makefile Makefile.in .deps/
-EXTRA_DIST =
-
-check_PROGRAMS = \
- simple-client \
- simple-client-vala
-
-#########################################
-## simple-client
-#########################################
-
-simple_client_SOURCES = \
- simple-client.c
-
-#-Werror removed for Vala
-simple_client_CFLAGS = \
- $(LIBRARY_CFLAGS) \
- -DLOCAL_ICON="\"$(abs_srcdir)/simple-client-test-icon.png\"" \
- -Wall \
- -I$(top_srcdir)/src
-
-simple_client_LDADD = \
- $(LIBRARY_LIBS) \
- $(top_builddir)/src/libayatana-appindicator$(VER).la
-
-EXTRA_DIST += \
- simple-client-test-icon.png
-
-#########################################
-## simple-client-vala
-#########################################
-if HAVE_VALAC
-
-VALAFLAGS = \
- --pkg appindicator$(VER)-0.1 \
- --vapidir=$(top_builddir)/bindings/vala
-
-BUILT_SOURCES = simple-client-vala.c
-simple-client-vala.c: $(srcdir)/simple-client-vala.vala
- $(VALAC) $(VALAFLAGS) -C $< -o $@
- $(SED) -i "s|#include\s*<\s*libayatana-appindicator/app-indicator.h\s*>||g" $@
-
-simple_client_vala_SOURCES = simple-client-vala.c
-simple_client_vala_CFLAGS = \
- $(simple_client_CFLAGS) \
- -include $(top_srcdir)/src/app-indicator.h
-
-simple_client_vala_LDADD = $(simple_client_LDADD)
-
-CLEANFILES += *.stamp *-vala.c
-
-endif
-
-EXTRA_DIST += \
- simple-client-vala.vala
-