Commit 95ba61d5 authored by Jason Rhinelander's avatar Jason Rhinelander

Added automatic doc generation for packages

parent 03a08b5c
......@@ -7,6 +7,7 @@ flags = [
'-Werror',
'-std=c++11',
'-I', '.',
'-I', 'build',
'-I', '/usr/include/eigen3'
]
......
......@@ -103,8 +103,28 @@ foreach(exec ${fracdist_programs})
target_link_libraries(${exec} fracdist)
endforeach()
# If fracdist_PACKAGE_DOCS is not set, include it only if doxygen is found
if (NOT DEFINED fracdist_PACKAGE_DOCS)
find_package(Doxygen 1.8.2)
if (DOXYGEN_FOUND)
message(STATUS "doxygen found: enabling documentation generation")
set(fracdist_PACKAGE_DOCS 1)
else()
message(STATUS "doxygen not found: documentation generation disabled")
endif()
endif()
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
set(fracdist_docdir "doc")
else()
set(fracdist_docdir "share/doc/fracdist")
endif()
add_subdirectory(doc EXCLUDE_FROM_ALL)
if (fracdist_PACKAGE_DOCS)
add_subdirectory(doc)
else()
add_subdirectory(doc EXCLUDE_FROM_ALL)
endif()
set(CPACK_PACKAGE_VERSION_MAJOR ${fracdist_VMAJ})
......
......@@ -6,32 +6,25 @@ if(NOT DOXYGEN_DOT_FOUND)
message(FATAL_ERROR "Could NOT find dot (required by doxygen)")
endif()
add_custom_target(doc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/DoxygenLayout.xml.in ${CMAKE_CURRENT_BINARY_DIR}/DoxygenLayout.xml @ONLY)
# Use a custom command to output doxygen's generated index file. Doing it this way ensures
# that 'make doc' only runs doxygen when something in src or include has changed.
add_custom_command(OUTPUT "api/index.xhtml"
add_custom_command(OUTPUT "api/index.html"
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
DEPENDS "Doxyfile.in" ${fracdist_headers} ${fracdist_source} data
DEPENDS "Doxyfile.in" ${fracdist_headers} ${fracdist_source} data ${fracdist_data_generated}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Generating API documentation (using doxygen)"
)
add_custom_target(api_doc DEPENDS "api/index.xhtml")
add_custom_target(api_doc ALL DEPENDS "api/index.html" data)
set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/api")
#set_property(DIRECTORY APPEND PROPERTY
# ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/api-latex")
add_dependencies(api_doc data)
add_dependencies(doc api_doc)
add_dependencies(api_doc ${fracdist_data_generated})
install(DIRECTORY api
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/api"
DESTINATION "${fracdist_docdir}"
COMPONENT doc)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment