diff options
Diffstat (limited to 'host/docs/CMakeLists.txt')
-rw-r--r-- | host/docs/CMakeLists.txt | 113 |
1 files changed, 37 insertions, 76 deletions
diff --git a/host/docs/CMakeLists.txt b/host/docs/CMakeLists.txt index 1ee0f1ade..cd061975b 100644 --- a/host/docs/CMakeLists.txt +++ b/host/docs/CMakeLists.txt @@ -18,96 +18,57 @@ ######################################################################## # List of manual sources ######################################################################## -SET(manual_sources - index.rst - identification.rst - build.rst - calibration.rst - coding.rst - dboards.rst - gpio_api.rst - gpsdo.rst - gpsdo_b2x0.rst - gpsdo_x3x0.rst - general.rst - images.rst - stream.rst - sync.rst - transport.rst - usrp1.rst - usrp2.rst - usrp_b100.rst - usrp_b200.rst - usrp_e1x0.rst - usrp_x3x0.rst - usrp_x3x0_config.rst -) ######################################################################## -# Setup Manual +# Setup general Doxygen variables ######################################################################## -MESSAGE(STATUS "") -FIND_PACKAGE(Docutils) - -LIBUHD_REGISTER_COMPONENT("Manual" ENABLE_MANUAL ON "DOCUTILS_FOUND" OFF) +FIND_PACKAGE(Doxygen) +SET(ENABLE_MANUAL_OR_DOXYGEN false) -IF(UHDHOST_PKG) - SET(PKG_DOC_DIR share/doc/uhd-host) -ENDIF(UHDHOST_PKG) +######################################################################## +# Setup Manual (using Doxygen) +######################################################################## +MESSAGE(STATUS "") +LIBUHD_REGISTER_COMPONENT("Manual" ENABLE_MANUAL ON "DOXYGEN_FOUND" OFF) IF(ENABLE_MANUAL) - #setup rst2html options - SET(stylesheet ${CMAKE_CURRENT_SOURCE_DIR}/style.css) - SET(rst2html_options - --stylesheet=${stylesheet} - --no-toc-backlinks --date --time - ) - - #create generation rule for each source - FOREACH(rstfile ${manual_sources}) - #set input and output file names - SET(rstfile ${CMAKE_CURRENT_SOURCE_DIR}/${rstfile}) - GET_FILENAME_COMPONENT(rstfile_we ${rstfile} NAME_WE) - SET(htmlfile ${CMAKE_CURRENT_BINARY_DIR}/${rstfile_we}.html) - - #make the html file depend on the rst file - ADD_CUSTOM_COMMAND( - OUTPUT ${htmlfile} DEPENDS ${rstfile} ${stylesheet} - COMMAND ${RST2HTML_EXECUTABLE} ${rstfile} ${htmlfile} ${rst2html_options} - COMMENT "Generating ${htmlfile}" - ) - - #make the manual target depend on the html file - LIST(APPEND manual_html_files ${htmlfile}) - UHD_INSTALL(FILES ${htmlfile} DESTINATION ${PKG_DOC_DIR}/manual/html COMPONENT manual) - ENDFOREACH(rstfile ${manual_sources}) - - #make the html manual a build-time dependency - ADD_CUSTOM_TARGET(manual_html ALL DEPENDS ${manual_html_files}) - UHD_INSTALL(FILES ${manual_sources} DESTINATION ${PKG_DOC_DIR}/manual/rst COMPONENT manual) - - #resources for html manual - ADD_CUSTOM_COMMAND( - TARGET manual_html POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/res ${CMAKE_CURRENT_BINARY_DIR}/res - ) - UHD_INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/res DESTINATION ${PKG_DOC_DIR}/manual/html COMPONENT manual) - + SET(ENABLE_MANUAL_OR_DOXYGEN true) + FILE(GLOB manual_sources "*.dox") + SET(DOXYGEN_DEPENDENCIES ${manual_sources}) + SET(DOXYGEN_INPUT_DIRS ${CMAKE_SOURCE_DIR}/docs) + SET(DOXYGEN_DEP_COMPONENT "manual") ENDIF(ENABLE_MANUAL) ######################################################################## -# Setup Doxygen +# Setup API documentation (using Doxygen) ######################################################################## MESSAGE(STATUS "") -FIND_PACKAGE(Doxygen) - -LIBUHD_REGISTER_COMPONENT("Doxygen" ENABLE_DOXYGEN ON "DOXYGEN_FOUND" OFF) +LIBUHD_REGISTER_COMPONENT("API/Doxygen" ENABLE_DOXYGEN ON "DOXYGEN_FOUND" OFF) +OPTION(ENABLE_DOXYGEN_FULL "Use Doxygen to document the entire source tree (not just API)" OFF) IF(LIBUHDDEV_PKG) SET(PKG_DOC_DIR share/doc/libuhd-dev) ENDIF(LIBUHDDEV_PKG) IF(ENABLE_DOXYGEN) + SET(ENABLE_MANUAL_OR_DOXYGEN true) + #make doxygen directory depend on the header files + FILE(GLOB_RECURSE header_files ${CMAKE_SOURCE_DIR}/include/*.hpp) + SET(DOXYGEN_DEPENDENCIES ${DOXYGEN_DEPENDENCIES} ${header_files}) + IF(ENABLE_DOXYGEN_FULL) + SET(DOXYGEN_INPUT_DIRS "${DOXYGEN_INPUT_DIRS} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/lib") + ELSE(ENABLE_DOXYGEN_FULL) + SET(DOXYGEN_INPUT_DIRS "${DOXYGEN_INPUT_DIRS} ${CMAKE_SOURCE_DIR}/include") + ENDIF(ENABLE_DOXYGEN_FULL) + + SET(DOXYGEN_DEP_COMPONENT "doxygen") +ENDIF(ENABLE_DOXYGEN) + +######################################################################## +# Run Doxygen (on code and/or manual, depending on CMake flags) +######################################################################## +MESSAGE(STATUS "") +IF(ENABLE_MANUAL_OR_DOXYGEN) #generate the doxygen configuration file SET(CMAKE_CURRENT_BINARY_DIR_DOXYGEN ${CMAKE_CURRENT_BINARY_DIR}/doxygen) CONFIGURE_FILE( @@ -118,15 +79,15 @@ IF(ENABLE_DOXYGEN) #make doxygen directory depend on the header files FILE(GLOB_RECURSE header_files ${CMAKE_SOURCE_DIR}/include/*.hpp) ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN} DEPENDS ${header_files} + OUTPUT ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN} DEPENDS ${DOXYGEN_DEPENDENCIES} COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile COMMENT "Generating documentation with doxygen" ) #make the doxygen generation a built-time dependency ADD_CUSTOM_TARGET(doxygen_docs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN}) - UHD_INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN} DESTINATION ${PKG_DOC_DIR} COMPONENT doxygen) -ENDIF(ENABLE_DOXYGEN) + UHD_INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN} DESTINATION ${PKG_DOC_DIR} COMPONENT ${DOXYGEN_DEP_COMPONENT}) +ENDIF(ENABLE_MANUAL_OR_DOXYGEN) ######################################################################## # List of man page sources |