doc: move the meson.build in as subdir()
authorPeter Hutterer <peter.hutterer@who-t.net>
Fri, 6 Jul 2018 00:47:18 +0000 (10:47 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 12 Jul 2018 04:05:52 +0000 (14:05 +1000)
Doing so means we can ditch the specific input list for doxygen and just copy
all files over into our builddir/doc/ subdir, then use that subdirectory as
input data.

This relies on meson putting a subdir() into a subdirectory in the build
directory. This isn't technically guaranteed but I also suspect that if meson
ever changes that, lots of other projects will break. Even in that case we
should build just fine since we now filter for *.h and *.dox and don't copy
any other doxygen-commented files into the builddir anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
doc/libinput.doxygen.in
doc/meson.build [new file with mode: 0644]
meson.build

index 0599df9..c2c664a 100644 (file)
@@ -8,9 +8,9 @@ EXTRACT_ALL            = YES
 EXTRACT_STATIC         = YES
 MAX_INITIALIZER_LINES  = 0
 QUIET                  = YES
-INPUT                  = @INPUT@
-IMAGE_PATH             = "@top_srcdir@/doc/svg" \
-                        "@top_srcdir@/doc/dot"
+INPUT                  = "@builddir@"
+FILTER_PATTERNS        = *.h *.dox
+IMAGE_PATH             = "@builddir@"
 GENERATE_HTML          = YES
 HTML_OUTPUT            = Documentation
 SEARCHENGINE           = NO
@@ -21,11 +21,11 @@ MACRO_EXPANSION        = YES
 EXPAND_ONLY_PREDEF     = YES
 PREDEFINED             = LIBINPUT_ATTRIBUTE_PRINTF(f, a)= \
                          LIBINPUT_ATTRIBUTE_DEPRECATED
-DOTFILE_DIRS           = "@top_srcdir@/doc/dot"
+DOTFILE_DIRS           = "@builddir@"
 
-HTML_HEADER = "@top_srcdir@/doc/style/header.html"
-HTML_FOOTER = "@top_srcdir@/doc/style/footer.html"
-HTML_EXTRA_STYLESHEET = "@top_srcdir@/doc/style/bootstrap.css" \
-                       "@top_srcdir@/doc/style/customdoxygen.css" \
-                       "@top_srcdir@/doc/style/libinputdoxygen.css"
-USE_MDFILE_AS_MAINPAGE = @README_MD@
+HTML_HEADER = "@builddir@/header.html"
+HTML_FOOTER = "@builddir@/footer.html"
+HTML_EXTRA_STYLESHEET = "@builddir@/bootstrap.css" \
+                       "@builddir@/customdoxygen.css" \
+                       "@builddir@/libinputdoxygen.css"
+USE_MDFILE_AS_MAINPAGE = "README.md"
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644 (file)
index 0000000..39b0cde
--- /dev/null
@@ -0,0 +1,139 @@
+prg_install = find_program('install')
+
+doxygen = find_program('doxygen', required : false)
+if not doxygen.found()
+       error('Program "doxygen" not found or not executable. Try building with -Ddocumentation=false')
+endif
+dot = find_program('dot', required : false)
+if not dot.found()
+       error('Program "dot" not found or not executable. Try building with -Ddocumentation=false')
+endif
+
+doxygen_version_cmd = run_command(doxygen.path(), '--version')
+if doxygen_version_cmd.returncode() != 0
+       error('Command "doxygen --version" failed.')
+endif
+doxygen_version = doxygen_version_cmd.stdout()
+if doxygen_version.version_compare('< 1.8.3')
+       error('doxygen needs to be at least version 1.8.3 (have @0@)'.format(doxygen_version))
+endif
+grep = find_program('grep')
+dot_version_cmd = run_command(dot.path(), '-V')
+if dot_version_cmd.returncode() != 0
+       error('Command "dot -V" failed.')
+endif
+# dot -V output is (to stderr):
+#      dot - graphviz version 2.38.0 (20140413.2041)
+dot_version = dot_version_cmd.stderr().split(' ')[4]
+if dot_version.version_compare('< 2.26')
+       error('Graphviz dot needs to be at least version 2.26 (have @0@)'.format(dot_version))
+endif
+
+readme = vcs_tag(command : ['git', 'log', '-1', '--format=%h'],
+                fallback : 'unknown',
+                input : '../README.md',
+                output : 'README.md',
+                replace_string: '__GIT_VERSION__')
+
+src_doxygen = files(
+       # source files
+       '../src/libinput.h',
+       # written docs
+       'absolute-axes.dox',
+       'absolute-coordinate-ranges.dox',
+       'architecture.dox',
+       'building.dox',
+       'button_debouncing.dox',
+       'clickpad-softbuttons.dox',
+       'contributing.dox',
+       'device-configuration-via-udev.dox',
+       'device-quirks.dox',
+       'faqs.dox',
+       'gestures.dox',
+       'middle-button-emulation.dox',
+       'normalization-of-relative-motion.dox',
+       'palm-detection.dox',
+       'page-hierarchy.dox',
+       'pointer-acceleration.dox',
+       'reporting-bugs.dox',
+       'scrolling.dox',
+       'seats.dox',
+       'switches.dox',
+       't440-support.dox',
+       'tablet-support.dox',
+       'tapping.dox',
+       'test-suite.dox',
+       'timestamps.dox',
+       'tools.dox',
+       'touchpad-jumping-cursors.dox',
+       'touchpad-pressure.dox',
+       'touchpad-jitter.dox',
+       'touchpads.dox',
+       'trackpoints.dox',
+       'what-is-libinput.dox',
+       # dot drawings
+       'dot/seats-sketch.gv',
+       'dot/seats-sketch-libinput.gv',
+       'dot/libinput-stack-wayland.gv',
+       'dot/libinput-stack-xorg.gv',
+       'dot/libinput-stack-gnome.gv',
+       'dot/evemu.gv',
+       # svgs
+       'svg/button-debouncing-wave-diagram.svg',
+       'svg/button-scrolling.svg',
+       'svg/clickfinger.svg',
+       'svg/clickfinger-distance.svg',
+       'svg/edge-scrolling.svg',
+       'svg/gesture-2fg-ambiguity.svg',
+       'svg/palm-detection.svg',
+       'svg/pinch-gestures.svg',
+       'svg/pinch-gestures-softbuttons.svg',
+       'svg/ptraccel-linear.svg',
+       'svg/ptraccel-low-dpi.svg',
+       'svg/ptraccel-touchpad.svg',
+       'svg/ptraccel-trackpoint.svg',
+       'svg/software-buttons.svg',
+       'svg/swipe-gestures.svg',
+       'svg/tablet-axes.svg',
+       'svg/tablet-cintiq24hd-modes.svg',
+       'svg/tablet-interfaces.svg',
+       'svg/tablet-intuos-modes.svg',
+       'svg/tablet-left-handed.svg',
+       'svg/tablet-out-of-bounds.svg',
+       'svg/tablet.svg',
+       'svg/tap-n-drag.svg',
+       'svg/thumb-detection.svg',
+       'svg/top-software-buttons.svg',
+       'svg/touchscreen-gestures.svg',
+       'svg/twofinger-scrolling.svg',
+       # style files
+       'style/header.html',
+       'style/footer.html',
+       'style/customdoxygen.css',
+       'style/bootstrap.css',
+       'style/libinputdoxygen.css',
+)
+
+doxyfiles = custom_target('doxyfiles',
+                         input : src_doxygen,
+                         output : '.',
+                         command : [prg_install, '-t', '@OUTDIR@', '@INPUT@'],
+                         build_by_default: true)
+
+doc_config = configuration_data()
+doc_config.set('PACKAGE_NAME', meson.project_name())
+doc_config.set('PACKAGE_VERSION', meson.project_version())
+doc_config.set('builddir', meson.current_build_dir())
+
+doxyfile = configure_file(input : 'libinput.doxygen.in',
+                         output : 'libinput.doxygen',
+                         configuration : doc_config,
+                         install : false)
+
+custom_target('doxygen',
+             input : [ doxyfile, readme ] + src_doxygen,
+             output : [ 'Documentation' ],
+             command : [ doxygen, doxyfile ],
+             install : false,
+             depends: [doxyfiles, readme],
+             build_by_default : true)
index 9b40969..072a1e9 100644 (file)
@@ -325,149 +325,7 @@ endif
 ############ documentation ############
 
 if get_option('documentation')
-       doxygen = find_program('doxygen', required : false)
-       if not doxygen.found()
-               error('Program "doxygen" not found or not executable. Try building with -Ddocumentation=false')
-       endif
-       dot = find_program('dot', required : false)
-       if not dot.found()
-               error('Program "dot" not found or not executable. Try building with -Ddocumentation=false')
-       endif
-
-       doxygen_version_cmd = run_command(doxygen.path(), '--version')
-       if doxygen_version_cmd.returncode() != 0
-               error('Command "doxygen --version" failed.')
-       endif
-       doxygen_version = doxygen_version_cmd.stdout()
-       if doxygen_version.version_compare('< 1.8.3')
-               error('doxygen needs to be at least version 1.8.3 (have @0@)'.format(doxygen_version))
-       endif
-       grep = find_program('grep')
-       dot_version_cmd = run_command(dot.path(), '-V')
-       if dot_version_cmd.returncode() != 0
-               error('Command "dot -V" failed.')
-       endif
-       # dot -V output is (to stderr):
-       #       dot - graphviz version 2.38.0 (20140413.2041)
-       dot_version = dot_version_cmd.stderr().split(' ')[4]
-       if dot_version.version_compare('< 2.26')
-               error('Graphviz dot needs to be at least version 2.26 (have @0@)'.format(dot_version))
-       endif
-
-       readme = vcs_tag(command : ['git', 'log', '-1', '--format=%h'],
-                        fallback : 'unknown',
-                        input : 'README.md',
-                        output : 'README.md',
-                        replace_string: '__GIT_VERSION__')
-
-       src_doxygen = files(
-               # source files
-               'src/libinput.h',
-               # written docs
-               'doc/absolute-axes.dox',
-               'doc/absolute-coordinate-ranges.dox',
-               'doc/architecture.dox',
-               'doc/building.dox',
-               'doc/button_debouncing.dox',
-               'doc/clickpad-softbuttons.dox',
-               'doc/contributing.dox',
-               'doc/device-configuration-via-udev.dox',
-               'doc/device-quirks.dox',
-               'doc/faqs.dox',
-               'doc/gestures.dox',
-               'doc/middle-button-emulation.dox',
-               'doc/normalization-of-relative-motion.dox',
-               'doc/palm-detection.dox',
-               'doc/page-hierarchy.dox',
-               'doc/pointer-acceleration.dox',
-               'doc/reporting-bugs.dox',
-               'doc/scrolling.dox',
-               'doc/seats.dox',
-               'doc/switches.dox',
-               'doc/t440-support.dox',
-               'doc/tablet-support.dox',
-               'doc/tapping.dox',
-               'doc/test-suite.dox',
-               'doc/timestamps.dox',
-               'doc/tools.dox',
-               'doc/touchpad-jumping-cursors.dox',
-               'doc/touchpad-pressure.dox',
-               'doc/touchpad-jitter.dox',
-               'doc/touchpads.dox',
-               'doc/trackpoints.dox',
-               'doc/what-is-libinput.dox',
-               # dot drawings
-               'doc/dot/seats-sketch.gv',
-               'doc/dot/seats-sketch-libinput.gv',
-               'doc/dot/libinput-stack-wayland.gv',
-               'doc/dot/libinput-stack-xorg.gv',
-               'doc/dot/libinput-stack-gnome.gv',
-               'doc/dot/evemu.gv',
-               # svgs
-               'doc/svg/button-debouncing-wave-diagram.svg',
-               'doc/svg/button-scrolling.svg',
-               'doc/svg/clickfinger.svg',
-               'doc/svg/clickfinger-distance.svg',
-               'doc/svg/edge-scrolling.svg',
-               'doc/svg/gesture-2fg-ambiguity.svg',
-               'doc/svg/palm-detection.svg',
-               'doc/svg/pinch-gestures.svg',
-               'doc/svg/pinch-gestures-softbuttons.svg',
-               'doc/svg/ptraccel-linear.svg',
-               'doc/svg/ptraccel-low-dpi.svg',
-               'doc/svg/ptraccel-touchpad.svg',
-               'doc/svg/ptraccel-trackpoint.svg',
-               'doc/svg/software-buttons.svg',
-               'doc/svg/swipe-gestures.svg',
-               'doc/svg/tablet-axes.svg',
-               'doc/svg/tablet-cintiq24hd-modes.svg',
-               'doc/svg/tablet-interfaces.svg',
-               'doc/svg/tablet-intuos-modes.svg',
-               'doc/svg/tablet-left-handed.svg',
-               'doc/svg/tablet-out-of-bounds.svg',
-               'doc/svg/tablet.svg',
-               'doc/svg/tap-n-drag.svg',
-               'doc/svg/thumb-detection.svg',
-               'doc/svg/top-software-buttons.svg',
-               'doc/svg/touchscreen-gestures.svg',
-               'doc/svg/twofinger-scrolling.svg',
-               # style files
-               'doc/style/header.html',
-               'doc/style/footer.html',
-               'doc/style/customdoxygen.css',
-               'doc/style/bootstrap.css',
-               'doc/style/libinputdoxygen.css',
-       )
-
-       # doxygen expects a space-separated list of input files in its
-       # doxyfile so we build a new list containing all full paths
-       # and merge it with ' '.join() later
-       doxy_input_files = []
-       foreach f : src_doxygen
-               doxy_input_files += [join_paths(meson.source_root(), '@0@'.format(f))]
-       endforeach
-
-       doxy_input_files += [readme.full_path()]
-
-       doc_config = configuration_data()
-       doc_config.set('PACKAGE_NAME', meson.project_name())
-       doc_config.set('PACKAGE_VERSION', meson.project_version())
-       doc_config.set('top_srcdir', meson.source_root())
-       doc_config.set('INPUT', ' '.join(doxy_input_files))
-       doc_config.set('README_MD', readme.full_path())
-
-       doxyfile = configure_file(input : 'doc/libinput.doxygen.in',
-                                 output : 'libinput.doxygen',
-                                 configuration : doc_config,
-                                 install : false)
-
-       custom_target('doxygen',
-                     input : [ doxyfile, readme ] + src_doxygen,
-                     output : [ 'Documentation' ],
-                     command : [ doxygen, doxyfile ],
-                     install : false,
-                     build_by_default : true)
-
+       subdir('doc')
 endif
 
 ############ tools ############