diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e4f68b..45dce26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,26 @@ target_link_libraries(${PROJECT_NAME} RapidXML) add_subdirectory("src/dml") add_subdirectory("src/protocol") +find_package(Doxygen) +option(KI_BUILD_DOCUMENTATION "Determines whether to build the HTML documentation. (via Doxygen)" ${DOXYGEN_FOUND}) +if (KI_BUILD_DOCUMENTATION) + if(NOT DOXYGEN_FOUND) + message(FATAL_ERROR "Doxygen is needed to build the documentation.") + endif() + + set(DOXYFILE_IN ${PROJECT_SOURCE_DIR}/docs/Doxyfile.in) + set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) + configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY) + + add_custom_target( + doc ALL + COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API documentation with Doxygen" + VERBATIM + ) +endif() + option(COVERALLS "Generate coveralls data" OFF) if (COVERALLS) include(Coveralls) diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in new file mode 100644 index 0000000..dd7536e --- /dev/null +++ b/docs/Doxyfile.in @@ -0,0 +1,9 @@ +PROJECT_NAME = "libki" +STRIP_FROM_PATH = "@PROJECT_SOURCE_DIR@" +INPUT = "@PROJECT_SOURCE_DIR@/src" \ + "@PROJECT_SOURCE_DIR@/include" +FILE_PATTERNS = *.h \ + *.cpp +OUTPUT_DIRECTORY = "@CMAKE_CURRENT_BINARY_DIR@/docs" +RECURSIVE = YES +GENERATE_LATEX = NO