1 if (DOXYGEN_FOUND) 2 find_package (Sphinx) 3 if (SPHINX_FOUND) 4 if (NOT DEFINED SPHINX_THEME) 5 set (SPHINX_THEME default) 6 endif () 7 8 if (NOT DEFINED SPHINX_THEME_DIR) 9 set (SPHINX_THEME_DIR) 10 endif () 11 12 # configured documentation tools and intermediate build results 13 set (BINARY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}") 14 15 # Sphinx cache with pickled ReST documents 16 set (SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/doctrees") 17 18 # HTML output directory 19 set (SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html") 20 21 # doc .rst locations 22 set (SPHINX_DOC_LOATION "${CMAKE_CURRENT_SOURCE_DIR}") 23 24 configure_file( 25 "${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in" 26 "${BINARY_BUILD_DIR}/conf.py" 27 @ONLY 28 ) 29 30 add_custom_target(sphinx ALL 31 ${SPHINX_EXECUTABLE} -b html 32 -c "${BINARY_BUILD_DIR}" 33 -d "${SPHINX_CACHE_DIR}" 34 "${SPHINX_DOC_LOATION}" 35 "${SPHINX_HTML_DIR}" 36 COMMENT "Building HTML documentation with Sphinx" 37 ) 38 39 add_dependencies (sphinx ${SWIG_MODULE_python-mraa_REAL_NAME}) 40 endif () 41 endif () 42