Optimize Doxygen build
[gromacs/AngularHB.git] / doxygen / CMakeLists.txt
blobcfa72f74100156f2151ff387f1b05c488a28860b
2 # This file is part of the GROMACS molecular simulation package.
4 # Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 # and including many others, as listed in the AUTHORS file in the
7 # top-level source directory and at http://www.gromacs.org.
9 # GROMACS is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public License
11 # as published by the Free Software Foundation; either version 2.1
12 # of the License, or (at your option) any later version.
14 # GROMACS is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # Lesser General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with GROMACS; if not, see
21 # http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
24 # If you want to redistribute modifications to GROMACS, please
25 # consider that scientific software is very special. Version
26 # control is crucial - bugs must be traceable. We will be happy to
27 # consider code for inclusion in the official distribution, but
28 # derived work must not be called official GROMACS. Details are found
29 # in the README & COPYING files - if they are missing, get the
30 # official version at http://www.gromacs.org.
32 # To help us fund GROMACS development, we humbly ask that you cite
33 # the research papers on the package. Check out http://www.gromacs.org.
35 include(gmxOptionUtilities)
37 find_package(Doxygen)
38 if (DOXYGEN_FOUND)
39     # This logic closely follows that found in FindDoxygen.cmake for dot,
40     # except that the PATH variable is not cached.
41     FIND_PROGRAM(DOXYGEN_MSCGEN_EXECUTABLE
42         NAMES mscgen
43         DOC "Message sequence chart renderer tool (http://www.mcternan.me.uk/mscgen/)")
44     if (DOXYGEN_MSCGEN_EXECUTABLE)
45         set(DOXYGEN_MSCGEN_FOUND TRUE)
46         get_filename_component(DOXYGEN_MSCGEN_PATH "${DOXYGEN_MSCGEN_EXECUTABLE}" PATH)
47     endif (DOXYGEN_MSCGEN_EXECUTABLE)
48     mark_as_advanced(DOXYGEN_MSCGEN_EXECUTABLE)
49 endif (DOXYGEN_FOUND)
51 gmx_dependent_option(
52     GMX_COMPACT_DOXYGEN
53     "Skip parts of Doxygen documentation (in particular, many graphs) to save disk space and time"
54     OFF
55     DOXYGEN_FOUND)
56 mark_as_advanced(GMX_COMPACT_DOXYGEN)
58 ########################################################################
59 # Doxygen configuration
60 ########################################################################
61 if (DOXYGEN_FOUND)
62     FILE(GLOB NB_KERNEL_DIRS
63          ${CMAKE_SOURCE_DIR}/src/gromacs/gmxlib/nonbonded/nb_kernel_*/)
64     LIST(REMOVE_ITEM NB_KERNEL_DIRS
65          ${CMAKE_SOURCE_DIR}/src/gromacs/gmxlib/nonbonded/nb_kernel_c)
66     FOREACH(NB_KERNEL_DIR ${NB_KERNEL_DIRS})
67         SET(NB_KERNEL_DIRS_TO_IGNORE_IN_DOXYGEN
68             "${NB_KERNEL_DIRS_TO_IGNORE_IN_DOXYGEN} \\\n                         ${NB_KERNEL_DIR}")
69     ENDFOREACH(NB_KERNEL_DIR)
70     set(DOXYGEN_SECTIONS "")
71     CONFIGURE_FILE(Doxyfile-common.cmakein Doxyfile-common)
72     CONFIGURE_FILE(Doxyfile-full.cmakein Doxyfile-full)
73     CONFIGURE_FILE(Doxyfile-lib.cmakein Doxyfile-lib)
74     CONFIGURE_FILE(Doxyfile-user.cmakein Doxyfile-user)
76     if (GMX_COMPACT_DOXYGEN)
77         FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile-common
78              "@INCLUDE   = ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile-compact\n")
79     endif()
81     FILE(COPY index.html DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
82     configure_file(RunDoxygen.cmake.cmakein RunDoxygen.cmake @ONLY)
83     add_custom_target(doc-full
84         ${CMAKE_COMMAND} -DDOCTYPE=full -P RunDoxygen.cmake
85         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
86         COMMENT "Generating full documentation with Doxygen" VERBATIM)
87     add_custom_target(doc-lib
88         ${CMAKE_COMMAND} -DDOCTYPE=lib -P RunDoxygen.cmake
89         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
90         COMMENT "Generating library documentation with Doxygen" VERBATIM)
91     add_custom_target(doc-user
92         ${CMAKE_COMMAND} -DDOCTYPE=user -P RunDoxygen.cmake
93         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
94         COMMENT "Generating public API documentation with Doxygen" VERBATIM)
95     add_custom_target(doc-all)
96     add_dependencies(doc-all doc-full doc-lib doc-user)
98     if (GMX_GIT_VERSION_INFO)
99         add_custom_target(doxygen-version
100                 COMMAND ${CMAKE_COMMAND}
101                     -D GIT_EXECUTABLE="${GIT_EXECUTABLE}"
102                     -D PROJECT_VERSION="${PROJECT_VERSION}"
103                     -D PROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}"
104                     -D VERSION_CMAKEIN="${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile-version.cmakein"
105                     -D VERSION_OUT="${CMAKE_CURRENT_BINARY_DIR}/Doxyfile-version"
106                     -D VERSION_NO_REMOTE_HASH=
107                     -P ${CMAKE_SOURCE_DIR}/cmake/gmxGenerateVersionInfo.cmake
108                 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
109                 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile-version.cmakein
110                 COMMENT "Generating version information for Doxygen")
111         add_dependencies(doc-full doxygen-version)
112         add_dependencies(doc-lib doxygen-version)
113         add_dependencies(doc-user doxygen-version)
114     else()
115         set(GMX_PROJECT_VERSION_STR ${PROJECT_VERSION})
116         configure_file(Doxyfile-version.cmakein Doxyfile-version)
117     endif()
118 endif (DOXYGEN_FOUND)
120 find_package(PythonInterp)
122 if (PYTHONINTERP_FOUND AND NOT PYTHON_VERSION_STRING VERSION_LESS "2.6")
123     add_custom_target(depgraphs
124         ${CMAKE_COMMAND}
125         -DSRCDIR=${CMAKE_SOURCE_DIR}
126         -DBUILDDIR=${CMAKE_BINARY_DIR}
127         -DOUTDIR=${CMAKE_BINARY_DIR}/doxygen/depgraphs
128         -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
129         -DDOT_EXECUTABLE=${DOXYGEN_DOT_EXECUTABLE}
130         -DMODE=GRAPHS
131         -P ${CMAKE_SOURCE_DIR}/admin/includedeps.cmake
132         COMMENT "Generating include dependency graphs" VERBATIM)
133     # TODO: This should be moved away from here and preferably made into
134     # a CTest test.
135     # TODO: To do the above, issues found by the script should be fixed.
136     # A suppression system would also be good to have, since it would be
137     # nice to include also legacyheaders in the checks, but those generate
138     # a lot of errors about missing documentation.  The script is also
139     # currently quite strict, so I don't know whether we really want to
140     # enforce all the rules.
141     # TODO: Would be nice to not generate the file lists for each of these,
142     # but what would be a good shared location for the intermediate files?
143     add_custom_target(depcheck
144         ${CMAKE_COMMAND}
145         -DSRCDIR=${CMAKE_SOURCE_DIR}
146         -DBUILDDIR=${CMAKE_BINARY_DIR}
147         -DOUTDIR=${CMAKE_BINARY_DIR}/doxygen/depgraphs
148         -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
149         -DMODE=CHECK
150         -P ${CMAKE_SOURCE_DIR}/admin/includedeps.cmake
151         COMMENT "Checking include dependencies" VERBATIM)
152     add_custom_target(doccheck
153         ${CMAKE_COMMAND}
154         -DSRCDIR=${CMAKE_SOURCE_DIR}
155         -DBUILDDIR=${CMAKE_BINARY_DIR}
156         -DOUTDIR=${CMAKE_BINARY_DIR}/doxygen/depgraphs
157         -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
158         -DMODE=CHECKDOC
159         -P ${CMAKE_SOURCE_DIR}/admin/includedeps.cmake
160         COMMENT "Checking some aspects of Doxygen documentation" VERBATIM)
161 endif ()