Merge branch 'release-2019' into master
[alexxy/gromacs.git] / docs / CMakeLists.txt
index 341e14c1255629c0ee0bd322fb0b0754c295d798..b7159826001e08d5ec754f9f694ebece297e41e0 100644 (file)
@@ -60,18 +60,13 @@ set(EXPECTED_DOXYGEN_VERSION 1.8.5)
 
 set(EXPECTED_SPHINX_VERSION 1.6.1)
 
-if (DEFINED PYTHON_EXECUTABLE)
-    # Keep quiet on subsequent runs of cmake
-    set(PythonInterp_FIND_QUIETLY ON)
-endif()
-find_package(PythonInterp 2.7)
-
-
-if (NOT ${PYTHON_VERSION_MAJOR} EQUAL 3)
-    find_package(Sphinx ${EXPECTED_SPHINX_VERSION} QUIET COMPONENTS pygments)
-else()
-    MESSAGE(STATUS "Can not build documentation with Python 3")
+# By default, suppress output after first configuration.
+if(SPHINX_ALREADY_SEARCHED)
+    set(Sphinx_FIND_QUIETLY ON)
 endif()
+find_package(Sphinx ${EXPECTED_SPHINX_VERSION} COMPONENTS pygments)
+set(SPHINX_ALREADY_SEARCHED TRUE CACHE BOOL "True if a search for Sphinx has already been done")
+mark_as_advanced(SPHINX_ALREADY_SEARCHED)
 
 # Even if we aren't going to make the full webpage, set up to put all
 # the documentation output in the same place, for convenience
@@ -113,10 +108,7 @@ elseif (BUILD_IS_INSOURCE)
     set(MANUAL_BUILD_NOT_POSSIBLE_REASON "the build is in-source")
 else()
     include(manual/UseLATEX.cmake)
-    if(${PYTHON_VERSION_MAJOR} EQUAL 3)
-        set(MANUAL_BUILD_IS_POSSIBLE OFF)
-        set(MANUAL_BUILD_NOT_POSSIBLE_REASON "We can not build the documentation when using python3")
-    elseif(NOT SPHINX_FOUND)
+    if(NOT SPHINX_FOUND)
         set(MANUAL_BUILD_IS_POSSIBLE OFF)
         set(MANUAL_BUILD_NOT_POSSIBLE_REASON "Sphinx has not been found and is needed to create the LaTex input files")
     elseif(NOT PDFLATEX_COMPILER)
@@ -231,6 +223,7 @@ if (SPHINX_FOUND)
         reference-manual/special/vmd-imd.rst
         reference-manual/special/membrane-embedding.rst
         reference-manual/special/mimic-qmmm.rst
+        reference-manual/special/density-guided-simulation.rst
         # Analysis chapter
         reference-manual/analysis.rst
         reference-manual/analysis/using-groups.rst
@@ -245,6 +238,7 @@ if (SPHINX_FOUND)
         reference-manual/analysis/rmsd.rst
         reference-manual/analysis/covariance-analysis.rst
         reference-manual/analysis/dihedral-pca.rst
+        reference-manual/analysis/hydrogen-bonds.rst
         reference-manual/analysis/protein-related.rst
         reference-manual/analysis/interface-related.rst)
     # The image files have also been ordered by the respective
@@ -367,6 +361,15 @@ if (SPHINX_FOUND)
         how-to/visualize.rst
         install-guide/index.rst
         release-notes/index.rst
+        release-notes/2020/major/highlights.rst
+        release-notes/2020/major/features.rst
+        release-notes/2020/major/performance.rst
+        release-notes/2020/major/tools.rst
+        release-notes/2020/major/bugs-fixed.rst
+        release-notes/2020/major/removed-functionality.rst
+        release-notes/2020/major/deprecated-functionality.rst
+        release-notes/2020/major/portability.rst
+        release-notes/2020/major/miscellaneous.rst
         release-notes/2019/2019.5.rst
         release-notes/2019/2019.4.rst
         release-notes/2019/2019.3.rst
@@ -414,7 +417,6 @@ if (SPHINX_FOUND)
         # if the documentation will be build with the full reference
         # manual or without.
         user-guide/cmdline.rst
-        user-guide/cutoff-schemes.rst
         user-guide/deprecation-policy.rst
         user-guide/environment-variables.rst
         user-guide/faq.rst
@@ -468,6 +470,15 @@ if (SPHINX_FOUND)
     endif()
 
     set(SPHINX_CONFIG_VARS_FILE ${SPHINX_INPUT_DIR}/conf-vars.py)
