meson.build 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. if get_option('enable_gflow') == false
  32. gflow_dep = dependency('gflow-'+gflow_dep_api)
  33. gtkflow4_deps += gflow_dep
  34. else
  35. gtkflow4_links += gflow
  36. endif
  37. gtkflow4 = library('gtkflow4-' + gtkflow4_api,
  38. src,
  39. dependencies: gtkflow4_deps,
  40. link_with: gtkflow4_links,
  41. include_directories: gflow_inc,
  42. vala_gir: 'GtkFlow4-' + gtkflow4_api + '.gir',
  43. install: true)
  44. gtkflow4_inc = include_directories('.')
  45. custom_target('gtkflow4-typelib',
  46. command: [g_ir_compiler, '--output', '@OUTPUT@', meson.current_build_dir() + '/GtkFlow4-' + gtkflow4_api + '.gir',
  47. '--includedir', gflow_girdir,
  48. '--shared-library', get_option('prefix') + '/' + get_option('libdir') + '/libgtkflow4-'+ gtkflow4_api +'.so'],
  49. output: 'GtkFlow4-' + gtkflow4_api + '.typelib',
  50. depends: gtkflow4,
  51. install: true,
  52. install_dir: get_option('libdir') + '/girepository-1.0')
  53. girfilename4 = meson.current_build_dir() + '/GtkFlow4-' + gtkflow4_api + '.gir'
  54. run_command('touch', girfilename4)
  55. install_data(sources: girfilename4,
  56. install_dir: get_option('datadir') + '/gir-1.0')
  57. vapifilename4 = meson.current_build_dir() + '/gtkflow4-' + gtkflow4_api + '.vapi'
  58. run_command('touch', vapifilename4)
  59. install_data(sources: vapifilename4,
  60. install_dir: get_option('datadir') + '/vala/vapi')
  61. headerfilename4 = meson.current_build_dir () + '/gtkflow4-' + gtkflow4_api + '.h'
  62. run_command('touch', headerfilename4)
  63. install_headers(headerfilename4,
  64. subdir: 'gtkflow4-' + gtkflow4_api)
  65. install_data(sources: [meson.current_source_dir() + '/gtkflow4-' + gtkflow4_api + '.deps'],
  66. install_dir: get_option('datadir') + '/vala/vapi')
  67. pkgconfig.generate(libraries: [gtkflow4],
  68. subdirs: 'gtkflow4-' + gtkflow4_api,
  69. version: gtkflow4_api,
  70. name: 'gtkflow4',
  71. filebase: 'gtkflow4-' + gtkflow4_api,
  72. requires: ['glib-2.0', 'gobject-2.0', 'gflow-' + gflow_dep_api],
  73. description: 'A library to create flowgraphs in GTK+')
  74. if get_option('enable_valadoc')
  75. valadoc = find_program('valadoc')
  76. gtkflow4_docs = custom_target('gtkflow_apidocs',
  77. depends: gflow,
  78. input: src,
  79. install: true,
  80. # FIXME: Installing to tmp, so the target will be built
  81. # the problem is we cannot access a subfolder of the
  82. # buildtarget via the output parameter.
  83. # Find a nicer solution
  84. install_dir: '/tmp',
  85. command: [valadoc, '-o', meson.current_build_dir() + '/gtkflow4-' + gtkflow4_api, '--doclet', 'devhelp', '@INPUT@',
  86. '--pkg', 'gtk4', '--vapidir=' + meson.current_build_dir() + '/../libgflow/', '--pkg', 'gflow-' + gflow_dep_api,
  87. '--force'],
  88. output: 'gtkflow4-'+ gtkflow4_api)
  89. install_subdir(meson.current_build_dir() + '/gtkflow4-' + gtkflow4_api + '/gtkflow4-' + gtkflow4_api,
  90. install_dir: get_option('datadir') + '/devhelp/books',
  91. )
  92. endif