build: make doxygen run from the source tree

I couldn't find any other way to make this work!

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2017-08-01 22:19:48 +03:00
parent ccc3415edd
commit 41bea9ab2b
4 changed files with 24 additions and 14 deletions

View File

@ -8,6 +8,7 @@ EXTRA_DIST = \
scripts/makekeys \
scripts/update-keysyms \
scripts/update-keywords \
scripts/doxygen-wrapper \
src/xkbcomp/keywords.gperf \
test/data \
README.md \
@ -164,7 +165,7 @@ doc/html: doc/Doxyfile $(doxygen_input)
cat $<; \
echo "INPUT = $(doxygen_input)"; \
echo "OUTPUT_DIRECTORY = $(abs_top_builddir)/doc"; \
) | $(DOXYGEN) -
) | $(top_srcdir)/scripts/doxygen-wrapper "$(DOXYGEN)" - "$(abs_top_srcdir)"
clean-doxygen:
rm -rf doc/html

View File

@ -2,6 +2,8 @@ PROJECT_NAME = @PACKAGE_NAME@
PROJECT_NUMBER = @PACKAGE_VERSION@
OUTPUT_DIRECTORY = @OUTPUT_DIRECTORY@
BRIEF_MEMBER_DESC = NO
JAVADOC_AUTOBRIEF = YES
@ -32,7 +34,7 @@ ALPHABETICAL_INDEX = NO
IGNORE_PREFIX = xkb_ \
XKB_
HTML_EXTRA_STYLESHEET = @abs_top_srcdir@/doc/doxygen-extra.css
HTML_EXTRA_STYLESHEET = doc/doxygen-extra.css
HTML_TIMESTAMP = NO

View File

@ -447,36 +447,35 @@ if get_option('enable-docs')
error('''Documentation requires doxygen which was not found.
You can disable the documentation with -Denable-docs=false.''')
endif
doxygen_wrapper = find_program('scripts/doxygen-wrapper')
doxygen_input = [
join_paths(meson.source_root(), 'README.md'),
join_paths(meson.source_root(), 'doc/doxygen-extra.css'),
join_paths(meson.source_root(), 'doc/quick-guide.md'),
join_paths(meson.source_root(), 'doc/compat.md'),
join_paths(meson.source_root(), 'xkbcommon/xkbcommon.h'),
join_paths(meson.source_root(), 'xkbcommon/xkbcommon-names.h'),
join_paths(meson.source_root(), 'xkbcommon/xkbcommon-x11.h'),
join_paths(meson.source_root(), 'xkbcommon/xkbcommon-compose.h'),
'README.md',
'doc/doxygen-extra.css',
'doc/quick-guide.md',
'doc/compat.md',
'xkbcommon/xkbcommon.h',
'xkbcommon/xkbcommon-names.h',
'xkbcommon/xkbcommon-x11.h',
'xkbcommon/xkbcommon-compose.h',
]
doxygen_data = configuration_data()
doxygen_data.set('PACKAGE_NAME', meson.project_name())
doxygen_data.set('PACKAGE_VERSION', meson.project_version())
doxygen_data.set('INPUT', ' '.join(doxygen_input))
doxygen_data.set('abs_top_srcdir', meson.source_root())
doxygen_data.set('OUTPUT_DIRECTORY', meson.build_root())
doxyfile = configure_file(
input: 'doc/Doxyfile.in',
output: 'Doxyfile',
configuration: doxygen_data,
install: false,
)
# TODO: Meson should provide this.
docdir = join_paths(get_option('datadir'), 'doc', meson.project_name())
# TODO: Relative links in README.md fail.
custom_target(
'doc',
input: [doxyfile] + doxygen_input,
output: 'html',
command: [doxygen, doxyfile],
command: [doxygen_wrapper, doxygen.path(), join_paths(meson.build_root(), 'Doxyfile'), meson.source_root()],
install: true,
install_dir: docdir,
build_by_default: true,

8
scripts/doxygen-wrapper Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
# Run doxygen such that the working directory is the source root.
# This is needed for various reasons (e.g. relative references in md files).
# Do not use directly.
DOXYGEN="$1"
DOXYFILE="$2"
ABS_TOP_SRCDIR="$3"
cd "$ABS_TOP_SRCDIR" && exec "$DOXYGEN" "$DOXYFILE"