diff options
author | Robert Tari <robert@tari.in> | 2021-08-17 01:59:27 +0200 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2021-08-18 02:01:01 +0200 |
commit | c7320dab38cb2dda29226eab2c8705b5a132ac87 (patch) | |
tree | c32ed6a4be5b03d5e5bccd8f7c510cac278a8854 /cmake/FindGObjectIntrospection.cmake | |
parent | 7f9519e1b54d4e864f2573583945419ef56f8a05 (diff) | |
download | libayatana-common-c7320dab38cb2dda29226eab2c8705b5a132ac87.tar.gz libayatana-common-c7320dab38cb2dda29226eab2c8705b5a132ac87.tar.bz2 libayatana-common-c7320dab38cb2dda29226eab2c8705b5a132ac87.zip |
Add Vala Bindings
- src/utils.h: Replace defined strings with static const chars
- src/CMakeLists.txt: Add .gir and .vapi generation code
- tetsts/CMakeLists.txt: Compile tst_utils_vala + add as test
- CMakeLists.txt: Add tst_utils_vala to tests + add modules from cmake/
- cmake/FindGObjectIntrospection.cmake: Add file
- cmake/FindVala.cmake.cmake: Add file
- .build.yml: Add libgirepository1.0-dev, gobject-introspection, valac dependencies
fixes https://github.com/AyatanaIndicators/libayatana-common/issues/22
Diffstat (limited to 'cmake/FindGObjectIntrospection.cmake')
-rw-r--r-- | cmake/FindGObjectIntrospection.cmake | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/cmake/FindGObjectIntrospection.cmake b/cmake/FindGObjectIntrospection.cmake new file mode 100644 index 0000000..2073c3c --- /dev/null +++ b/cmake/FindGObjectIntrospection.cmake @@ -0,0 +1,61 @@ +# - try to find gobject-introspection +# +# Once done this will define +# +# INTROSPECTION_FOUND - system has gobject-introspection +# INTROSPECTION_SCANNER - the gobject-introspection scanner, g-ir-scanner +# INTROSPECTION_COMPILER - the gobject-introspection compiler, g-ir-compiler +# INTROSPECTION_GENERATE - the gobject-introspection generate, g-ir-generate +# INTROSPECTION_GIRDIR +# INTROSPECTION_TYPELIBDIR +# INTROSPECTION_CFLAGS +# INTROSPECTION_LIBS +# +# Copyright (C) 2010, Pino Toscano, <pino@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +macro(_GIR_GET_PKGCONFIG_VAR _outvar _varname) + execute_process( + COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_varname} gobject-introspection-1.0 + OUTPUT_VARIABLE _result + RESULT_VARIABLE _null + ) + + if (_null) + else() + string(REGEX REPLACE "[\r\n]" " " _result "${_result}") + string(REGEX REPLACE " +$" "" _result "${_result}") + separate_arguments(_result) + set(${_outvar} ${_result} CACHE INTERNAL "") + endif() +endmacro(_GIR_GET_PKGCONFIG_VAR) + +find_package(PkgConfig) +if(PKG_CONFIG_FOUND) + if(PACKAGE_FIND_VERSION_COUNT GREATER 0) + set(_gir_version_cmp ">=${PACKAGE_FIND_VERSION}") + endif() + pkg_check_modules(_pc_gir gobject-introspection-1.0${_gir_version_cmp}) + if(_pc_gir_FOUND) + set(INTROSPECTION_FOUND TRUE) + _gir_get_pkgconfig_var(INTROSPECTION_SCANNER "g_ir_scanner") + _gir_get_pkgconfig_var(INTROSPECTION_COMPILER "g_ir_compiler") + _gir_get_pkgconfig_var(INTROSPECTION_GENERATE "g_ir_generate") + _gir_get_pkgconfig_var(INTROSPECTION_GIRDIR "girdir") + _gir_get_pkgconfig_var(INTROSPECTION_TYPELIBDIR "typelibdir") + set(INTROSPECTION_CFLAGS "${_pc_gir_CFLAGS}") + set(INTROSPECTION_LIBS "${_pc_gir_LIBS}") + endif() +endif() + +mark_as_advanced( + INTROSPECTION_SCANNER + INTROSPECTION_COMPILER + INTROSPECTION_GENERATE + INTROSPECTION_GIRDIR + INTROSPECTION_TYPELIBDIR + INTROSPECTION_CFLAGS + INTROSPECTION_LIBS +) |