diff --git a/doc/SConscript b/doc/SConscript index 58a2e43..e051797 100644 --- a/doc/SConscript +++ b/doc/SConscript @@ -1,61 +1,71 @@ # -*- coding: utf-8 -*- # @file # @section LICENSE # # Copyright (©) 2016-2021 EPFL (École Polytechnique Fédérale de Lausanne), # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . from __future__ import print_function +import os + from os.path import join -from SCons.Script import Import, Glob, Dir, Copy +from SCons.Script import Import, Glob, Dir, File + Import('main_env') Import('libTamaas') doc_env = main_env.Clone() # Generating Doxyfile doxyfile_target = doc_env.Substfile('doxygen/Doxyfile', 'doxygen/Doxyfile.in', SUBST_DICT={ '@version@': '$version', '@build_dir@': Dir('doxygen').path, '@logo@': File('icon.svg').path, - '@src_dir@': Dir('../src/').path, + '@src_dir@': Dir('#src').abspath, }) # Generate Doxygen API documentation doc_env.Tool('doxygen') -doxygen_target = doc_env.Doxygen('doxygen/xml/index.xml', [doxyfile_target, 'icon.svg']) -doc_env.Depends(doxygen_target, libTamaas) +doxygen_target = doc_env.Doxygen('doxygen/xml/index.xml', + [doxyfile_target, 'icon.svg']) + +# Adding all source files as dependencies +sources = [] +for root, _, files in os.walk(Dir('#src').abspath): + sources += Glob(join(root, '*.hh')) + sources += Glob(join(root, '*.cpp')) +doc_env.Depends(doxygen_target, sources) # Generate Sphinx User documentation doc_env.Tool('sphinx') sphinx_target = doc_env.Sphinx('sphinx/html/index.html', [Glob('sphinx/source/*'), Glob('sphinx/source/figures/*')]) doc_env.Depends(sphinx_target, doxygen_target) # Alias for both docs doc_targets = [doxygen_target, sphinx_target] main_env.Alias('build-doc', doc_targets) # Install target for documentation doc_prefix = join(doc_env['prefix'], 'share', 'doc', 'tamaas') doc_install = doc_env.Install(target=doc_prefix, source=doc_targets) main_env.Alias('install-doc', doc_install)