[README,doc,meson*] Rework documentation build

* Avoid going through hoops to silently enable docs if doxygen is
  available
* Require build-doc explicitly set to true before scanning for doxygen
* build-doc is conservatively false by default
* Update README
This commit is contained in:
Lorenzo Cogotti 2023-05-25 22:51:22 +02:00
parent 20d0b9bd44
commit d09c5ddee4
4 changed files with 12 additions and 10 deletions

View File

@ -90,15 +90,18 @@ for more advanced build management tasks.
The Micro BGP Suite uses [Doxygen](https://www.doxygen.org/index.html) to document its API. The Micro BGP Suite uses [Doxygen](https://www.doxygen.org/index.html) to document its API.
In order to build `µbgpsuite` documentation you must enable the `build-doc` In order to build `µbgpsuite` documentation you must enable the `build-doc`
configure flag. This flag is enabled automatically if you have `doxygen` configure flag.
installed in your system when you run `meson` to configure the project for the
first time. To do so, run the following command inside an already existing `build` directory:
```sh
$ meson configure -Dbuild-doc=true
```
Once the flag is enabled, you can use: Once the flag is enabled, you can use:
```sh ```sh
$ ninja doc $ ninja doc
``` ```
inside build directory to generate Doxygen documentation. inside the build directory to generate the Doxygen documentation.
You can access the documentation by pointing your web browser to You can access the documentation by pointing your web browser to
`doc/html/index.html` inside the build directory. `doc/html/index.html` inside the build directory.

View File

@ -6,6 +6,8 @@ cdata = configuration_data({
'PROJECT_NAME': meson.project_name(), 'PROJECT_NAME': meson.project_name(),
}) })
doxygen = find_program('doxygen')
doxyfile = configure_file(input : 'Doxyfile.in', doxyfile = configure_file(input : 'Doxyfile.in',
output : 'Doxyfile', output : 'Doxyfile',
configuration : cdata, configuration : cdata,

View File

@ -97,11 +97,8 @@ lonetix_dep = declare_dependency(compile_args : lonetix_args,
# TODO # TODO
# endif # endif
doxygen = find_program('doxygen', required : get_option('build-doc')) if get_option('build-doc')
if doxygen.found()
subdir('doc') subdir('doc')
elif get_option('build-doc').auto()
message('Not building documentation as doxygen was not found')
endif endif
if get_option('build-bgpgrep') if get_option('build-bgpgrep')

View File

@ -1,5 +1,5 @@
option('native', type : 'boolean', value : false, description : 'Optimize build for local CPU architecture (ties build artifacts to your local machine!)') option('native', type : 'boolean', value : false, description : 'Optimize build for local CPU architecture (ties build artifacts to your local machine!)')
option('build-doc', type : 'boolean', description : 'Build documentation using doxygen') option('build-doc', type : 'boolean', value : false, description : 'Build documentation using doxygen')
# TODO option('build-benchmarks', type : 'boolean', value : false, description : 'Build benchmarks') # TODO option('build-benchmarks', type : 'boolean', value : false, description : 'Build benchmarks')
option('build-tests', type : 'boolean', value : false, description : 'Build tests') option('build-tests', type : 'boolean', value : false, description : 'Build tests')
option('build-bgpgrep', type : 'boolean', description : 'Build bgpgrep MRT/BGP parsing and filting utility') option('build-bgpgrep', type : 'boolean', description : 'Build bgpgrep MRT/BGP parsing and filting utility')