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

View File

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

View File

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