| 1 |
if not get_option('introspection').allowed() |
| 2 |
error('API reference requires introspection.') |
| 3 |
endif |
| 4 |
|
| 5 |
toml_conf = configuration_data() |
| 6 |
toml_conf.set('version', meson.project_version()) |
| 7 |
|
| 8 |
doc_dependencies = ['"Gio-2.0"'] |
| 9 |
|
| 10 |
if host_machine.system() != 'windows' |
| 11 |
doc_dependencies += ['"GioUnix-2.0"'] |
| 12 |
endif |
| 13 |
|
| 14 |
toml_conf.set('dependencies', ', '.join(doc_dependencies)) |
| 15 |
|
| 16 |
gidocgen = find_program('gi-docgen') |
| 17 |
|
| 18 |
gidocgen_common_args = [ |
| 19 |
'--quiet', |
| 20 |
'--no-namespace-dir', |
| 21 |
] |
| 22 |
|
| 23 |
if get_option('werror') |
| 24 |
gidocgen_common_args += ['--fatal-warnings'] |
| 25 |
endif |
| 26 |
|
| 27 |
docs_dir = get_option('datadir') / 'doc' |
| 28 |
|
| 29 |
source_toml = configure_file( |
| 30 |
input: 'Dex.toml.in', |
| 31 |
output: 'Dex.toml', |
| 32 |
configuration: toml_conf, |
| 33 |
install: true, |
| 34 |
install_dir: docs_dir / 'libdex-@0@'.format(api_version), |
| 35 |
) |
| 36 |
|
| 37 |
custom_target('dex-doc', |
| 38 |
input: [ source_toml, libdex_gir[0] ], |
| 39 |
output: 'libdex-@0@'.format(api_version), |
| 40 |
command: [ |
| 41 |
gidocgen, |
| 42 |
'generate', |
| 43 |
gidocgen_common_args, |
| 44 |
'--config=@INPUT0@', |
| 45 |
'--output-dir=@OUTPUT@', |
| 46 |
'--content-dir=@0@'.format(meson.current_source_dir()), |
| 47 |
'@INPUT1@', |
| 48 |
], |
| 49 |
build_by_default: true, |
| 50 |
install: true, |
| 51 |
install_dir: docs_dir, |
| 52 |
) |