Split up special topics section in manual
[gromacs.git] / docs / CMakeLists.txt
blob704c15f901cfda4f8264b5561cc3aa081469688c
2 # This file is part of the GROMACS molecular simulation package.
4 # Copyright (c) 2014,2015,2016,2017,2018, 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 # This directory provides a unified place for building all kinds of
36 # GROMACS documentation. This includes some "static" content (Doxygen
37 # code documentation, reference manual, install guide, old online HTML
38 # images), and content generated from the gmx program for the various
39 # tools (man and HTML pages). It also provides the "webpage" target,
40 # that combines all of the above (except man pages in man format) into
41 # a form suitable for automated deployment to the GROMACS website. It
42 # also provides the INSTALL file for the tarball.
44 # The webpage is mostly built by Sphinx.  Variable values for Sphinx
45 # substitutions are configured by CMake (for things like version numbers),
46 # using gmx_configure_version_file().  This happens during build time instead
47 # of configure time, because 1) some of the version variables are only
48 # available during build time, and 2) we don't want to do all the Sphinx setup
49 # during configuration to save some time when not building the content.
50 # All the generated values get put into conf-vars.py (generated from
51 # conf-vars.py.cmakein), which in turn is included by the Sphinx configuration
52 # file conf.py.
54 set(SOURCE_MD5SUM "unknown" CACHE STRING
55     "MD5 sum of the source tarball, normally used only for the pre-release webpage build")
56 # REGRESSIONTEST_MD5SUM is set in cmake/gmxVersionInfo.cmake because it is used also in tests/CMakeLists.txt
57 mark_as_advanced(SOURCE_MD5SUM)
59 set(EXPECTED_DOXYGEN_VERSION 1.8.5)
61 set(EXPECTED_SPHINX_VERSION 1.6.1)
63 if (DEFINED PYTHON_EXECUTABLE)
64     # Keep quiet on subsequent runs of cmake
65     set(PythonInterp_FIND_QUIETLY ON)
66 endif()
67 find_package(PythonInterp 2.7)
68 find_package(Sphinx ${EXPECTED_SPHINX_VERSION} QUIET COMPONENTS pygments)
70 # Even if we aren't going to make the full webpage, set up to put all
71 # the documentation output in the same place, for convenience
72 set(HTML_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
73 file(MAKE_DIRECTORY ${HTML_OUTPUT_DIR})
75 # Prepare directories for pdf/tex output
76 set(TEX_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/manual")
77 set(SPHINX_LATEX_FILE "${TEX_OUTPUT_DIR}/gromacs.tex")
78 file(MAKE_DIRECTORY ${TEX_OUTPUT_DIR})
80 # The directory from which man pages will be installed; if it remains
81 # empty, they will be silently skipped.
82 set(MAN_PAGE_DIR)
83 if (SOURCE_IS_SOURCE_DISTRIBUTION)
84     # When building from the tarball, install the bundled man pages
85     # (unless overridden).
86     set(MAN_PAGE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
87 endif()
89 add_subdirectory(doxygen)
90 if (SPHINX_FOUND)
91     # We need to have all the Sphinx input files in a single directory, and
92     # since some of them are generated, we copy everything into the build tree,
93     # to this directory.
94     set(SPHINX_INPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/sphinx-input)
95     set(SPHINX_EXTENSION_PATH ${CMAKE_CURRENT_SOURCE_DIR})
96     # As the manual build now depends also on Sphinx, the inclusion path needs
97     # to be set after we know the basic information for Sphinx.
98     add_subdirectory(manual)
99     if (SOURCE_MD5SUM STREQUAL "unknown")
100         # But for testing the webpage build (e.g. from the repo) we
101         # need a default value.
102         set(REGRESSIONTEST_MD5SUM_STRING "unknown")
103     else()
104         # The real build of the webpage happens from the tarball, and
105         # this should be set to the matching MD5 sum.
106         set(REGRESSIONTEST_MD5SUM_STRING "${REGRESSIONTEST_MD5SUM}")
107     endif()
108     # The reference manual still contains the individual sections from the
109     # LaTeX document, with the files below grouped and annotated by chapter.
110     set(REFERENCEMANUAL_SPHINX_FILES
111         # Main index file, preface and introduction.
112         reference-manual/index.rst
113         reference-manual/preface.rst
114         reference-manual/introduction.rst
115         # Definitions and Units chapter
116         reference-manual/definitions.rst
117         # Algorithms chapter
118         reference-manual/algorithms.rst
119         reference-manual/periodic-boundary-conditions.rst
120         reference-manual/group-concept.rst
121         reference-manual/molecular-dynamics.rst
122         reference-manual/shell-molecular-dynamics.rst
123         reference-manual/constraint-algorithms.rst
124         reference-manual/simulated-annealing.rst
125         reference-manual/stochastic-dynamics.rst
126         reference-manual/brownian-dynamics.rst
127         reference-manual/energy-minimization.rst
128         reference-manual/normal-mode-analysis.rst
129         reference-manual/free-energy-calculations.rst
130         reference-manual/replica-exchange.rst
131         reference-manual/essential-dynamics.rst
132         reference-manual/expanded-ensemble.rst
133         reference-manual/parallelization-domain-decomp.rst
134         # Interaction functions and force fields chapter
135         reference-manual/functions.rst
136         reference-manual/bonded-interactions.rst
137         reference-manual/force-field.rst
138         reference-manual/free-energy-interactions.rst
139         reference-manual/interaction-methods.rst
140         reference-manual/long-range-electrostatics.rst
141         reference-manual/long-range-vdw.rst
142         reference-manual/nonbonded-interactions.rst
143         reference-manual/polarization.rst
144         reference-manual/restraints.rst
145         # Topologies chapter
146         reference-manual/topologies.rst
147         reference-manual/particle-type.rst
148         reference-manual/parameter-files.rst
149         reference-manual/molecule-definition.rst
150         reference-manual/constraint-algorithm-section.rst
151         reference-manual/pdb2gmx-input-files.rst
152         reference-manual/topology-file-formats.rst
153         reference-manual/force-field-organization.rst
154         # File formats chapter
155         reference-manual/file-formats.rst
156         # Special topics chapter
157         reference-manual/special.rst
158         reference-manual/free-energy-implementation.rst
159         reference-manual/pulling.rst
160         reference-manual/awh.rst
161         reference-manual/enforced-rotation.rst
162         reference-manual/electric-fields.rst
163         reference-manual/comp-electrophys.rst
164         reference-manual/free-energy-pmf.rst
165         reference-manual/remove-fast-dgf.rst
166         reference-manual/viscosity-calculation.rst
167         reference-manual/tabulated-interaction-functions.rst
168         reference-manual/qmmm.rst
169         reference-manual/vmd-imd.rst
170         reference-manual/membrane-embedding.rst
171         # Run parameters and programs chapter
172         reference-manual/run-parameters.rst
173         # Analysis chapter
174         reference-manual/analysis.rst
175         # Implementation details chapter
176         reference-manual/details.rst
177         # Averages and fluctations chapter
178         reference-manual/averages.rst
179         # References
180         reference-manual/references.rst
181         # PNG formated plot files that don't need to be converted into PNG
182         # for the web page.
183         reference-manual/plots/peregrine.png
184         reference-manual/plots/adress.png
185         reference-manual/plots/plotje.png
186         reference-manual/plots/xvgr.png
187         )
188     set(REFERENCEMANUAL_IMAGE_FILES 
189         reference-manual/plots/angle.pdf
190         reference-manual/plots/awh-invN.pdf
191         reference-manual/plots/awh-pmfs.pdf
192         reference-manual/plots/awh-sampleweights.pdf
193         reference-manual/plots/awh-traj.pdf
194         reference-manual/plots/bstretch.pdf
195         reference-manual/plots/chain.pdf
196         reference-manual/plots/compelsetup.pdf
197         reference-manual/plots/dd-cells.pdf
198         reference-manual/plots/dd-tric.pdf
199         reference-manual/plots/decomp.pdf
200         reference-manual/plots/dih-def.pdf
201         reference-manual/plots/dih.pdf
202         reference-manual/plots/distm.pdf
203         reference-manual/plots/drift-all.pdf
204         reference-manual/plots/dssp.pdf
205         reference-manual/plots/dumaro.pdf
206         reference-manual/plots/dummies.pdf
207         reference-manual/plots/dumtypes.pdf
208         reference-manual/plots/equipotential.pdf
209         reference-manual/plots/f-angle.pdf
210         reference-manual/plots/f-bham.pdf
211         reference-manual/plots/f-bond.pdf
212         reference-manual/plots/fbposres.pdf
213         reference-manual/plots/f-dih.pdf
214         reference-manual/plots/f-dr.pdf
215         reference-manual/plots/field.pdf
216         reference-manual/plots/fig-02.pdf
217         reference-manual/plots/fig-04.pdf
218         reference-manual/plots/f-lj.pdf
219         reference-manual/plots/flowchart.pdf
220         reference-manual/plots/f-morse.pdf
221         reference-manual/plots/fp-highres.pdf
222         reference-manual/plots/f-imps.pdf
223         reference-manual/plots/f-pr.pdf
224         reference-manual/plots/f-rbs.pdf
225         reference-manual/plots/free1.pdf
226         reference-manual/plots/free2.pdf
227         reference-manual/plots/gaussians.pdf
228         reference-manual/plots/hbond.pdf
229         reference-manual/plots/hbond-insert.pdf
230         reference-manual/plots/hpr-wheel.pdf
231         reference-manual/plots/int-mat.pdf
232         reference-manual/plots/leapfrog.pdf
233         reference-manual/plots/lincs.pdf
234         reference-manual/plots/maxwell.pdf
235         reference-manual/plots/mdpar.pdf
236         reference-manual/plots/mpmd-pme.pdf
237         reference-manual/plots/msdwater.pdf
238         reference-manual/plots/ngmxdump.pdf
239         reference-manual/plots/nstric.pdf
240         reference-manual/plots/par-lincs2.pdf
241         reference-manual/plots/parsort.pdf
242         reference-manual/plots/pbctric.pdf
243         reference-manual/plots/phipsi.pdf
244         reference-manual/plots/pulldirrel.pdf
245         reference-manual/plots/pull.pdf
246         reference-manual/plots/pullref.pdf
247         reference-manual/plots/rama.pdf
248         reference-manual/plots/rdf.pdf
249         reference-manual/plots/rdfO-O.pdf
250         reference-manual/plots/rhododec.pdf
251         reference-manual/plots/ring.pdf
252         reference-manual/plots/ring-imp.pdf
253         reference-manual/plots/rotation.pdf
254         reference-manual/plots/sgangle.pdf
255         reference-manual/plots/shiftf.pdf
256         reference-manual/plots/softcore.pdf
257         reference-manual/plots/subst-im.pdf
258         reference-manual/plots/tetra-im.pdf
259         reference-manual/plots/truncoct.pdf
260         reference-manual/plots/vcrf.pdf
261         reference-manual/plots/verlet-drift.pdf
262         reference-manual/plots/vsite-4fdn.pdf
263         )
264     set(SPHINX_SOURCE_FILES
265         index.rst
266         download.rst
267         conf.py
268         links.dat
269         dev-manual/build-system.rst
270         dev-manual/commitstyle.rst
271         dev-manual/documentation-generation.rst
272         dev-manual/contribute.rst
273         dev-manual/doxygen.rst
274         dev-manual/error-handling.rst
275         dev-manual/formatting.rst
276         dev-manual/gmxtree.rst
277         dev-manual/includestyle.rst
278         dev-manual/index.rst
279         dev-manual/jenkins.rst
280         dev-manual/language-features.rst
281         dev-manual/naming.rst
282         dev-manual/overview.rst
283         dev-manual/redmine-states.png
284         dev-manual/relocatable-binaries.rst
285         dev-manual/reportstyle.rst
286         dev-manual/style.rst
287         dev-manual/testutils.rst
288         dev-manual/tools.rst
289         dev-manual/uncrustify.rst
290         fragments/doxygen-links.rst
291         install-guide/index.rst
292         release-notes/index.rst
293         release-notes/2018/2018.2.rst
294         release-notes/2018/2018.1.rst
295         release-notes/2018/major/highlights.rst
296         release-notes/2018/major/features.rst
297         release-notes/2018/major/performance.rst
298         release-notes/2018/major/tools.rst
299         release-notes/2018/major/bugs-fixed.rst
300         release-notes/2018/major/removed-features.rst
301         release-notes/2018/major/portability.rst
302         release-notes/2018/major/miscellaneous.rst
303         release-notes/2016/2016.5.rst
304         release-notes/2016/2016.4.rst
305         release-notes/2016/2016.3.rst
306         release-notes/2016/2016.2.rst
307         release-notes/2016/2016.1.rst
308         release-notes/2016/major/highlights.rst
309         release-notes/2016/major/new-features.rst
310         release-notes/2016/major/performance.rst
311         release-notes/2016/major/tools.rst
312         release-notes/2016/major/bugs-fixed.rst
313         release-notes/2016/major/removed-features.rst
314         release-notes/2016/major/miscellaneous.rst
315         release-notes/older/index.rst
316         user-guide/index.rst
317         user-guide/cmdline.rst
318         user-guide/cutoff-schemes.rst
319         user-guide/environment-variables.rst
320         user-guide/faq.rst
321         user-guide/floating-point.rst
322         user-guide/system-preparation.rst
323         user-guide/force-fields.rst
324         user-guide/getting-started.rst
325         user-guide/managing-simulations.rst
326         user-guide/mdp-options.rst
327         user-guide/mdrun-features.rst
328         user-guide/mdrun-performance.rst
329         user-guide/run-time-errors.rst
330         user-guide/system-preparation.rst
331         user-guide/terminology.rst
332         )
334     include(SphinxMacros.cmake)
335     gmx_init_sphinx_setup(${SPHINX_INPUT_DIR})
337     set(SPHINX_CONFIG_VARS_FILE ${SPHINX_INPUT_DIR}/conf-vars.py)
338     gmx_configure_version_file(conf-vars.py.cmakein ${SPHINX_CONFIG_VARS_FILE}
339         EXTRA_VARS
340             SPHINX_EXTENSION_PATH RELENG_PATH
341             EXPECTED_DOXYGEN_VERSION
342             EXPECTED_SPHINX_VERSION
343             CMAKE_MINIMUM_REQUIRED_VERSION REQUIRED_CUDA_VERSION
344             REQUIRED_OPENCL_MIN_VERSION
345             REQUIRED_CUDA_COMPUTE_CAPABILITY REGRESSIONTEST_VERSION
346             SOURCE_MD5SUM REGRESSIONTEST_MD5SUM_STRING
347             GMX_TNG_MINIMUM_REQUIRED_VERSION
348             GMX_LMFIT_MINIMUM_REQUIRED_VERSION
349         COMMENT "Configuring Sphinx configuration file")
350     gmx_add_sphinx_input_file(${SPHINX_CONFIG_VARS_FILE})
351     gmx_add_sphinx_source_files(FILES ${SPHINX_SOURCE_FILES})
352     if (EXISTS ${RELENG_PATH}/docs/FileList.cmake)
353         include(${RELENG_PATH}/docs/FileList.cmake)
354         gmx_add_sphinx_source_files(
355             FROM ${RELENG_PATH}/docs TO dev-manual/releng PREFIX releng/docs/
356             FILES ${RELENG_SPHINX_FILES})
357     else()
358         gmx_add_sphinx_source_files(FILES
359             dev-manual/releng/index.rst
360             dev-manual/releng/jenkins-howto.rst
361             dev-manual/releng/jenkins-ui.rst
362             )
363     endif()
364     if (IMAGE_CONVERT_POSSIBLE)
365         gmx_add_sphinx_source_files(
366             FILES
367             ${REFERENCEMANUAL_SPHINX_FILES}
368             user-guide/index.rst
369             user-guide/flow.rst)
370         gmx_add_sphinx_source_files(
371             FILES
372             ${REFERENCEMANUAL_IMAGE_FILES})
373         gmx_add_sphinx_image_conversion_files(
374             FILES
375             ${REFERENCEMANUAL_IMAGE_FILES})
376     else()
377         gmx_add_sphinx_source_files(
378             FROM ${CMAKE_CURRENT_SOURCE_DIR}/reference-manual TO user-guide
379             FILES
380             file-formats.rst
381             plots/plotje.png
382             plots/xvgr.png)
383         gmx_add_sphinx_source_files(
384             FROM ${CMAKE_CURRENT_SOURCE_DIR}/reference-manual-minimal TO reference-manual
385             FILES
386             index.rst)
387         gmx_add_sphinx_source_files(
388             FROM ${CMAKE_CURRENT_SOURCE_DIR}/user-guide-old TO user-guide
389             FILES
390             index.rst
391             flow.rst)
392     endif()
393     gmx_add_sphinx_input_target(sphinx-input)
394     gmx_add_sphinx_image_conversion_target(sphinx-image-conversion)
395     # Remove other rst files from the build tree, since they confuse Sphinx.
396     # Skip generated files in onlinehelp/, and fragments.
397     # The latter do not cause issues with obsolete files, as they
398     # are not considered as Sphinx input files, but will only be
399     # included using an explicit .. include::.
400     gmx_remove_obsolete_sphinx_input_files("^(onlinehelp|fragments)/.*\\\\.rst$")
402     # TODO: Make this remove obsolete .rst files.
403     # TODO: This does not work in cross-compilation scenarios; disable up to
404     # the necessary level.
405     gmx_add_custom_output_target(sphinx-programs OUTPUT STAMP
406         COMMAND ${CMAKE_COMMAND} -E make_directory onlinehelp
407         COMMAND gmx -quiet help -export rst
408         DEPENDS gmx
409         WORKING_DIRECTORY ${SPHINX_INPUT_DIR}
410         COMMENT "Generating reStructuredText help")
411     # This dependency ensures that the directories exist before the
412     # executable tries to write things there.
413     add_dependencies(sphinx-programs sphinx-input)
415     # Make the INSTALL file for CPack for the tarball. This gets put
416     # into the tarball via the CPack rules below, which requires that
417     # the INSTALL file is in a separate directory by itself.
418     set(TEXT_INSTALL_GUIDE_OUTPUT_DIR "install-guide/text")
419     add_custom_target(install-guide
420         COMMAND
421             ${SPHINX_EXECUTABLE}
422             -q -E -b text
423             -w sphinx-install.log
424             -d ${CMAKE_CURRENT_BINARY_DIR}/install-guide/_doctrees
425             -c ${SPHINX_INPUT_DIR}
426             "${SPHINX_INPUT_DIR}/install-guide"
427             "${TEXT_INSTALL_GUIDE_OUTPUT_DIR}"
428         COMMAND
429             ${CMAKE_COMMAND} -E rename
430             ${TEXT_INSTALL_GUIDE_OUTPUT_DIR}/index.txt
431             ${TEXT_INSTALL_GUIDE_OUTPUT_DIR}/INSTALL
432         WORKING_DIRECTORY
433             ${CMAKE_CURRENT_BINARY_DIR}
434         COMMENT "Building INSTALL with Sphinx"
435         VERBATIM
436         )
437     add_dependencies(install-guide sphinx-input)
438     gmx_cpack_add_generated_source_directory(install-guide/text DESTINATION /)
440     # Sphinx cache with pickled ReST documents
441     set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
442     add_custom_target(webpage-sphinx
443         DEPENDS sphinx-programs
444         DEPENDS sphinx-input
445         DEPENDS sphinx-image-conversion 
446         COMMAND
447             ${CMAKE_COMMAND} -E make_directory ${SPHINX_INPUT_DIR}/_static
448         COMMAND
449             ${SPHINX_EXECUTABLE}
450             -q -E -b html
451             -w sphinx-html.log
452             -d "${SPHINX_CACHE_DIR}"
453             "${SPHINX_INPUT_DIR}"
454             "${HTML_OUTPUT_DIR}"
455         WORKING_DIRECTORY
456             ${CMAKE_CURRENT_BINARY_DIR}
457         COMMENT "Building HTML documentation with Sphinx"
458         VERBATIM
459         )
461     add_custom_target(man
462         COMMAND
463             ${SPHINX_EXECUTABLE}
464             -q -E -b man
465             -w sphinx-man.log
466             -d ${SPHINX_CACHE_DIR}
467             -t do_man
468             ${SPHINX_INPUT_DIR}
469             ${CMAKE_CURRENT_BINARY_DIR}/man
470         COMMENT "Building man pages with Sphinx"
471         VERBATIM)
472     add_dependencies(man sphinx-input sphinx-programs)
473     if (GMX_BUILD_HELP)
474         # If requested, install the man pages built by the 'man' target
475         # created above.  Nothing will be installed if the user did not
476         # manually build the target.
477         set(MAN_PAGE_DIR ${CMAKE_CURRENT_BINARY_DIR})
478     endif()
480 else()
481     set(MANUAL_BUILD_IS_POSSIBLE OFF)
482     set(MANUAL_BUILD_NOT_POSSIBLE_REASON "Sphinx version ${EXPECTED_SPHINX_VERSION} is not available")
484     add_custom_target(webpage-sphinx
485         COMMAND ${CMAKE_COMMAND} -E echo
486             "HTML pages cannot be built because Sphinx version ${EXPECTED_SPHINX_VERSION} is not available"
487         VERBATIM)
488     add_custom_target(install-guide
489         COMMAND ${CMAKE_COMMAND} -E echo
490             "INSTALL cannot be built because Sphinx version ${EXPECTED_SPHINX_VERSION} is not available"
491         VERBATIM)
492     add_custom_target(man
493         COMMAND ${CMAKE_COMMAND} -E echo
494             "man pages cannot be built because Sphinx version ${EXPECTED_SPHINX_VERSION} is not available"
495         VERBATIM)
496     add_custom_target(sphinx-create-texman
497         COMMAND ${CMAKE_COMMAND} -E echo
498             "Cannot prepare LaTeX input files because Sphinx version ${EXPECTED_SPHINX_VERSION} is not available"
499         VERBATIM)
500 endif()
502 if (MAN_PAGE_DIR)
503     set(MAN_PAGE_DIR ${MAN_PAGE_DIR}/man)
504     # Trailing slash on directory is significant for
505     # install(DIRECTORY). See CMake docs.
506     install(DIRECTORY ${MAN_PAGE_DIR}/
507         DESTINATION ${MAN_INSTALL_DIR}/man1
508         COMPONENT man OPTIONAL
509         FILES_MATCHING PATTERN "*.1")
510 endif()
511 gmx_cpack_add_generated_source_directory(man)
513 # Determine whether we can build all the HTML pages and content linked from
514 # there.  If not, construct an informative message if the user tries to
515 # build the target; most people never need to know, unless they've asked for
516 # the webpage build.
517 set(HTML_BUILD_IS_POSSIBLE ON)
518 set(HTML_BUILD_NOT_POSSIBLE_REASON)
519 set(HTML_BUILD_WARNINGS)
521 # Next, turn it off if any of the preconditions are unsatisified
522 if (NOT PYTHON_EXECUTABLE)
523     set(HTML_BUILD_IS_POSSIBLE OFF)
524     set(HTML_BUILD_NOT_POSSIBLE_REASON "Python is required")
525 elseif (NOT SPHINX_FOUND)
526     # Hardly anything gets built if Sphinx is not available, so don't bother.
527     set(HTML_BUILD_IS_POSSIBLE OFF)
528     set(HTML_BUILD_NOT_POSSIBLE_REASON "Sphinx version ${EXPECTED_SPHINX_VERSION} is required")
529 endif()
530 if (NOT MANUAL_BUILD_IS_POSSIBLE)
531     list(APPEND HTML_BUILD_WARNINGS
532          "Reference PDF manual was not built, so links to it do not work")
533 endif()
534 if (NOT DOXYGEN_EXECUTABLE)
535     list(APPEND HTML_BUILD_WARNINGS
536         "Doxygen was not available, so links to Doxygen do not work")
537 endif()
538 if (NOT DOXYGEN_DOT_EXECUTABLE)
539     list(APPEND HTML_BUILD_WARNINGS
540         "dot/graphviz was not found, so some graphs are missing")
541 endif()
543 if (HTML_BUILD_IS_POSSIBLE)
544     set(_webpage_target_properties)
545     if (HTML_BUILD_WARNINGS)
546         list(APPEND _webpage_target_properties
547              COMMAND ${CMAKE_COMMAND} -E echo
548                  "webpage was built, but with the following limitations:")
549         foreach(_warning ${HTML_BUILD_WARNINGS})
550         list(APPEND _webpage_target_properties
551              COMMAND ${CMAKE_COMMAND} -E echo " - ${_warning}")
552         endforeach()
553     endif()
555     if (MANUAL_BUILD_IS_POSSIBLE)
556         # Make the PDF reference guide
557         # TODO Try to make the PDF arrive directly in ${HTML_OUTPUT_DIR}
558         # TODO Make this depend on the output of the manual build, so that the
559         # file actually gets copied multiple times.
560         set(_manual_target_location ${HTML_OUTPUT_DIR}/manual-${GMX_VERSION_STRING}.pdf)
561         add_custom_command(
562             OUTPUT ${_manual_target_location}
563             COMMAND ${CMAKE_COMMAND}
564                 -E remove -f ${_manual_target_location}
565             COMMAND ${CMAKE_COMMAND}
566                 -E copy ${CMAKE_CURRENT_BINARY_DIR}/manual/gromacs.pdf ${_manual_target_location}
567             DEPENDS manual
568             VERBATIM)
569         list(APPEND _webpage_target_properties
570              DEPENDS ${_manual_target_location})
571     endif()
573     # The Doxygen configuration in doxygen/Doxyfile-common.cmakein
574     # makes all the Doxygen output directly in
575     # ${HTML_OUTPUT_DIR}/doxygen (and makes the directory if it needs
576     # to).
578     # Add a top-level target that builds everything related to the webpage,
579     # for Jenkins (and possibly others) to use
580     add_custom_target(webpage ${_webpage_target_properties}
581         COMMENT "Building webpage"
582         VERBATIM)
583     add_dependencies(webpage webpage-sphinx doxygen-all)
584 else()
585     add_custom_target(webpage
586         COMMAND ${CMAKE_COMMAND} -E echo
587             "Cannot build webpage because ${HTML_BUILD_NOT_POSSIBLE_REASON}"
588         COMMENT "Webpage build not possible"
589         VERBATIM)
590 endif()