1prg_install = find_program('install') 2 3doxygen = find_program('doxygen', required : false) 4if not doxygen.found() 5 error('Program "doxygen" not found or not executable. Try building with -Ddocumentation=false') 6endif 7dot = find_program('dot', required : false) 8if not dot.found() 9 error('Program "dot" not found or not executable. Try building with -Ddocumentation=false') 10endif 11 12doxygen_version_cmd = run_command(doxygen.path(), '--version') 13if doxygen_version_cmd.returncode() != 0 14 error('Command "doxygen --version" failed.') 15endif 16doxygen_version = doxygen_version_cmd.stdout() 17if doxygen_version.version_compare('< 1.8.3') 18 error('doxygen needs to be at least version 1.8.3 (have @0@)'.format(doxygen_version)) 19endif 20grep = find_program('grep') 21dot_version_cmd = run_command(dot.path(), '-V') 22if dot_version_cmd.returncode() != 0 23 error('Command "dot -V" failed.') 24endif 25# dot -V output is (to stderr): 26# dot - graphviz version 2.38.0 (20140413.2041) 27dot_version = dot_version_cmd.stderr().split(' ')[4] 28if dot_version.version_compare('< 2.26') 29 error('Graphviz dot needs to be at least version 2.26 (have @0@)'.format(dot_version)) 30endif 31 32mainpage = vcs_tag(command : ['git', 'log', '-1', '--format=%h'], 33 fallback : 'unknown', 34 input : 'mainpage.dox', 35 output : 'mainpage.dox', 36 replace_string: '__GIT_VERSION__') 37 38src_doxygen = files( 39 # source files 40 '../../src/libinput.h', 41 # style files 42 'style/header.html', 43 'style/footer.html', 44 'style/customdoxygen.css', 45 'style/bootstrap.css', 46 'style/libinputdoxygen.css', 47) 48 49config_noop = configuration_data() 50# Set a dummy replacement to silence meson warnings: 51# meson.build:487: WARNING: Got an empty configuration_data() object and 52# found no substitutions in the input file 'foo'. If you 53# want to copy a file to the build dir, use the 'copy:' 54# keyword argument added in 0.47.0 55config_noop.set('dummy', 'dummy') 56 57doxyfiles = [] 58foreach f : src_doxygen 59 df = configure_file(input: f, 60 output: '@PLAINNAME@', 61 configuration : config_noop) 62 doxyfiles += [ df ] 63endforeach 64 65doc_config = configuration_data() 66doc_config.set('PACKAGE_NAME', meson.project_name()) 67doc_config.set('PACKAGE_VERSION', meson.project_version()) 68doc_config.set('builddir', meson.current_build_dir()) 69 70doxyfile = configure_file(input : 'libinput.doxygen.in', 71 output : 'libinput.doxygen', 72 configuration : doc_config) 73 74custom_target('doxygen', 75 input : [ doxyfiles, doxyfile, mainpage ] + src_doxygen, 76 output : [ '.' ], 77 command : [ doxygen, doxyfile ], 78 install : false, 79 depends: [ mainpage ], 80 build_by_default : true) 81