docs: require specific version of doc tools

Signed-off-by: Nicolas Oliver <dario.n.oliver@intel.com>
This commit is contained in:
Nicolas Oliver 2017-09-11 13:01:48 -07:00
parent 153d8cfb12
commit 40e73e648a
2 changed files with 60 additions and 46 deletions

View File

@ -310,7 +310,8 @@ endif()
#
if (BUILDDOC)
# Add a target to generate API documentation with Doxygen
find_package (Doxygen REQUIRED)
find_package (Doxygen 1.8 REQUIRED)
if (DOXYGEN_FOUND AND DOXYGEN_VERSION VERSION_GREATER "1.8")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
if (BUILDSWIGJAVA)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.java.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile-java @ONLY)
@ -325,12 +326,16 @@ if (BUILDDOC)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
else ()
message (SEND_ERROR "ERROR - Failed to find a compatible version of Doxygen. API doc will not be generated")
endif (DOXYGEN_FOUND AND DOXYGEN_VERSION VERSION_GREATER "1.8")
# Check if Sphinx is installed and add target to generate API documentation
# Currently, the per-module documentation for python is generated from the
# python2 modules.
if(BUILDSWIGPYTHON)
find_package (Sphinx REQUIRED)
find_package (Sphinx 1.3 REQUIRED)
if (SPHINX_FOUND AND SPHINX_VERSION VERSION_GREATER "1.3")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/pydoc/conf.py @ONLY)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/index.rst ${CMAKE_CURRENT_BINARY_DIR}/pydoc/index.rst COPYONLY)
add_custom_target (pydoc ALL
@ -346,11 +351,15 @@ if (BUILDDOC)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Sphinx" VERBATIM
)
else ()
message (SEND_ERROR "ERROR - Failed to find a compatible version of Sphinx. Python API doc will not be generated")
endif ()
endif(BUILDSWIGPYTHON)
# Check if Yuidoc is installed and add target for API documentation
if(BUILDSWIGNODE)
find_package(Yuidoc REQUIRED)
find_package (Yuidoc 0.10 REQUIRED)
if (YUIDOC_FOUND AND YUIDOC_VERSION VERSION_GREATER "0.10")
add_custom_target (jsdoc ALL
COMMAND ${CMAKE_SOURCE_DIR}/doxy/doxygen2jsdoc/docgen.js -m upm -i xml -o jsdoc -t ${CMAKE_CURRENT_SOURCE_DIR}/src -g ../../
COMMAND ${YUIDOC_EXECUTABLE} -C --no-sort --helpers ${CMAKE_SOURCE_DIR}/doxy/node/generators/yuidoc/helper.js --themedir ${CMAKE_SOURCE_DIR}/doxy/node/generators/yuidoc/tmpl -o html/node jsdoc/yuidoc/upm
@ -359,6 +368,9 @@ if (BUILDDOC)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Yuidoc" VERBATIM
)
else ()
message (SEND_ERROR "ERROR - Failed to find a compatible version of Yuidoc. Node.js API doc will not be generated")
endif ()
endif(BUILDSWIGNODE)
endif (BUILDDOC)

View File

@ -17,13 +17,15 @@ find_package_handle_standard_args (Sphinx DEFAULT_MSG
SPHINX_API_EXECUTABLE
)
# Get Sphinx version
# Get Sphinx Version
if (SPHINX_EXECUTABLE)
execute_process(COMMAND ${SPHINX_EXECUTABLE} --version
OUTPUT_VARIABLE SPHINX_VERSION)
if(SPHINX_VERSION)
string(REGEX MATCH "([0-9]\\.[0-9]\\.[0-9])" SPHINX_VERSION_STR ${SPHINX_VERSION})
message (STATUS "Sphinx version is ${SPHINX_VERSION_STR}")
OUTPUT_VARIABLE SPHINX_VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if (SPHINX_VERSION_STRING)
string(REPLACE "Sphinx (sphinx-build) " "" SPHINX_VERSION ${SPHINX_VERSION_STRING})
message (STATUS "Sphinx version is ${SPHINX_VERSION}")
endif ()
endif ()