// <<@file examples/nim-adoc/meson.build>>=
project('nim-adoc-example', version : '0.1.0', meson_version : '>=1.1.0')
python3 = find_program('python3', required : true)
weaveback = find_program('weaveback', required : true)
nph = find_program('nph', required : false)
asciidoctor = find_program('asciidoctor', required : false)
weaveback_flags = [
'--open-delim', '<[',
'--close-delim', ']>',
'--chunk-end', '@',
'--comment-markers', '#',
]
if nph.found()
weaveback_flags += ['--formatter', 'nim=' + nph.full_path()]
endif
gen_nim = custom_target('gen-nim',
output : ['gen_nim.stamp'],
depfile : 'gen_nim.d',
command : [
weaveback,
'--dir', meson.current_source_dir(),
'--ext', 'adoc',
'--include', meson.current_source_dir(),
'--gen', meson.current_source_dir() / 'gen',
'--db', meson.current_source_dir() / 'weaveback.db',
'--stamp', '@OUTPUT0@',
'--depfile', '@DEPFILE@',
] + weaveback_flags,
build_by_default : true,
)
if asciidoctor.found()
custom_target('gen-docs',
input : files('config.nim.adoc'),
output : ['gen_docs.stamp'],
command : [
python3, meson.current_source_dir() / 'scripts' / 'gen_docs.py',
asciidoctor,
'-r', 'asciidoctor-diagram',
'-a', 'source-highlighter=rouge',
'-a', 'rouge-css=class',
'-a', 'rouge-style=gruvbox',
'-a', 'docinfo=shared',
'-a', 'docinfodir=' + meson.current_source_dir() / 'theme',
'-a', 'imagesdir=.',
'-D', meson.current_source_dir() / 'docs' / 'html',
'@INPUT@',
'@OUTPUT0@',
],
build_by_default : true,
depends : [gen_nim],
)
endif
// @