Fix some #include problems.
[alexxy/gromacs.git] / doxygen / CMakeLists.txt
1 #
2 # This file is part of the GROMACS molecular simulation package.
3 #
4 # Copyright (c) 2012,2013, 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.
8 #
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.
13 #
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.
18 #
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.
23 #
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.
31 #
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.
34
35 find_package(Doxygen)
36 if (DOXYGEN_FOUND)
37     # This logic closely follows that found in FindDoxygen.cmake for dot,
38     # except that the PATH variable is not cached.
39     FIND_PROGRAM(DOXYGEN_MSCGEN_EXECUTABLE
40         NAMES mscgen
41         DOC "Message sequence chart renderer tool (http://www.mcternan.me.uk/mscgen/)")
42     if (DOXYGEN_MSCGEN_EXECUTABLE)
43         set(DOXYGEN_MSCGEN_FOUND TRUE)
44         get_filename_component(DOXYGEN_MSCGEN_PATH "${DOXYGEN_MSCGEN_EXECUTABLE}" PATH)
45     endif (DOXYGEN_MSCGEN_EXECUTABLE)
46     mark_as_advanced(DOXYGEN_MSCGEN_EXECUTABLE)
47 endif (DOXYGEN_FOUND)
48
49 ########################################################################
50 # Doxygen configuration
51 ########################################################################
52 if (DOXYGEN_FOUND)
53     FILE(GLOB NB_KERNEL_DIRS
54          ${CMAKE_SOURCE_DIR}/src/gromacs/gmxlib/nonbonded/nb_kernel_*/)
55     LIST(REMOVE_ITEM NB_KERNEL_DIRS
56          ${CMAKE_SOURCE_DIR}/src/gromacs/gmxlib/nonbonded/nb_kernel_c)
57     FOREACH(NB_KERNEL_DIR ${NB_KERNEL_DIRS})
58         SET(NB_KERNEL_DIRS_TO_IGNORE_IN_DOXYGEN
59             "${NB_KERNEL_DIRS_TO_IGNORE_IN_DOXYGEN} \\\n                         ${NB_KERNEL_DIR}")
60     ENDFOREACH(NB_KERNEL_DIR)
61     set(DOXYGEN_SECTIONS "")
62     CONFIGURE_FILE(Doxyfile-common.cmakein Doxyfile-common)
63     CONFIGURE_FILE(Doxyfile-full.cmakein Doxyfile-full)
64     CONFIGURE_FILE(Doxyfile-lib.cmakein Doxyfile-lib)
65     CONFIGURE_FILE(Doxyfile-user.cmakein Doxyfile-user)
66
67     FILE(COPY index.html DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
68     configure_file(RunDoxygen.cmake.cmakein RunDoxygen.cmake @ONLY)
69     add_custom_target(doc-full
70         ${CMAKE_COMMAND} -DDOCTYPE=full -P RunDoxygen.cmake
71         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
72         COMMENT "Generating full documentation with Doxygen" VERBATIM)
73     add_custom_target(doc-lib
74         ${CMAKE_COMMAND} -DDOCTYPE=lib -P RunDoxygen.cmake
75         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
76         COMMENT "Generating library documentation with Doxygen" VERBATIM)
77     add_custom_target(doc-user
78         ${CMAKE_COMMAND} -DDOCTYPE=user -P RunDoxygen.cmake
79         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
80         COMMENT "Generating public API documentation with Doxygen" VERBATIM)
81     add_custom_target(doc-all)
82     add_dependencies(doc-all doc-full doc-lib doc-user)
83
84     if (GMX_GIT_VERSION_INFO)
85         add_custom_target(doxygen-version
86                 COMMAND ${CMAKE_COMMAND}
87                     -D GIT_EXECUTABLE="${GIT_EXECUTABLE}"
88                     -D PROJECT_VERSION="${PROJECT_VERSION}"
89                     -D PROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}"
90                     -D VERSION_CMAKEIN="${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile-version.cmakein"
91                     -D VERSION_OUT="${CMAKE_CURRENT_BINARY_DIR}/Doxyfile-version"
92                     -D VERSION_NO_REMOTE_HASH=
93                     -P ${CMAKE_SOURCE_DIR}/cmake/gmxGenerateVersionInfo.cmake
94                 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
95                 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile-version.cmakein
96                 COMMENT "Generating version information for Doxygen")
97         add_dependencies(doc-full doxygen-version)
98         add_dependencies(doc-lib doxygen-version)
99         add_dependencies(doc-user doxygen-version)
100     else()
101         set(GMX_PROJECT_VERSION_STR ${PROJECT_VERSION})
102         configure_file(Doxyfile-version.cmakein Doxyfile-version)
103     endif()
104 endif (DOXYGEN_FOUND)
105
106 find_package(PythonInterp)
107
108 if (PYTHONINTERP_FOUND AND NOT PYTHON_VERSION_STRING VERSION_LESS "2.6")
109     add_custom_target(depgraphs
110         ${CMAKE_COMMAND}
111         -DSRCDIR=${CMAKE_SOURCE_DIR}
112         -DBUILDDIR=${CMAKE_BINARY_DIR}
113         -DOUTDIR=${CMAKE_BINARY_DIR}/doxygen/depgraphs
114         -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
115         -DDOT_EXECUTABLE=${DOXYGEN_DOT_EXECUTABLE}
116         -DMODE=GRAPHS
117         -P ${CMAKE_SOURCE_DIR}/admin/includedeps.cmake
118         COMMENT "Generating include dependency graphs" VERBATIM)
119     # TODO: This should be moved away from here and preferably made into
120     # a CTest test.
121     # TODO: To do the above, issues found by the script should be fixed.
122     # A suppression system would also be good to have, since it would be
123     # nice to include also legacyheaders in the checks, but those generate
124     # a lot of errors about missing documentation.  The script is also
125     # currently quite strict, so I don't know whether we really want to
126     # enforce all the rules.
127     # TODO: Would be nice to not generate the file lists for each of these,
128     # but what would be a good shared location for the intermediate files?
129     add_custom_target(depcheck
130         ${CMAKE_COMMAND}
131         -DSRCDIR=${CMAKE_SOURCE_DIR}
132         -DBUILDDIR=${CMAKE_BINARY_DIR}
133         -DOUTDIR=${CMAKE_BINARY_DIR}/doxygen/depgraphs
134         -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
135         -DMODE=CHECK
136         -P ${CMAKE_SOURCE_DIR}/admin/includedeps.cmake
137         COMMENT "Checking include dependencies" VERBATIM)
138     add_custom_target(doccheck
139         ${CMAKE_COMMAND}
140         -DSRCDIR=${CMAKE_SOURCE_DIR}
141         -DBUILDDIR=${CMAKE_BINARY_DIR}
142         -DOUTDIR=${CMAKE_BINARY_DIR}/doxygen/depgraphs
143         -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
144         -DMODE=CHECKDOC
145         -P ${CMAKE_SOURCE_DIR}/admin/includedeps.cmake
146         COMMENT "Checking some aspects of Doxygen documentation" VERBATIM)
147 endif ()