82 lines
2.4 KiB
CMake
82 lines
2.4 KiB
CMake
set(BREATHE_FOUND AUTO CACHE STRING "Enable Breathe documentation generator")
|
|
set_property(CACHE BREATHE_FOUND
|
|
PROPERTY STRINGS
|
|
ON
|
|
OFF
|
|
AUTO)
|
|
|
|
find_package(Doxygen)
|
|
find_package(Perl)
|
|
set(Python_ADDITIONAL_VERSIONS
|
|
3.7
|
|
3.6
|
|
3.5
|
|
3.4
|
|
3.3
|
|
3.2)
|
|
find_package(PythonInterp)
|
|
if(PYTHONINTERP_FOUND)
|
|
find_package(Sphinx)
|
|
include(FindPythonModule)
|
|
find_python_module(breathe)
|
|
find_python_module(recommonmark)
|
|
if(DOXYGEN_FOUND
|
|
AND PERL_FOUND
|
|
AND PYTHONINTERP_FOUND
|
|
AND SPHINX_EXECUTABLE
|
|
AND breathe
|
|
AND recommonmark)
|
|
set(BREATHE_FOUND ON CACHE STRING "Breathe documentation generator enabled" FORCE)
|
|
else()
|
|
set(BREATHE_FOUND OFF CACHE STRING "Breathe documentation generator disabled" FORCE)
|
|
endif()
|
|
else()
|
|
set(BREATHE_FOUND OFF CACHE STRING "Breathe documentation generator disabled" FORCE)
|
|
endif()
|
|
|
|
function(add_breathe_target)
|
|
set(options)
|
|
set(oneValueArgs
|
|
SOURCE_DIR
|
|
BUILD_DIR
|
|
CACHE_DIR
|
|
HTML_DIR
|
|
DOXY_FILE
|
|
CONF_FILE
|
|
TARGET_NAME
|
|
COMMENT)
|
|
set(multiValueArgs)
|
|
|
|
cmake_parse_arguments(_BREATHE
|
|
"${options}"
|
|
"${oneValueArgs}"
|
|
"${multiValueArgs}"
|
|
${ARGN})
|
|
if(BREATHE_FOUND)
|
|
set(BREATHE_DOCS_BUILD_DIR ${_BREATHE_BUILD_DIR})
|
|
set(GENERATE_XML YES)
|
|
set(GENERATE_HTML NO)
|
|
set(GENERATE_LATEX NO)
|
|
set(OUTPUT_DIRECTORY ${_BREATHE_HTML_DIR})
|
|
|
|
configure_file(${_BREATHE_CONF_FILE} ${_BREATHE_BUILD_DIR}/conf.py @ONLY)
|
|
configure_file(${_BREATHE_DOXY_FILE} ${_BREATHE_BUILD_DIR}/Doxyfile @ONLY)
|
|
|
|
add_custom_target(${_BREATHE_TARGET_NAME} VERBATIM
|
|
COMMAND ${SPHINX_EXECUTABLE}
|
|
-q
|
|
-b
|
|
html
|
|
-c
|
|
${_BREATHE_BUILD_DIR}
|
|
-d
|
|
${_BREATHE_CACHE_DIR}
|
|
${_BREATHE_SOURCE_DIR}
|
|
${_BREATHE_HTML_DIR}
|
|
COMMENT "Building ${_BREATHE_TARGET_NAME} documentation with Breathe")
|
|
else()
|
|
add_custom_target(${_BREATHE_TARGET_NAME} VERBATIM
|
|
COMMENT "Breathe is not found. Skipping target ${_BREATHE_TARGET_NAME} build")
|
|
endif()
|
|
endfunction()
|