[CMake] Add doxygen documentation generation (STR #3195).

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10720 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser 2015-04-25 21:42:51 +00:00
parent a6a75b81d2
commit 5f3f1c8bc6
4 changed files with 1679 additions and 0 deletions

View File

@ -75,6 +75,20 @@ option(OPTION_BUILD_SHARED_LIBS
####################################################################### #######################################################################
option(OPTION_BUILD_EXAMPLES "build example programs" ON) option(OPTION_BUILD_EXAMPLES "build example programs" ON)
#######################################################################
if(DOXYGEN_FOUND)
option(OPTION_BUILD_HTML_DOCUMENTATION "build html docs" OFF)
option(OPTION_INSTALL_HTML_DOCUMENTATION "install html docs" OFF)
if(LATEX_FOUND)
option(OPTION_BUILD_PDF_DOCUMENTATION "build pdf docs" OFF)
option(OPTION_INSTALL_PDF_DOCUMENTATION "install pdf docs" OFF)
endif(LATEX_FOUND)
endif(DOXYGEN_FOUND)
if(OPTION_BUILD_HTML_DOCUMENTATION OR OPTION_BUILD_PDF_DOCUMENTATION)
add_subdirectory(documentation)
endif(OPTION_BUILD_HTML_DOCUMENTATION OR OPTION_BUILD_PDF_DOCUMENTATION)
####################################################################### #######################################################################
include(FindPkgConfig) include(FindPkgConfig)

View File

@ -117,3 +117,26 @@ if(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX)
endif(V) endif(V)
endif(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX) endif(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX)
mark_as_advanced(HAVE_SCANDIR_POSIX) mark_as_advanced(HAVE_SCANDIR_POSIX)
#######################################################################
# packages
# Doxygen: necessary for HTML and PDF docs
find_package(Doxygen)
# LaTex: necessary for PDF docs (note: FindLATEX doesn't return LATEX_FOUND)
# Note: we only check existence of `latex' (LATEX_COMPILER), hence
# building the pdf docs may still fail because of other missing tools.
set (LATEX_FOUND)
if (DOXYGEN_FOUND)
find_package(LATEX)
if (LATEX_COMPILER AND NOT LATEX_FOUND)
set(LATEX_FOUND YES)
endif (LATEX_COMPILER AND NOT LATEX_FOUND)
endif (DOXYGEN_FOUND)
# message("Doxygen found : ${DOXYGEN_FOUND}")
# message("LaTex found : ${LATEX_FOUND}")
# message("LaTex Compiler : ${LATEX_COMPILER}")

View File

@ -0,0 +1,138 @@
#
# "$Id$"
#
# CMakeLists.txt to build docs for the FLTK project using CMake (www.cmake.org)
#
# Copyright 1998-2015 by Bill Spitzak and others.
#
# This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this
# file is missing or damaged, see the license at:
#
# http://www.fltk.org/COPYING.php
#
# Please report all bugs and problems on the following page:
#
# http://www.fltk.org/str.php
#
set (DOCS)
#--------------------------
# build html documentation
#--------------------------
if(OPTION_BUILD_HTML_DOCUMENTATION)
list(APPEND DOCS html)
# generate Doxygen file "Doxyfile"
set(GENERATE_HTML YES)
set(GENERATE_LATEX NO)
set(LATEX_HEADER "")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
@ONLY
)
# generate html docs
add_custom_target(html
# ALL
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating HTML documentation" VERBATIM
DEPENDS fltk
)
endif(OPTION_BUILD_HTML_DOCUMENTATION)
#--------------------------
# build pdf documentation
#--------------------------
if (OPTION_BUILD_PDF_DOCUMENTATION)
list(APPEND DOCS pdf)
# generate Doxygen file "Doxybook"
set(GENERATE_HTML NO)
set(GENERATE_LATEX YES)
set(LATEX_HEADER "${CMAKE_CURRENT_BINARY_DIR}/fltk-book.tex")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/Doxybook
@ONLY
)
# generate LaTeX header fltk-book.tex
set(FL_VERSION ${FLTK_VERSION_FULL})
set(DOXY_VERSION ${DOXYGEN_VERSION})
execute_process(COMMAND date +%Y
OUTPUT_VARIABLE YEAR
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/fltk-book.tex.in
${CMAKE_CURRENT_BINARY_DIR}/fltk-book.tex
@ONLY
)
# generate fltk.pdf
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fltk.pdf
COMMAND ${DOXYGEN_EXECUTABLE} Doxybook
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/make_pdf
COMMAND cp -f latex/refman.pdf fltk.pdf
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating PDF documentation" VERBATIM
DEPENDS fltk
)
# add target 'pdf'
add_custom_target(pdf
# ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/fltk.pdf
)
endif(OPTION_BUILD_PDF_DOCUMENTATION)
#----------------------------------
# add target 'docs' for all docs
#----------------------------------
if (DOCS)
add_custom_target(docs
# ALL
DEPENDS ${DOCS}
)
endif (DOCS)
#----------------------------------
# install html + pdf documentation
#----------------------------------
if(OPTION_INSTALL_HTML_DOCUMENTATION AND OPTION_BUILD_HTML_DOCUMENTATION)
install(DIRECTORY ${CMAKE_BINARY_DIR}/documentation/html
DESTINATION ${FLTK_DATADIR}/doc/fltk
)
endif(OPTION_INSTALL_HTML_DOCUMENTATION AND OPTION_BUILD_HTML_DOCUMENTATION)
if(OPTION_INSTALL_PDF_DOCUMENTATION AND OPTION_BUILD_PDF_DOCUMENTATION)
install(FILES ${CMAKE_BINARY_DIR}/documentation/fltk.pdf
DESTINATION ${FLTK_DATADIR}/doc/fltk/
)
endif(OPTION_INSTALL_PDF_DOCUMENTATION AND OPTION_BUILD_PDF_DOCUMENTATION)

1504
documentation/Doxyfile.in Normal file

File diff suppressed because it is too large Load Diff