meson.build 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #********************************************************************
  2. # Copyright 2014-2022 Daniel 'grindhold' Brendle
  3. #
  4. # This file is part of libgtkflow.
  5. #
  6. # libgtkflow is free software: you can redistribute it and/or
  7. # modify it under the terms of the GNU Lesser General Public License
  8. # as published by the Free Software Foundation, either
  9. # version 3 of the License, or (at your option) any later
  10. # version.
  11. #
  12. # libgtkflow is distributed in the hope that it will be
  13. # useful, but WITHOUT ANY WARRANTY; without even the implied
  14. # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. # PURPOSE. See the GNU Lesser General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU Lesser General Public
  18. # License along with libgtkflow.
  19. # If not, see http://www.gnu.org/licenses/.
  20. #********************************************************************
  21. src = files([
  22. 'dock.vala',
  23. 'minimap.vala',
  24. 'node.vala',
  25. 'nodeview.vala',
  26. ])
  27. gtkflow4_api = '0.2'
  28. gflow_dep_api = '1.0'
  29. gtkflow4_deps = [glib, gobject, gtk4, math]
  30. gtkflow4_links = []
  31. gtkflow4_include_dirs = []
  32. if get_option('enable_gflow') == false
  33. gflow_dep = dependency('gflow-'+gflow_dep_api)
  34. gtkflow4_deps += gflow_dep
  35. else
  36. gtkflow4_links += gflow
  37. gtkflow4_include_dirs += gflow_inc
  38. endif
  39. gtkflow4 = library('gtkflow4-' + gtkflow4_api,
  40. src,
  41. dependencies: gtkflow4_deps,
  42. link_with: gtkflow4_links,
  43. include_directories: gtkflow4_include_dirs,
  44. vala_gir: 'GtkFlow4-' + gtkflow4_api + '.gir',
  45. install: true)
  46. gtkflow4_inc = include_directories('.')
  47. gtkflow4_typelib_cmd = [g_ir_compiler, '--output', '@OUTPUT@', meson.current_build_dir() + '/GtkFlow4-' + gtkflow4_api + '.gir',
  48. '--shared-library', get_option('prefix') + '/' + get_option('libdir') + '/libgtkflow4-'+ gtkflow4_api +'.so']
  49. if get_option('enable_gflow')
  50. gtkflow4_typelib_cmd += ['--includedir', gflow_girdir]
  51. endif
  52. custom_target('gtkflow4-typelib',
  53. command: gtkflow4_typelib_cmd,
  54. output: 'GtkFlow4-' + gtkflow4_api + '.typelib',
  55. depends: gtkflow4,
  56. install: true,
  57. install_dir: get_option('libdir') + '/girepository-1.0')
  58. girfilename4 = meson.current_build_dir() + '/GtkFlow4-' + gtkflow4_api + '.gir'
  59. run_command('touch', girfilename4)
  60. install_data(sources: girfilename4,
  61. install_dir: get_option('datadir') + '/gir-1.0')
  62. vapifilename4 = meson.current_build_dir() + '/gtkflow4-' + gtkflow4_api + '.vapi'
  63. run_command('touch', vapifilename4)
  64. install_data(sources: vapifilename4,
  65. install_dir: get_option('datadir') + '/vala/vapi')
  66. headerfilename4 = meson.current_build_dir () + '/gtkflow4-' + gtkflow4_api + '.h'
  67. run_command('touch', headerfilename4)
  68. install_headers(headerfilename4,
  69. subdir: 'gtkflow4-' + gtkflow4_api)
  70. install_data(sources: [meson.current_source_dir() + '/gtkflow4-' + gtkflow4_api + '.deps'],
  71. install_dir: get_option('datadir') + '/vala/vapi')
  72. pkgconfig.generate(libraries: [gtkflow4],
  73. subdirs: 'gtkflow4-' + gtkflow4_api,
  74. version: gtkflow4_api,
  75. name: 'gtkflow4',
  76. filebase: 'gtkflow4-' + gtkflow4_api,
  77. requires: ['glib-2.0', 'gobject-2.0', 'gflow-' + gflow_dep_api],
  78. description: 'A library to create flowgraphs in GTK+')
  79. if get_option('enable_valadoc')
  80. valadoc = find_program('valadoc')
  81. gtkflow4_docs = custom_target('gtkflow4_apidocs',
  82. depends: gtkflow4,
  83. input: src,
  84. install: true,
  85. # FIXME: Installing to tmp, so the target will be built
  86. # the problem is we cannot access a subfolder of the
  87. # buildtarget via the output parameter.
  88. # Find a nicer solution
  89. install_dir: '/tmp',
  90. command: [valadoc, '-o', meson.current_build_dir() + '/gtkflow4-' + gtkflow4_api, '--doclet', 'devhelp', '@INPUT@',
  91. '--pkg', 'gtk4', '--vapidir=' + meson.current_build_dir() + '/../libgflow/', '--pkg', 'gflow-' + gflow_dep_api,
  92. '--force'],
  93. output: 'gtkflow4-'+ gtkflow4_api)
  94. install_subdir(meson.current_build_dir() + '/gtkflow4-' + gtkflow4_api + '/gtkflow4-' + gtkflow4_api,
  95. install_dir: get_option('datadir') + '/devhelp/books',
  96. )
  97. endif