Правила для сборки документации

This commit is contained in:
Andrei Astafev 2019-10-13 09:13:51 +03:00
parent 0a2d9a4fce
commit 156d74f581
2 changed files with 18 additions and 16 deletions

View File

@ -37,13 +37,11 @@ endif()
function(add_breathe_target) function(add_breathe_target)
set(options) set(options)
set(oneValueArgs set(oneValueArgs
TARGET_NAME
SOURCE_DIR SOURCE_DIR
BUILD_DIR
CACHE_DIR
HTML_DIR
DOXY_FILE DOXY_FILE
CONF_FILE CONF_FILE
TARGET_NAME OUTPUT_DIR
COMMENT) COMMENT)
set(multiValueArgs) set(multiValueArgs)
@ -53,14 +51,15 @@ function(add_breathe_target)
"${multiValueArgs}" "${multiValueArgs}"
${ARGN}) ${ARGN})
if(BREATHE_FOUND) if(BREATHE_FOUND)
set(BREATHE_DOCS_BUILD_DIR ${_BREATHE_BUILD_DIR}) set(WORK_DIR ${CMAKE_BINARY_DIR}/_breathe)
set(BREATHE_DOCS_BUILD_DIR ${WORK_DIR})
set(GENERATE_XML YES) set(GENERATE_XML YES)
set(GENERATE_HTML NO) set(GENERATE_HTML NO)
set(GENERATE_LATEX NO) set(GENERATE_LATEX NO)
set(OUTPUT_DIRECTORY ${_BREATHE_HTML_DIR}) set(OUTPUT_DIRECTORY ${WORK_DIR})
configure_file(${_BREATHE_CONF_FILE} ${_BREATHE_BUILD_DIR}/conf.py @ONLY) configure_file(${_BREATHE_CONF_FILE} ${WORK_DIR}/conf.py @ONLY)
configure_file(${_BREATHE_DOXY_FILE} ${_BREATHE_BUILD_DIR}/Doxyfile @ONLY) configure_file(${_BREATHE_DOXY_FILE} ${WORK_DIR}/Doxyfile @ONLY)
add_custom_target(${_BREATHE_TARGET_NAME} VERBATIM add_custom_target(${_BREATHE_TARGET_NAME} VERBATIM
COMMAND ${SPHINX_EXECUTABLE} COMMAND ${SPHINX_EXECUTABLE}
@ -68,11 +67,11 @@ function(add_breathe_target)
-b -b
html html
-c -c
${_BREATHE_BUILD_DIR} ${WORK_DIR}
-d -d
${_BREATHE_CACHE_DIR} ${WORK_DIR}/cache
${_BREATHE_SOURCE_DIR} ${_BREATHE_SOURCE_DIR}
${_BREATHE_HTML_DIR} ${_BREATHE_OUTPUT_DIR}
COMMENT "Building ${_BREATHE_TARGET_NAME} documentation with Breathe") COMMENT "Building ${_BREATHE_TARGET_NAME} documentation with Breathe")
else() else()
add_custom_target(${_BREATHE_TARGET_NAME} VERBATIM add_custom_target(${_BREATHE_TARGET_NAME} VERBATIM

View File

@ -16,8 +16,9 @@ function(add_doxygen_target)
set(options) set(options)
set(oneValueArgs set(oneValueArgs
TARGET_NAME TARGET_NAME
SOURCE_DIR
DOXY_FILE DOXY_FILE
OUTPUT_DIRECTORY OUTPUT_DIR
LATEX LATEX
HTML) HTML)
set(multiValueArgs) set(multiValueArgs)
@ -31,6 +32,8 @@ function(add_doxygen_target)
set(GENERATE_XML NO) set(GENERATE_XML NO)
set(GENERATE_HTML NO) set(GENERATE_HTML NO)
set(GENERATE_LATEX NO) set(GENERATE_LATEX NO)
set(OUTPUT_DIRECTORY ${_DOXYGEN_OUTPUT_DIR})
set(SOURCE_DIR ${_DOXYGEN_SOURCE_DIR})
if(_DOXYGEN_HTML) if(_DOXYGEN_HTML)
set(GENERATE_HTML YES) set(GENERATE_HTML YES)
endif() endif()
@ -38,12 +41,12 @@ function(add_doxygen_target)
set(GENERATE_LATEX YES) set(GENERATE_LATEX YES)
endif() endif()
configure_file(${_DOXYGEN_DOXY_FILE} ${_DOXYGEN_OUTPUT_DIRECTORY}/Doxyfile @ONLY) set(WORK_DIR ${CMAKE_BINARY_DIR}/_doxygen)
message("Doxygen build started") configure_file(${_DOXYGEN_DOXY_FILE} ${WORK_DIR}/Doxyfile @ONLY)
add_custom_target(${_DOXYGEN_TARGET_NAME} VERBATIM add_custom_target(${_DOXYGEN_TARGET_NAME} VERBATIM
COMMAND ${DOXYGEN_EXECUTABLE} ${_DOXYGEN_OUTPUT_DIRECTORY}/Doxyfile COMMAND ${DOXYGEN_EXECUTABLE} ${WORK_DIR}/Doxyfile
WORKING_DIRECTORY ${_DOXYGEN_OUTPUT_DIRECTORY} WORKING_DIRECTORY ${WORK_DIR}
COMMENT "Generating API documentation with Doxygen") COMMENT "Generating API documentation with Doxygen")
else() else()
add_custom_target(${_DOXYGEN_TARGET_NAME} VERBATIM add_custom_target(${_DOXYGEN_TARGET_NAME} VERBATIM