diff options
author | Robert Tari <robert@tari.in> | 2021-02-27 00:37:26 +0100 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2021-06-09 13:55:39 +0200 |
commit | 367188dbba4f98a597aca9ced7832762fc88b062 (patch) | |
tree | 56e6cfcecc97f8c1a50c8ed5ff25f4bbec5b2f3e /bindings/vala | |
parent | 2d8c300a3ce04ea7e372e38c81a65f06f0890a50 (diff) | |
download | libayatana-appindicator-367188dbba4f98a597aca9ced7832762fc88b062.tar.gz libayatana-appindicator-367188dbba4f98a597aca9ced7832762fc88b062.tar.bz2 libayatana-appindicator-367188dbba4f98a597aca9ced7832762fc88b062.zip |
Add CMakeLists.txt files + cmake/ helpers
Diffstat (limited to 'bindings/vala')
-rw-r--r-- | bindings/vala/CMakeLists.txt | 29 | ||||
-rw-r--r-- | bindings/vala/examples/CMakeLists.txt | 27 |
2 files changed, 56 insertions, 0 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/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") |