Skip to content

Commit

Permalink
Add docs-html target to CMake
Browse files Browse the repository at this point in the history
Only added if Sphinx can be found.
Refs #9521
  • Loading branch information
martyngigg committed May 28, 2014
1 parent 8373eb4 commit afbdb03
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Code/Mantid/docs/CMakeLists.txt
@@ -1,3 +1,31 @@
###############################################################################
# Sphinx documentation
###############################################################################
find_package ( Sphinx )

if ( SPHINX_FOUND )
# Fill in the config file and autogen file with build information

# We generate a target per build type, i.e docs-html
set ( SPHINX_BUILD ${CMAKE_BINARY_DIR}/docs )
set ( BUILDER html )
configure_file ( runsphinx.py.in runsphinx_html.py @ONLY )

# targets
set ( TARGET_PREFIX docs)

# HTML target
add_custom_target ( ${TARGET_PREFIX}-html
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/MantidPlot -xq runsphinx_html.py
COMMENT "Build Sphinx html documentation"
)

endif ()


###############################################################################
# QtAssistant
###############################################################################
if ( APPLE )
set ( ENABLE_QTASSISTANT False CACHE BOOL "Build qt-assistant documentation" )
else ()
Expand Down
21 changes: 21 additions & 0 deletions Code/Mantid/docs/runsphinx.py.in
@@ -0,0 +1,21 @@
"""We need to run Sphinx inside MantidPlot to document the internal
module. This script calls the sphinx entry point with the necessary
arguments
"""

__requires__ = 'Sphinx'
import sys
import os
from pkg_resources import load_entry_point

mantidplot = "@CMAKE_RUNTIME_OUTPUT_DIRECTORY@/MantidPlot"
builder = "@BUILDER@"
src_dir = "@CMAKE_CURRENT_SOURCE_DIR@/source"
output_dir = os.path.join("@SPHINX_BUILD@", builder)
argv = [mantidplot,'-b', builder, src_dir, output_dir]

if __name__ == '__main__':
sys.exit(
load_entry_point(__requires__, 'console_scripts', 'sphinx-build')(argv)
)

0 comments on commit afbdb03

Please sign in to comment.