##// END OF EJS Templates
Add button on the SidePane widgets to open left or right inspectors
Add button on the SidePane widgets to open left or right inspectors

File last commit:

r0:5cbbc595e8f3
r101:9678ebc27091
Show More
sciqlop_doxygen.cmake
110 lines | 4.9 KiB | text/x-cmake | CMakeLexer
/ cmake / sciqlop_doxygen.cmake
#
# sciqlop_doxygen.cmake
#
# Launch doxygen generation. Can be activated with the BUILD_DOCUMENTATION
# option.
#
# The following CACHE variables are available:
# * DOXYGEN_LANGUAGE: Documentation language;
#
# The following variables are used (must be set by the cmake file calling this
# one):
# * DOXYGEN_INPUT_DIRS: directories to document;
# * DOXYGEN_EXCLUDE_PATTERNS: directories to exclude from the documentation
# generation.
#
#
# Compile the doxygen documentation
#
OPTION (BUILD_DOCUMENTATION "Build the doxygen-based documentation" ON)
IF (BUILD_DOCUMENTATION)
# Make sure Doxygen is on the system, if not then the documentation can't be built
IF (DOXYGEN_FOUND)
# Append the global docs directory to the list of input directories
LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_SOURCE_DIR}/docs")
LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_BINARY_DIR}/gendocs")
# Exclude the "*_private.h" files by default
list(APPEND DOXYGEN_EXCLUDE_PATTERNS "*_private.h")
# Exclude cpp files
list(APPEND DOXYGEN_EXCLUDE_PATTERNS "*.cpp")
# Set the variables used by the Doxyfile template
SET (PROJECT_NAME "${CMAKE_PROJECT_NAME}")
SET (INPUT_DIRECTORIES)
FOREACH (dir ${DOXYGEN_INPUT_DIRS})
SET (INPUT_DIRECTORIES "${INPUT_DIRECTORIES}\\ \n \"${dir}\" ")
ENDFOREACH ()
SET (EXCLUDE_PATTERNS)
FOREACH (pattern ${DOXYGEN_EXCLUDE_PATTERNS})
SET (EXCLUDE_PATTERNS "${EXCLUDE_PATTERNS}\\ \n \"${pattern}\" ")
ENDFOREACH ()
SET (INDEX_LIST_MODULES "<ul>\n")
FOREACH(module ${ENABLED_MODULE_LIST})
SET (INDEX_LIST_MODULES "${INDEX_LIST_MODULES}<li>[${module}](@ref ${module})</li>\n")
ENDFOREACH()
SET (INDEX_LIST_MODULES "${INDEX_LIST_MODULES}</ul>\n")
# This is the doxyfile that will be used to generate the documentation
# You can use programs like doxywizard to edit the settings
SET (doxygenConfigFileIn "${CMAKE_SOURCE_DIR}/docs/Doxyfile.dox.in")
SET (doxygenConfigFile "${CMAKE_BINARY_DIR}/Doxyfile.dox")
SET (DOXYGEN_LANGUAGE "English" CACHE STRING "Documentation language")
MARK_AS_ADVANCED (DOXYGEN_LANGUAGE)
SET (doxygenIndexFileIn "${CMAKE_SOURCE_DIR}/docs/index.md.in")
SET (doxygenIndexFile "${CMAKE_BINARY_DIR}/gendocs/index.md")
# Using a .in file means we can use CMake to insert project settings
# into the doxyfile. For example, CMake will replace @PROJECT_NAME@ in
# a configured file with the CMake PROJECT_NAME variable's value.
CONFIGURE_FILE (${doxygenConfigFileIn} ${doxygenConfigFile} @ONLY)
CONFIGURE_FILE (${doxygenIndexFileIn} ${doxygenIndexFile} @ONLY)
# Add the documentation target. This lets you run "make docs" from the
# generated CMake makefiles
ADD_CUSTOM_TARGET (docs
${DOXYGEN_EXECUTABLE} ${doxygenConfigFile}
DEPENDS ${doxygenConfigFile}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
VERBATIM)
# You can add an "install" directive to install the resulting documentation
# if desired.
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/documentation/html DESTINATION ${INSTALL_DOCUMENTATION_DIR} OPTIONAL COMPONENT binaries)
# Add a custom command to archive the current HTML documentation generated
# by doxygen
set(ARCHIVED_HTML_OUTPUT_FILE_NAME "${PROJECT_NAME}-${SCIQLOP_VERSION}-documentation-html.tar.bz2")
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/documentation/${ARCHIVED_HTML_OUTPUT_FILE_NAME}
COMMAND sh -c "tar --bzip2 -cf ${ARCHIVED_HTML_OUTPUT_FILE_NAME} html"
DEPENDS docs
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/documentation)
# Add a custom target to execute the above command
add_custom_target(htmldocs DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/documentation/${ARCHIVED_HTML_OUTPUT_FILE_NAME})
# Add a custom command to execute pdflatex on the latex documentation
# generated by doxygen
set(LATEX_OUTPUT_FILE_NAME "${PROJECT_NAME}-${SCIQLOP_VERSION}-documentation.pdf")
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/documentation/${LATEX_OUTPUT_FILE_NAME}
COMMAND make
COMMAND cp refman.pdf ../${LATEX_OUTPUT_FILE_NAME}
DEPENDS docs
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/documentation/latex)
# Add a custom target to execute the above command
add_custom_target(latexdocs DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/documentation/${LATEX_OUTPUT_FILE_NAME})
# Add a custom target to execute all the docs commands
add_custom_target(alldocs DEPENDS htmldocs latexdocs)
ELSE (DOXYGEN_FOUND)
MESSAGE (STATUS "Documentation will not be built - Doxygen not found")
ENDIF (DOXYGEN_FOUND)
ENDIF (BUILD_DOCUMENTATION)