• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1sphinx = find_program('sphinx-build', required: true)
2doxygen = find_program('doxygen', required: true)
3breathe = find_program('breathe-apidoc', required: true)
4
5sphinx_c = run_command(sphinx, '--version')
6breathe_c = run_command(breathe, '--version')
7doxygen_c = run_command(doxygen, '--version')
8
9sphinx_v = sphinx_c.stdout().split(' ')[1].strip()
10breathe_v = breathe_c.stdout().split(' ')[2].strip()
11doxygen_v = doxygen_c.stdout().strip()
12
13if sphinx_v.version_compare('< 2.1.0')
14	error('Use at least sphinx version 2.1.0, found ' + sphinx_v)
15endif
16
17if breathe_v.version_compare('< 4.11')
18	error('Use at least breathe version 4.11, found ' + breathe_v)
19endif
20
21if doxygen_v.version_compare('< 1.8')
22	error('Use at least doxygen version 1.8, found ' + doxygen_v)
23endif
24
25doxygen_database = meson.current_build_dir() + '/doxygen_doc'
26
27# modify the sphinx configuration and the breathe doxygen XML database
28# to point where its being generated by doxygen
29sphinx_conf_data = configuration_data()
30sphinx_conf_data.set('BUILD_ROOT', doxygen_database)
31sphinx_conf_data.set('VERSION', meson.project_version())
32sphinx_conf = configure_file(
33		input: 'conf.py.in',
34		output: 'conf.py',
35		configuration: sphinx_conf_data
36)
37
38doxy_conf_data = configuration_data()
39doxy_conf_data.set('SRC_ROOT', meson.source_root())
40doxy_conf_data.set('OUTPUT_DIR', doxygen_database)
41doxygen_conf_weston = configure_file(
42		input: 'doxygen.ini.in',
43		output: 'doxygen.ini',
44		configuration: doxy_conf_data
45)
46
47script_data = configuration_data()
48script_data.set('SRCDIR', meson.current_build_dir())
49script_data.set('OUTDIR', meson.current_build_dir() + '/doc')
50script_data.set('DOXYGEN_CONF', meson.current_build_dir() + '/doxygen.ini')
51script_data.set('DOXYGEN_CMD', doxygen.path())
52script_data.set('SPHINX_CMD', sphinx.path())
53script_doxy_sphinx = configure_file(
54	input: 'run_doxygen_sphinx.sh.in',
55	output: 'run_doxygen_sphinx.sh',
56	configuration: script_data
57)
58
59# copy everything to build_dir, if you plan on adding other files in the top
60# rootdir of sourcedir, please add them here as well, otherwise use 'toc/'s
61# meson.build file
62sphinx_files = ['index.rst']
63foreach file : sphinx_files
64	configure_file(input: file, output: file, copy: true)
65endforeach
66
67# and those in toc
68subdir('toc')
69
70sphinx_doc = custom_target(
71		'weston-doc-breathe',
72		command: script_doxy_sphinx,
73		output: 'doc',
74		build_by_default: true,
75)
76
77# we need this because we will have a stale 'doc' directory
78# and this forces it to be rebuilt
79docs = run_target(
80		'docs',
81		command: script_doxy_sphinx,
82)
83
84install_subdir(
85	sphinx_doc.full_path(),
86	install_dir: join_paths(dir_data, 'doc', 'weston'),
87	strip_directory: true,
88)
89