diff options
Diffstat (limited to 'projects/CMake/CMakeLists.txt')
-rw-r--r-- | projects/CMake/CMakeLists.txt | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index b645d64..090b31a 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -127,15 +127,51 @@ set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") # target to generate documentation with Doxygen find_package(Doxygen) if(DOXYGEN_FOUND) - set(DOXY_CONF ${RXCPP_DIR}/projects/doxygen/doxygen.conf) + # Doxygen configuration + set(DOXY_CONF_DIR ${RXCPP_DIR}/projects/doxygen) + set(DOXY_CONF_FILE ${DOXY_CONF_DIR}/doxygen.conf) + + # File with main page (index.html) content + set(DOXY_MAIN_PAGE ${DOXY_CONF_DIR}/mainpage.dox) + + # Sources for processing location + set(DOXY_INPUT_DIR "${IX_SRC_DIR} ${RX_SRC_DIR} ${DOXY_MAIN_PAGE}") + + # C++ examples location + set(DOXY_EXAMPLES_SRC_DIR ${EXAMPLES_DIR}/doxygen) + set(DOXY_EXAMPLES_BIN_DIR doxy_examples) + + # Directories and files allowed for include-type command (\include, \example, \snippet etc) + set(DOXY_INCLUDE_DIR "${RXCPP_DIR} ${DOXY_EXAMPLES_SRC_DIR}") + + # Resulting documentation to be placed here set(DOXY_OUTPUT_DIR ${RXCPP_DIR}/projects/doxygen) - set(DOXY_INPUT_DIR "${IX_SRC_DIR} ${RX_SRC_DIR}") - - configure_file(${DOXY_CONF}.in ${DOXY_CONF}) + # Make Doxygen configuration from template with placeholders + configure_file(${DOXY_CONF_FILE}.in ${DOXY_CONF_FILE}) + + # Target to build examples + set(DOXY_EXAMPLE_SRC_LIST + ${DOXY_EXAMPLES_SRC_DIR}/main.cpp + ${DOXY_EXAMPLES_SRC_DIR}/create.cpp + ) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${DOXY_EXAMPLES_BIN_DIR}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${DOXY_EXAMPLES_BIN_DIR}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${DOXY_EXAMPLES_BIN_DIR}) + add_executable(doxy_examples EXCLUDE_FROM_ALL ${DOXY_EXAMPLE_SRC_LIST}) + TARGET_LINK_LIBRARIES(doxy_examples ${CMAKE_THREAD_LIBS_INIT}) + + # Target to execute examples and save their output + add_custom_command( + OUTPUT doxy_examples_output + COMMAND ${DOXY_EXAMPLES_BIN_DIR}/doxy_examples > ${DOXY_EXAMPLES_SRC_DIR}/output.txt + COMMENT "Execute examples for Doxygen documentation") + + # Target to generate docs add_custom_target(doc - COMMAND ${DOXYGEN_EXECUTABLE} ${DOXY_CONF} + COMMAND ${DOXYGEN_EXECUTABLE} ${DOXY_CONF_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS doxy_examples doxy_examples_output COMMENT "Generating documentation with Doxygen" VERBATIM) endif() |