2019-08-17 08:19:08 +00:00
|
|
|
set(BREATHE_FOUND AUTO CACHE STRING "Enable Breathe documentation generator")
|
2019-10-07 10:52:50 +00:00
|
|
|
set_property(CACHE BREATHE_FOUND
|
|
|
|
PROPERTY STRINGS
|
|
|
|
ON
|
|
|
|
OFF
|
|
|
|
AUTO)
|
2019-08-17 08:19:08 +00:00
|
|
|
|
|
|
|
find_package(Doxygen)
|
|
|
|
find_package(Perl)
|
2019-10-07 10:52:50 +00:00
|
|
|
set(Python_ADDITIONAL_VERSIONS
|
|
|
|
3.7
|
|
|
|
3.6
|
|
|
|
3.5
|
|
|
|
3.4
|
|
|
|
3.3
|
|
|
|
3.2)
|
2019-08-17 08:19:08 +00:00
|
|
|
find_package(PythonInterp)
|
2019-10-07 10:52:50 +00:00
|
|
|
if(PYTHONINTERP_FOUND)
|
2019-08-17 08:19:08 +00:00
|
|
|
find_package(Sphinx)
|
|
|
|
include(FindPythonModule)
|
|
|
|
find_python_module(breathe)
|
|
|
|
find_python_module(recommonmark)
|
2019-10-07 10:52:50 +00:00
|
|
|
if(DOXYGEN_FOUND
|
|
|
|
AND PERL_FOUND
|
|
|
|
AND PYTHONINTERP_FOUND
|
|
|
|
AND SPHINX_EXECUTABLE
|
|
|
|
AND breathe
|
|
|
|
AND recommonmark)
|
2019-08-17 08:19:08 +00:00
|
|
|
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()
|
2019-08-21 03:47:51 +00:00
|
|
|
set(BREATHE_FOUND OFF CACHE STRING "Breathe documentation generator disabled" FORCE)
|
2019-08-17 08:19:08 +00:00
|
|
|
endif()
|
2019-03-31 10:52:29 +00:00
|
|
|
|
2019-08-17 08:19:08 +00:00
|
|
|
function(add_breathe_target)
|
2019-10-07 08:43:32 +00:00
|
|
|
set(options)
|
2019-10-07 10:52:50 +00:00
|
|
|
set(oneValueArgs
|
2019-10-13 06:13:51 +00:00
|
|
|
TARGET_NAME
|
2019-10-07 10:52:50 +00:00
|
|
|
SOURCE_DIR
|
|
|
|
DOXY_FILE
|
|
|
|
CONF_FILE
|
2019-10-13 06:13:51 +00:00
|
|
|
OUTPUT_DIR
|
2019-10-07 10:52:50 +00:00
|
|
|
COMMENT)
|
2019-10-07 08:43:32 +00:00
|
|
|
set(multiValueArgs)
|
2019-02-20 20:25:23 +00:00
|
|
|
|
2019-10-07 10:52:50 +00:00
|
|
|
cmake_parse_arguments(_BREATHE
|
|
|
|
"${options}"
|
|
|
|
"${oneValueArgs}"
|
|
|
|
"${multiValueArgs}"
|
|
|
|
${ARGN})
|
2019-10-07 08:43:32 +00:00
|
|
|
if(BREATHE_FOUND)
|
2019-10-13 06:13:51 +00:00
|
|
|
set(WORK_DIR ${CMAKE_BINARY_DIR}/_breathe)
|
|
|
|
set(BREATHE_DOCS_BUILD_DIR ${WORK_DIR})
|
2019-10-05 13:31:57 +00:00
|
|
|
set(GENERATE_XML YES)
|
|
|
|
set(GENERATE_HTML NO)
|
|
|
|
set(GENERATE_LATEX NO)
|
2019-10-13 06:13:51 +00:00
|
|
|
set(OUTPUT_DIRECTORY ${WORK_DIR})
|
2019-02-20 20:25:23 +00:00
|
|
|
|
2019-10-13 06:13:51 +00:00
|
|
|
configure_file(${_BREATHE_CONF_FILE} ${WORK_DIR}/conf.py @ONLY)
|
|
|
|
configure_file(${_BREATHE_DOXY_FILE} ${WORK_DIR}/Doxyfile @ONLY)
|
2019-02-20 20:25:23 +00:00
|
|
|
|
2019-08-17 03:36:47 +00:00
|
|
|
add_custom_target(${_BREATHE_TARGET_NAME} VERBATIM
|
2019-10-07 10:52:50 +00:00
|
|
|
COMMAND ${SPHINX_EXECUTABLE}
|
|
|
|
-q
|
|
|
|
-b
|
|
|
|
html
|
|
|
|
-c
|
2019-10-13 06:13:51 +00:00
|
|
|
${WORK_DIR}
|
2019-10-07 10:52:50 +00:00
|
|
|
-d
|
2019-10-13 06:13:51 +00:00
|
|
|
${WORK_DIR}/cache
|
2019-10-07 10:52:50 +00:00
|
|
|
${_BREATHE_SOURCE_DIR}
|
2019-10-13 06:13:51 +00:00
|
|
|
${_BREATHE_OUTPUT_DIR}
|
2019-10-07 10:52:50 +00:00
|
|
|
COMMENT "Building ${_BREATHE_TARGET_NAME} documentation with Breathe")
|
2019-08-17 08:19:08 +00:00
|
|
|
else()
|
|
|
|
add_custom_target(${_BREATHE_TARGET_NAME} VERBATIM
|
2019-10-07 10:52:50 +00:00
|
|
|
COMMENT "Breathe is not found. Skipping target ${_BREATHE_TARGET_NAME} build")
|
2019-03-31 10:52:29 +00:00
|
|
|
endif()
|
2019-02-20 20:25:23 +00:00
|
|
|
endfunction()
|