andre@933: # Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
andre@933: # Software engineering by Intevation GmbH
andre@933: #
andre@933: # This file is Free Software under the GNU GPL (v>=2)
andre@933: # and comes with ABSOLUTELY NO WARRANTY!
andre@933: # See LICENSE.txt for details.
andre@933: 
andre@933: if(NOT DEFINED SPHINX_THEME)
andre@933:     set(SPHINX_THEME better)
andre@933: endif()
andre@933: 
andre@933: if(NOT DEFINED SPHINX_THEME_DIR)
andre@933:    set(SPHINX_THEME_DIR "${CMAKE_CURRENT_SOURCE_DIR}/theme")
andre@933: endif()
andre@933: 
andre@1185: set(ADMIN_MANUAL_IN "${CMAKE_CURRENT_SOURCE_DIR}/admin")
andre@1185: set(ADMIN_MANUAL_OUT "${CMAKE_CURRENT_BINARY_DIR}/admin")
andre@1185: set(HELP_MANUAL_IN "${CMAKE_CURRENT_SOURCE_DIR}/client")
andre@1185: set(HELP_MANUAL_OUT "${CMAKE_CURRENT_BINARY_DIR}/client")
andre@933: 
andre@933: 
andre@933: # configured documentation tools and intermediate build results
andre@933: set(BINARY_BUILD_DIR_ADMIN "${CMAKE_CURRENT_BINARY_DIR}/_build-admin")
andre@1185: set(BINARY_BUILD_DIR_HELP "${CMAKE_CURRENT_BINARY_DIR}/_build-client")
andre@933: 
andre@933: # Sphinx cache with pickled ReST documents
andre@933: set(SPHINX_CACHE_DIR_ADMIN "${CMAKE_CURRENT_BINARY_DIR}/_doctrees-admin")
andre@1185: set(SPHINX_CACHE_DIR_HELP "${CMAKE_CURRENT_BINARY_DIR}/_doctrees-client")
andre@933: 
andre@933: # HTML output directory
andre@933: set(SPHINX_HTML_DIR_ADMIN "${ADMIN_MANUAL_OUT}/html")
andre@933: set(SPHINX_HTML_DIR_HELP "${HELP_MANUAL_OUT}/html")
andre@933: 
andre@933: configure_file(
andre@933:     "${ADMIN_MANUAL_IN}/conf.py.in"
andre@933:     "${BINARY_BUILD_DIR_ADMIN}/conf.py"
andre@933:     @ONLY)
andre@933: 
andre@933: configure_file(
andre@933:     "${HELP_MANUAL_IN}/conf.py.in"
andre@933:     "${BINARY_BUILD_DIR_HELP}/conf.py"
andre@933:     @ONLY)
andre@933: 
andre@933: add_custom_target(admin_manual ALL
andre@933:     ${SPHINX_EXECUTABLE}
andre@933:         -q -b html
andre@933:         -c "${BINARY_BUILD_DIR_ADMIN}"
andre@933:         -d "${SPHINX_CACHE_DIR_ADMIN}"
andre@933:         "${ADMIN_MANUAL_IN}"
andre@933:         "${SPHINX_HTML_DIR_ADMIN}"
andre@933:         COMMENT "Building HTML Admin documentation with Sphinx")
andre@933: 
andre@933: add_custom_target(help_manual ALL
andre@933:     ${SPHINX_EXECUTABLE}
andre@933:         -q -b html
andre@933:         -c "${BINARY_BUILD_DIR_HELP}"
andre@933:         -d "${SPHINX_CACHE_DIR_HELP}"
andre@933:         "${HELP_MANUAL_IN}"
andre@933:         "${SPHINX_HTML_DIR_HELP}"
andre@933:         COMMENT "Building HTML Help with Sphinx")