1
0

meson.build 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. doxygen = find_program('doxygen', required: false)
  2. if not doxygen.found()
  3. error(
  4. '''Documentation requires doxygen which was not found.
  5. You can disable the documentation with -Denable-docs=false.''',
  6. )
  7. endif
  8. doxygen_wrapper = find_program(
  9. meson.project_source_root() / 'scripts' / 'doxygen-wrapper',
  10. )
  11. # NOTE: file paths relative to the project root, which is used as the working
  12. # directory for Doxygen. This is needed for various reasons (e.g. relative
  13. # references in md files).
  14. doxygen_input = [
  15. 'README.md',
  16. 'LICENSE',
  17. 'NEWS.md',
  18. 'meson.options',
  19. 'doc/compatibility.md',
  20. 'doc/custom-configuration.md',
  21. 'doc/debugging.md',
  22. 'doc/diagrams/xkb-configuration.dot',
  23. 'doc/diagrams/xkb-keymap-components.dot',
  24. 'doc/diagrams/xkb-types-explanation.dot',
  25. 'doc/doxygen-extra.css',
  26. 'doc/faq.md',
  27. 'doc/img/numeric-keypad-overlay.svg',
  28. 'doc/introduction-to-xkb.md',
  29. 'doc/keymap-text-format-v1-v2.md',
  30. 'doc/keysym-encoding.md',
  31. 'doc/license.md',
  32. 'doc/message-registry.md',
  33. 'doc/packaging-keyboard-layouts.md',
  34. 'doc/quick-guide.md',
  35. 'doc/release-notes.md',
  36. 'doc/rules-format.md',
  37. 'include/xkbcommon/xkbcommon.h',
  38. 'include/xkbcommon/xkbcommon-compose.h',
  39. 'include/xkbcommon/xkbcommon-errors.h',
  40. 'include/xkbcommon/xkbcommon-features.h',
  41. 'include/xkbcommon/xkbcommon-keysyms.h',
  42. 'include/xkbcommon/xkbcommon-names.h',
  43. 'include/xkbcommon/xkbcommon-x11.h',
  44. 'include/xkbcommon/xkbregistry.h',
  45. ]
  46. doxygen_data = configuration_data()
  47. doxygen_data.set('PACKAGE_NAME', meson.project_name())
  48. doxygen_data.set('PACKAGE_VERSION', meson.project_version())
  49. doxygen_data.set('INPUT', ' '.join(doxygen_input))
  50. doxygen_data.set('OUTPUT_DIRECTORY', meson.current_build_dir())
  51. doxyfile = configure_file(
  52. input: 'Doxyfile.in',
  53. output: 'Doxyfile',
  54. configuration: doxygen_data,
  55. )
  56. relative_doxygen_input = []
  57. foreach f : doxygen_input
  58. relative_doxygen_input += '..' / f
  59. endforeach
  60. # TODO: Meson should provide this.
  61. docdir = get_option('datadir') / 'doc' / meson.project_name()
  62. doc_gen = custom_target(
  63. 'doxygen',
  64. input: [doxyfile] + relative_doxygen_input,
  65. output: 'html',
  66. command: [
  67. doxygen_wrapper,
  68. doxygen,
  69. meson.current_build_dir() / 'Doxyfile',
  70. meson.project_source_root(),
  71. ],
  72. install: true,
  73. install_dir: docdir,
  74. build_by_default: true,
  75. )
  76. if get_option('enable-cool-uris')
  77. ensure_stable_urls = find_program(
  78. meson.project_source_root() / 'scripts' / 'ensure-stable-doc-urls.py',
  79. )
  80. custom_target(
  81. 'cool-uris',
  82. input: [doc_gen, meson.current_source_dir() / 'cool-uris.yaml'],
  83. output: 'html-xtra',
  84. command: [
  85. ensure_stable_urls,
  86. 'generate-redirections',
  87. meson.current_source_dir() / 'cool-uris.yaml',
  88. meson.current_build_dir() / 'html',
  89. ],
  90. install: false,
  91. build_by_default: true,
  92. )
  93. endif