2019-03-31 10:52:29 +00:00
|
|
|
set(BUILD_BREATHE_DOC AUTO CACHE STRING "Enable documntation in Breathe format")
|
|
|
|
set_property(CACHE BUILD_BREATHE_DOC PROPERTY STRINGS AUTO ON OFF)
|
|
|
|
|
|
|
|
if(BUILD_BREATHE_DOC STREQUAL 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)
|
2019-04-15 00:55:20 +00:00
|
|
|
if (PYTHONINTERP_FOUND)
|
|
|
|
find_package(Sphinx)
|
|
|
|
include(FindPythonModule)
|
|
|
|
find_python_module(breathe)
|
|
|
|
find_python_module(recommonmark)
|
2019-06-26 08:37:37 +00:00
|
|
|
if(DOXYGEN_FOUND AND PERL_FOUND AND PYTHONINTERP_FOUND AND SPHINX_FOUND AND breathe_FOUND AND recommonmark_FOUND)
|
2019-04-15 00:55:20 +00:00
|
|
|
set(BUILD_BREATHE_DOC ON CACHE STRING "Enable documntation in Breathe format" FORCE)
|
2019-06-26 08:37:37 +00:00
|
|
|
else()
|
|
|
|
set(BUILD_BREATHE_DOC OFF CACHE STRING "Disable documentation in Breathe format" FORCE)
|
2019-04-15 00:55:20 +00:00
|
|
|
endif()
|
2019-06-26 08:37:37 +00:00
|
|
|
else()
|
|
|
|
set(BUILD_BREATHE_DOC OFF CACHE STRING "Disable documentation in Breathe format" FORCE)
|
2019-03-31 10:52:29 +00:00
|
|
|
endif()
|
|
|
|
elseif(BUILD_BREATHE_DOC)
|
|
|
|
find_package(Doxygen REQUIRED)
|
|
|
|
find_package(Perl REQUIRED)
|
|
|
|
set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 3.4 3.3 3.2)
|
|
|
|
find_package(PythonInterp REQUIRED)
|
|
|
|
find_package(Sphinx REQUIRED)
|
|
|
|
include(FindPythonModule)
|
|
|
|
find_python_module(breathe REQUIRED)
|
|
|
|
find_python_module(recommonmark REQUIRED)
|
2019-06-26 08:37:37 +00:00
|
|
|
set(BUILD_BREATHE_DOC ON CACHE STRING "Enable documentation in Breathe format" FORCE)
|
2019-03-31 10:52:29 +00:00
|
|
|
else()
|
2019-06-26 08:37:37 +00:00
|
|
|
set(BUILD_BREATHE_DOC OFF CACHE STRING "Disable documentation in Breathe format" FORCE)
|
2019-03-31 10:52:29 +00:00
|
|
|
endif()
|
2019-02-20 20:25:23 +00:00
|
|
|
|
|
|
|
function(add_breathe_doc)
|
2019-03-31 10:52:29 +00:00
|
|
|
if(BUILD_BREATHE_DOC AND CMAKE_BUILD_TYPE STREQUAL Release)
|
|
|
|
set(options)
|
|
|
|
set(oneValueArgs
|
|
|
|
SOURCE_DIR
|
|
|
|
BUILD_DIR
|
|
|
|
CACHE_DIR
|
|
|
|
HTML_DIR
|
|
|
|
DOXY_FILE
|
|
|
|
CONF_FILE
|
|
|
|
TARGET_NAME
|
|
|
|
COMMENT
|
|
|
|
)
|
|
|
|
set(multiValueArgs)
|
2019-02-20 20:25:23 +00:00
|
|
|
|
2019-03-31 10:52:29 +00:00
|
|
|
cmake_parse_arguments(BREATHE_DOC
|
|
|
|
"${options}"
|
|
|
|
"${oneValueArgs}"
|
|
|
|
"${multiValueArgs}"
|
|
|
|
${ARGN}
|
|
|
|
)
|
2019-02-20 20:25:23 +00:00
|
|
|
|
2019-03-31 10:52:29 +00:00
|
|
|
configure_file(
|
|
|
|
${BREATHE_DOC_CONF_FILE}
|
|
|
|
${BREATHE_DOC_BUILD_DIR}/conf.py
|
|
|
|
@ONLY
|
|
|
|
)
|
2019-02-20 20:25:23 +00:00
|
|
|
|
2019-03-31 10:52:29 +00:00
|
|
|
configure_file(
|
|
|
|
${BREATHE_DOC_DOXY_FILE}
|
|
|
|
${BREATHE_DOC_BUILD_DIR}/Doxyfile
|
|
|
|
@ONLY
|
|
|
|
)
|
2019-02-20 20:25:23 +00:00
|
|
|
|
2019-03-31 10:52:29 +00:00
|
|
|
add_custom_target(${BREATHE_DOC_TARGET_NAME}
|
|
|
|
ALL
|
|
|
|
COMMAND
|
2019-02-20 20:25:23 +00:00
|
|
|
${SPHINX_EXECUTABLE}
|
2019-03-31 10:52:29 +00:00
|
|
|
-q
|
|
|
|
-b html
|
|
|
|
-c ${BREATHE_DOC_BUILD_DIR}
|
|
|
|
-d ${BREATHE_DOC_CACHE_DIR}
|
|
|
|
${BREATHE_DOC_SOURCE_DIR}
|
|
|
|
${BREATHE_DOC_HTML_DIR}
|
|
|
|
COMMENT
|
2019-02-20 20:25:23 +00:00
|
|
|
"Building ${BREATHE_DOC_TARGET_NAME} documentation with Breathe, Sphinx and Doxygen"
|
2019-03-31 10:52:29 +00:00
|
|
|
VERBATIM
|
|
|
|
)
|
|
|
|
endif()
|
2019-02-20 20:25:23 +00:00
|
|
|
endfunction()
|