From b1a606c8e6762a429f84a0d9f795257af4f51e29 Mon Sep 17 00:00:00 2001 From: Daniel Vollmer Date: Thu, 5 Mar 2015 14:30:54 +0100 Subject: [PATCH] Generate doxygen into a sub-folder of build When no OUTPUT_DIRECTORY was set for doxygen, then the parent directory of the doxyfile was used. If the doxyfile is in the root-directory, then this was the build-directory itself, which led to the complete build-directory (including all other build artifacts) to be installed. The OUTPUT_DIRECTORY set (if not given) now includes the name of the doxyfile itself (+ suffix '.doxy'). The install of doxygen-generated files also did not preserve the directory structure. The doxy playground example was simplified and updated, as separate installation is no longer needed. Signed-off-by: Thomas Nagy --- playground/doxy/wscript | 13 ++----------- waflib/extras/doxygen.py | 16 ++++++++++------ 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/playground/doxy/wscript b/playground/doxy/wscript index e227792b..7ed4ffcc 100644 --- a/playground/doxy/wscript +++ b/playground/doxy/wscript @@ -30,20 +30,11 @@ def configure(conf): # def build(bld): + # if the documentation is to packed, simply set doxy_tar to the filename bld( features='doxygen', doxyfile='test.conf', - doxy_tar='docs.tar.bz2') - - # if the documentation is to be installed - bld.add_group() - bld.post_mode = Build.POST_LAZY - bld(features='special_doxygen_stuff') - - @TaskGen.feature('special_doxygen_stuff') - def special_doxygen_stuff(self): - node = self.path.get_bld().make_node('html') - self.bld.install_files('${PREFIX}/doc/html', node.ant_glob('**', remove=False)) + install_path='${PREFIX}/doc') # and additional targets bld(features='cxx cxxshlib', source='subdir/c.cpp', target='somelib') diff --git a/waflib/extras/doxygen.py b/waflib/extras/doxygen.py index 7f30b2c9..acd4398d 100644 --- a/waflib/extras/doxygen.py +++ b/waflib/extras/doxygen.py @@ -8,6 +8,9 @@ Doxygen support Variables passed to bld(): * doxyfile -- the Doxyfile to use +* doxy_tar -- destination archive for generated documentation (if desired) +* install_path -- where to install the documentation +* pars -- dictionary overriding doxygen configuration settings When using this tool, the wscript will look like: @@ -79,12 +82,11 @@ class doxygen(Task.Task): if self.pars.get('OUTPUT_DIRECTORY'): # Use the path parsed from the Doxyfile as an absolute path output_node = self.inputs[0].parent.get_bld().make_node(self.pars['OUTPUT_DIRECTORY']) - output_node.mkdir() - self.pars['OUTPUT_DIRECTORY'] = output_node.abspath() else: - # If no OUTPUT_PATH was specified in the Doxyfile build path from where the Doxyfile lives - self.inputs[0].parent.get_bld().mkdir() - self.pars['OUTPUT_DIRECTORY'] = self.inputs[0].parent.get_bld().abspath() + # If no OUTPUT_PATH was specified in the Doxyfile, build path from the Doxyfile name + '.doxy' + output_node = self.inputs[0].parent.get_bld().make_node(self.inputs[0].name + '.doxy') + output_node.mkdir() + self.pars['OUTPUT_DIRECTORY'] = output_node.abspath() # Override with any parameters passed to the task generator if getattr(self.generator, 'pars', None): @@ -149,7 +151,9 @@ class doxygen(Task.Task): if not getattr(self.generator, 'doxy_tar', None): self.generator.bld.install_files(self.generator.install_path, self.outputs, - postpone=False) + postpone=False, + cwd=self.output_dir, + relative_trick=True) return Task.Task.post_run(self) class tar(Task.Task):