From e0ec10172b3b28ceb30e824afa383f66f1d1422e Mon Sep 17 00:00:00 2001 From: project-repo Date: Sun, 7 Jun 2020 09:29:37 +0200 Subject: [PATCH] Support documentation build using meson --- doxygen_config => doxygen_config.in | 10 ++++----- meson.build | 32 ++++++++++++++++++++++++++--- meson_options.txt | 1 + 3 files changed, 35 insertions(+), 8 deletions(-) rename doxygen_config => doxygen_config.in (99%) diff --git a/doxygen_config b/doxygen_config.in similarity index 99% rename from doxygen_config rename to doxygen_config.in index e48a4b4..9fd3590 100644 --- a/doxygen_config +++ b/doxygen_config.in @@ -32,19 +32,19 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = "Cagebreak" +PROJECT_NAME = @PROJECT_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.3.1 +PROJECT_NUMBER = @PROJECT_VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = "Tiling wayland compositor" +PROJECT_BRIEF = @PROJECT_BRIEF@ # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 @@ -756,7 +756,7 @@ CITE_BIB_FILES = # messages are off. # The default value is: NO. -QUIET = NO +QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated to standard error (stderr) by doxygen. If WARNINGS is set to YES @@ -823,7 +823,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = +INPUT = @PROJECT_ROOT_DIR@ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/meson.build b/meson.build index c6676ea..4ff49c4 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('cagebreak', 'c', +project('Cagebreak', 'c', version: '1.3.1', license: 'MIT', default_options: [ @@ -229,7 +229,7 @@ elif cc.version() != reproducible_build_compiler_version endif executable( - meson.project_name(), + meson.project_name().to_lower(), cagebreak_main_file + cagebreak_sources + cagebreak_headers, dependencies: cagebreak_dependencies, install: true, @@ -257,13 +257,39 @@ cagebreak_man = custom_target('cagebreak_config_man', install_dir: mandir5 ) +if get_option('documentation') + doxygen = find_program('doxygen', required: false) + if not doxygen.found() + error('Program "doxygen" not found. Try building with -Ddocumentation=false') + endif + + doc_config = configuration_data() + doc_config.set('PROJECT_ROOT_DIR', meson.source_root()) + doc_config.set('PROJECT_VERSION', version) + doc_config.set('PROJECT_BRIEF', '"Tiling wayland compositor"') + doc_config.set('PROJECT_NAME', meson.project_name()) + + doxyfile = configure_file(input: 'doxygen_config.in', + output: 'doxygen_config', + configuration: doc_config, + install: false) + + cagebreak_doc = custom_target('cagebreak_doc', + input : [cagebreak_main_file + cagebreak_source_strings + cagebreak_header_strings, doxyfile], + command : [doxygen, doxyfile], + install : false, + output : [ 'doc' ], + build_by_default : true, + ) +endif + if get_option('fuzz') subdir('fuzz') endif summary = [ '', - 'Cagebreak @0@'.format(version), + '@0@ @1@'.format(meson.project_name(),version), '', ' xwayland: @0@'.format(have_xwayland), '' diff --git a/meson_options.txt b/meson_options.txt index bb96c4f..c524502 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,4 @@ option('xwayland', type: 'boolean', value: 'false', description: 'Enable support for X11 applications') option('fuzz', type: 'boolean', value: 'false', description: 'Enable building fuzzer targets') option('version_override', type: 'string', description: 'Set the project version to the string specified. Used for creating hashes for reproducible builds.') +option('documentation', type: 'boolean', value: 'true', description: 'Build documentation. Requires doxygen.')