+    if (GMX_PYTHON_PACKAGE)
+        set(GMXAPI_PYTHON_STAGING_DIR ${CMAKE_BINARY_DIR}/python_packaging/src/gmxapi_staging)
+        # TODO: Resolve circular reference. We would like to get the CMake build-time directory for
+        # the gmxapi Python package from the _gmxapi target, as we do when building sample_restraint.
+        # Instead of the above hard-coded path, how can we do
+        # get_target_property(GMXAPI_PYTHON_STAGING_DIR _gmxapi staging_dir)
+        # in this context?
+    endif ()
+
     gmx_configure_version_file(conf-vars.py.cmakein ${SPHINX_CONFIG_VARS_FILE}
         EXTRA_VARS
             SPHINX_EXTENSION_PATH RELENG_PATH
@@ -482,6 +493,7 @@ if (SPHINX_FOUND)
             GMX_LMFIT_REQUIRED_VERSION
             GMX_MANUAL_DOI_STRING
             GMX_SOURCE_DOI_STRING
+            GMXAPI_PYTHON_STAGING_DIR
         COMMENT "Configuring Sphinx configuration file")
     gmx_add_sphinx_input_file(${SPHINX_CONFIG_VARS_FILE})
     gmx_add_sphinx_source_files(FILES ${SPHINX_SOURCE_FILES})
@@ -497,6 +509,35 @@ if (SPHINX_FOUND)
             dev-manual/releng/jenkins-ui.rst
             )
     endif()
+
+    gmx_add_sphinx_source_files(
+            FILES
+            gmxapi/changelog.rst
+            gmxapi/index.rst
+            gmxapi/userguide/install.rst
+            gmxapi/userguide/usage.rst
+            gmxapi/userguide/userguide.rst
+            gmxapi/reference/contributing.rst
+            gmxapi/reference/datamodel.rst
+            gmxapi/reference/executionmodel.rst
+            gmxapi/reference/extending.rst
+            gmxapi/reference/projectstructure.rst
+            gmxapi/reference/reference.rst
+    )
+
+    if (GMX_PYTHON_PACKAGE)
+        gmx_add_sphinx_source_files(
+            FILES
+            gmxapi/userguide/pythonreference.rst
+            )
+    else()
+        gmx_add_sphinx_source_files(
+            FROM ${CMAKE_CURRENT_SOURCE_DIR}/gmxapi/userguide-stub
+            TO gmxapi/userguide/ 
+            FILES pythonreference.rst 
+            )
+    endif ()
+
     gmx_add_sphinx_source_files(
         FILES
         ${REFERENCEMANUAL_SPHINX_FILES_GENERAL})
@@ -540,7 +581,7 @@ if (SPHINX_FOUND)
     add_custom_target(install-guide
         COMMAND
             ${SPHINX_EXECUTABLE}
-            -q -E -b text
+            -q -b text
             -w sphinx-install.log
             -d ${CMAKE_CURRENT_BINARY_DIR}/install-guide/_doctrees
             -c ${SPHINX_INPUT_DIR}
@@ -563,12 +604,13 @@ if (SPHINX_FOUND)
     add_custom_target(webpage-sphinx
         DEPENDS sphinx-programs
         DEPENDS sphinx-input
-        DEPENDS sphinx-image-conversion 
+        DEPENDS sphinx-image-conversion
+        DEPENDS manual
         COMMAND
             ${CMAKE_COMMAND} -E make_directory ${SPHINX_INPUT_DIR}/_static
         COMMAND
             ${SPHINX_EXECUTABLE}
-            -q -E -b html
+            -q -b html
             -w sphinx-html.log
             -d "${SPHINX_CACHE_DIR}"
             "${SPHINX_INPUT_DIR}"
@@ -578,11 +620,14 @@ if (SPHINX_FOUND)
         COMMENT "Building HTML documentation with Sphinx"
         VERBATIM
         )
+    if (GMX_PYTHON_PACKAGE)
+        add_dependencies(webpage-sphinx _gmxapi)
+    endif ()
 
     add_custom_target(man
         COMMAND
             ${SPHINX_EXECUTABLE}
-            -q -E -b man
+            -q -b man
             -w sphinx-man.log
             -d ${SPHINX_CACHE_DIR}
             -t do_man
@@ -643,7 +688,7 @@ set(HTML_BUILD_NOT_POSSIBLE_REASON)
 set(HTML_BUILD_WARNINGS)
 
 # Next, turn it off if any of the preconditions are unsatisified
-if (NOT PYTHON_EXECUTABLE)
+if (NOT PythonInterp_FOUND)
     set(HTML_BUILD_IS_POSSIBLE OFF)
     set(HTML_BUILD_NOT_POSSIBLE_REASON "Python is required")
 elseif (NOT SPHINX_FOUND)