From cc21c62b71ff9fc8917c5a05ff99c911a024a6e7 Mon Sep 17 00:00:00 2001 From: naxuroqa Date: Fri, 16 Aug 2013 16:15:15 +0200 Subject: [PATCH] moved conf.py to its right place cleaned up the cmake for building the docs nicer --- docs/CMakeLists.txt | 74 ++++++++++++++++++------------------ docs/{conf.py => conf.py.in} | 4 +- 2 files changed, 38 insertions(+), 40 deletions(-) rename docs/{conf.py => conf.py.in} (99%) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 14126cfd..4b281eb4 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -1,40 +1,38 @@ -# cmake should not fail if sphinx is missing -find_package(Sphinx) +find_package(Sphinx QUIET) -if(SPHINX_EXECUTABLE) - - if(NOT DEFINED SPHINX_THEME) - set(SPHINX_THEME default) - endif() - - if(NOT DEFINED SPHINX_THEME_DIR) - set(SPHINX_THEME_DIR) - endif() - - # configured documentation tools and intermediate build results - set(BINARY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/_build") - - # Sphinx cache with pickled ReST documents - set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees") - - # HTML output directory - set(SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html") - - configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/conf.py" - "${BINARY_BUILD_DIR}/conf.py" - @ONLY) - - add_custom_target(docs - ${SPHINX_EXECUTABLE} - -b html - -c "${BINARY_BUILD_DIR}" - "${CMAKE_CURRENT_SOURCE_DIR}" - "${SPHINX_HTML_DIR}" - COMMENT "Building HTML documentation with Sphinx") -else() - add_custom_target(docs - echo - "Please install python-sphinx to build the docs or read the docs online: https://projecttox.readthedocs.org/en/latest" - COMMENT "No sphinx executebale found") +if(NOT DEFINED SPHINX_THEME) + set(SPHINX_THEME default) +endif() + +if(NOT DEFINED SPHINX_THEME_DIR) + set(SPHINX_THEME_DIR) +endif() + +# configured documentation tools and intermediate build results +set(BINARY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/_build") + +# Sphinx cache with pickled ReST documents +set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees") + +# HTML output directory +set(SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html") + +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in" + "${BINARY_BUILD_DIR}/conf.py" + @ONLY) + +if(SPHINX_FOUND) + add_custom_target(docs + ${SPHINX_EXECUTABLE} + -b html + -c "${BINARY_BUILD_DIR}" + -d "${SPHINX_CACHE_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}" + "${SPHINX_HTML_DIR}" + COMMENT "Building HTML documentation with Sphinx") +else() + add_custom_target(docs + echo "Please install python-sphinx to build the docs or read the docs online: https://projecttox.readthedocs.org/en/latest" +- COMMENT "No sphinx executable found") endif() diff --git a/docs/conf.py b/docs/conf.py.in similarity index 99% rename from docs/conf.py rename to docs/conf.py.in index afebb632..260e77a8 100644 --- a/docs/conf.py +++ b/docs/conf.py.in @@ -91,7 +91,7 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +html_theme = '@SPHINX_THEME@' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -99,7 +99,7 @@ html_theme = 'default' #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +html_theme_path = ['@SPHINX_THEME_DIR@'] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation".