############################################################################### ### Create Doc Targets ### message(STATUS "Create sphinx conf.py from conf.py.in") configure_file(${CMAKE_SOURCE_DIR}/docs/conf.py.in ${CMAKE_BINARY_DIR}/docs/conf.py @ONLY) message(STATUS "Copying doc to staging area") file( COPY ${CMAKE_SOURCE_DIR}/docs/ DESTINATION ${CMAKE_BINARY_DIR}/docs # Ignore dot files like emacs' temporary .#somefile.rst which # break Sphinx (and must be manually removed from the destination) PATTERN ".*" EXCLUDE ) message(STATUS "Copy extra doc files to staging area") list(APPEND DOCFILES ${CMAKE_SOURCE_DIR}/README.md) list(APPEND DOCFILES ${CMAKE_SOURCE_DIR}/INSTALL) list(APPEND DOCFILES ${CMAKE_SOURCE_DIR}/ChangeLog) list(APPEND DOCFILES ${CMAKE_SOURCE_DIR}/LICENSE) list(APPEND DOCFILES ${CMAKE_SOURCE_DIR}/share/nuke/ocionuke/viewer.py) CopyFiles(RSTDOC ${DOCFILES}) message(STATUS "Extracting .rst files from C++ headers") ExtractRstCPP(${CMAKE_SOURCE_DIR}/export/OpenColorIO/OpenColorIO.h ${CMAKE_BINARY_DIR}/docs/developers/api/OpenColorIO.rst) ExtractRstCPP(${CMAKE_SOURCE_DIR}/export/OpenColorIO/OpenColorTransforms.h ${CMAKE_BINARY_DIR}/docs/developers/api/OpenColorTransforms.rst) ExtractRstCPP(${CMAKE_SOURCE_DIR}/export/OpenColorIO/OpenColorTypes.h ${CMAKE_BINARY_DIR}/docs/developers/api/OpenColorTypes.rst) if(OCIO_BUILD_PYGLUE) set(DEPLIBS OpenColorIO PyOpenColorIO) else() set(DEPLIBS OpenColorIO) endif() add_custom_target(doc ALL COMMAND ${PYT_PRE_CMD} sphinx-build -b html . ${CMAKE_CURRENT_BINARY_DIR}/build-html DEPENDS ${DEPLIBS} ${CMAKE_BINARY_DIR}/docs/conf.py developers/api/OpenColorIO.rst developers/api/OpenColorTransforms.rst developers/api/OpenColorTypes.rst ${RSTDOC_OUTPUT} COMMENT "Building html docs" SOURCES ${DOCFILES}) # note: ExternalProject will not build when added to a add_custom_target this # works around this problem. This seems to be fixed in the cmake ^HEAD add_dependencies(doc Sphinx) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/build-html/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/OpenColorIO/html PATTERN .* EXCLUDE ) find_package(LATEX) if(PDFLATEX_COMPILER) add_custom_target(latex COMMAND ${PYT_PRE_CMD} sphinx-build -b latex . ${CMAKE_CURRENT_BINARY_DIR}/build-latex DEPENDS OpenColorIO ${CMAKE_BINARY_DIR}/docs/conf.py developers/api/OpenColorIO.rst developers/api/OpenColorTransforms.rst developers/api/OpenColorTypes.rst ${RSTDOC_OUTPUT} COMMENT "Building latex doc" SOURCES ${DOCFILES}) add_dependencies(latex Sphinx) add_custom_target(pdf ALL COMMAND ${PDFLATEX_COMPILER} OpenColorIO.tex WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/build-latex COMMENT "Building pdf doc" SOURCES ${DOCFILES}) add_dependencies(pdf latex) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/build-latex/OpenColorIO.pdf DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/OpenColorIO/) endif()