2015-04-26 00:42:51 +03:00
|
|
|
#
|
|
|
|
# CMakeLists.txt to build docs for the FLTK project using CMake (www.cmake.org)
|
|
|
|
#
|
2023-08-30 18:24:39 +03:00
|
|
|
# Copyright 1998-2023 by Bill Spitzak and others.
|
2015-04-26 00:42:51 +03:00
|
|
|
#
|
|
|
|
# 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:
|
|
|
|
#
|
2020-01-26 17:06:46 +03:00
|
|
|
# https://www.fltk.org/COPYING.php
|
2015-04-26 00:42:51 +03:00
|
|
|
#
|
2020-07-01 19:03:10 +03:00
|
|
|
# Please see the following page on how to report bugs and issues:
|
2015-04-26 00:42:51 +03:00
|
|
|
#
|
2020-07-01 19:03:10 +03:00
|
|
|
# https://www.fltk.org/bugs.php
|
2015-04-26 00:42:51 +03:00
|
|
|
#
|
|
|
|
|
|
|
|
set (DOCS)
|
2022-08-10 19:51:53 +03:00
|
|
|
set (GENERATE_DOCS FALSE)
|
2022-10-03 11:49:43 +03:00
|
|
|
set (GIT_REVISION "")
|
|
|
|
set (YEAR "")
|
|
|
|
set (CURRENT_DATE "")
|
2022-08-10 19:51:53 +03:00
|
|
|
|
|
|
|
if (OPTION_BUILD_HTML_DOCUMENTATION OR OPTION_BUILD_PDF_DOCUMENTATION)
|
|
|
|
set (GENERATE_DOCS TRUE)
|
|
|
|
endif ()
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2018-12-29 22:04:38 +03:00
|
|
|
if (OPTION_INCLUDE_DRIVER_DOCUMENTATION)
|
|
|
|
set (DRIVER_DOCS "DriverDev")
|
|
|
|
else ()
|
|
|
|
set (DRIVER_DOCS "")
|
|
|
|
endif ()
|
|
|
|
|
2022-08-10 19:51:53 +03:00
|
|
|
#------------------------------------------------
|
|
|
|
# generate files used for both HTML and PDF docs
|
|
|
|
#------------------------------------------------
|
|
|
|
|
|
|
|
if (GENERATE_DOCS)
|
|
|
|
|
|
|
|
# create required variables
|
|
|
|
|
|
|
|
execute_process (COMMAND date "+%Y"
|
|
|
|
OUTPUT_VARIABLE YEAR
|
2023-08-30 18:24:39 +03:00
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
2022-08-10 19:51:53 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
# note: current locale is used for abbreviated month
|
|
|
|
execute_process (COMMAND date "+%b %d, %Y"
|
|
|
|
OUTPUT_VARIABLE CURRENT_DATE
|
2023-08-30 18:24:39 +03:00
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
2022-08-10 19:51:53 +03:00
|
|
|
)
|
|
|
|
|
2022-10-03 11:49:43 +03:00
|
|
|
# find git revision
|
|
|
|
|
|
|
|
# FIXME: This must also work with tarballs where git is not available.
|
|
|
|
# For now we just ignore errors and set GIT_REVISION = "unkown".
|
|
|
|
# In the future tarball/zip generation should create a file
|
|
|
|
# that contains the git revision.
|
|
|
|
|
2022-09-17 10:56:45 +03:00
|
|
|
execute_process (COMMAND
|
2023-08-30 18:24:39 +03:00
|
|
|
git --git-dir=${FLTK_SOURCE_DIR}/.git rev-parse --short=10 HEAD
|
2022-08-10 19:51:53 +03:00
|
|
|
OUTPUT_VARIABLE GIT_REVISION
|
2023-08-30 18:24:39 +03:00
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
2022-10-03 11:49:43 +03:00
|
|
|
ERROR_QUIET
|
2022-08-10 19:51:53 +03:00
|
|
|
)
|
2023-08-30 18:24:39 +03:00
|
|
|
|
2022-10-03 11:49:43 +03:00
|
|
|
# set to "'unkown'" if git is not available
|
|
|
|
if (GIT_REVISION STREQUAL "")
|
|
|
|
set (GIT_REVISION "'unkown'")
|
|
|
|
endif()
|
|
|
|
|
2023-09-07 19:28:55 +03:00
|
|
|
# Find "short" doxygen version if it was built from Git
|
|
|
|
# Note: this is still needed in CMake 3.12.0 but later CMake versions
|
|
|
|
# (notably 3.25) remove the Git revision in 'DOXYGEN_VERSION'.
|
|
|
|
# Todo: Find the "first good" CMake version and remove this redundant
|
|
|
|
# code once we require this as our minimal version and replace the
|
|
|
|
# variable DOXYGEN_VERSION_SHORT with DOXYGEN_VERSION below.
|
2022-10-03 11:49:43 +03:00
|
|
|
|
|
|
|
if (DOXYGEN_FOUND)
|
|
|
|
# strip trailing git revision if doxygen was built from source
|
|
|
|
string (REGEX REPLACE " .*$" "" DOXYGEN_VERSION_SHORT ${DOXYGEN_VERSION})
|
|
|
|
endif (DOXYGEN_FOUND)
|
2022-08-10 19:51:53 +03:00
|
|
|
|
|
|
|
# configure copyright.dox (includes current year)
|
|
|
|
configure_file (
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/copyright.dox.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/copyright.dox
|
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
|
|
|
|
# configure generated.dox (includes date and versions)
|
|
|
|
configure_file (
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/generated.dox.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/generated.dox
|
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
|
2022-10-03 11:49:43 +03:00
|
|
|
if (0) # debug
|
2023-08-30 18:24:39 +03:00
|
|
|
fl_debug_var (YEAR)
|
|
|
|
fl_debug_var (CURRENT_DATE)
|
2022-10-03 11:49:43 +03:00
|
|
|
fl_debug_var (GIT_REVISION)
|
|
|
|
fl_debug_var (DOXYGEN_FOUND)
|
|
|
|
fl_debug_var (DOXYGEN_EXECUTABLE)
|
|
|
|
fl_debug_var (DOXYGEN_VERSION)
|
|
|
|
fl_debug_var (DOXYGEN_VERSION_SHORT)
|
|
|
|
endif ()
|
|
|
|
|
2022-08-10 19:51:53 +03:00
|
|
|
endif (GENERATE_DOCS)
|
|
|
|
|
2015-04-26 00:42:51 +03:00
|
|
|
#--------------------------
|
|
|
|
# build html documentation
|
|
|
|
#--------------------------
|
|
|
|
|
2020-01-26 17:06:46 +03:00
|
|
|
if (OPTION_BUILD_HTML_DOCUMENTATION)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
list (APPEND DOCS html)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
# generate Doxygen file "Doxyfile"
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
set (GENERATE_HTML YES)
|
|
|
|
set (GENERATE_LATEX NO)
|
|
|
|
set (LATEX_HEADER "")
|
2023-09-07 19:28:55 +03:00
|
|
|
set (DOXYFILE "Doxyfile")
|
|
|
|
set (LOGFILE "${CMAKE_CURRENT_BINARY_DIR}/${DOXYFILE}_error.log")
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2021-09-21 21:28:02 +03:00
|
|
|
# configure Doxygen input file for HTML docs (Doxyfile.in)
|
|
|
|
|
2020-09-20 15:44:14 +03:00
|
|
|
configure_file (
|
2020-06-13 16:19:27 +03:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
|
2023-09-07 19:28:55 +03:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${DOXYFILE}.in
|
2020-06-13 16:19:27 +03:00
|
|
|
@ONLY
|
|
|
|
)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2023-09-07 19:28:55 +03:00
|
|
|
# convert Doxyfile to used doxygen version
|
2021-09-21 21:28:02 +03:00
|
|
|
|
|
|
|
add_custom_command (
|
2023-09-07 19:28:55 +03:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${DOXYFILE}
|
2021-09-21 21:28:02 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
2023-09-07 19:28:55 +03:00
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/convert_doxyfile
|
|
|
|
${DOXYGEN_EXECUTABLE}
|
|
|
|
${DOXYFILE}.in
|
|
|
|
${DOXYFILE}
|
|
|
|
${LOGFILE}
|
2023-09-07 14:41:47 +03:00
|
|
|
BYPRODUCTS ${LOGFILE}
|
2023-09-07 19:28:55 +03:00
|
|
|
COMMENT "Converting ${DOXYFILE} to doxygen version ${DOXYGEN_VERSION_SHORT}" VERBATIM
|
2020-06-13 16:19:27 +03:00
|
|
|
)
|
2019-09-16 18:17:54 +03:00
|
|
|
|
2021-09-21 21:28:02 +03:00
|
|
|
# generate HTML documentation
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
add_custom_target (html
|
2023-09-07 19:28:55 +03:00
|
|
|
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE}
|
|
|
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${DOXYFILE}
|
2020-06-13 16:19:27 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
COMMENT "Generating HTML documentation" VERBATIM
|
|
|
|
)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-01-26 17:06:46 +03:00
|
|
|
endif (OPTION_BUILD_HTML_DOCUMENTATION)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
|
|
|
#--------------------------
|
|
|
|
# build pdf documentation
|
|
|
|
#--------------------------
|
|
|
|
|
|
|
|
if (OPTION_BUILD_PDF_DOCUMENTATION)
|
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
list (APPEND DOCS pdf)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2021-09-21 21:28:02 +03:00
|
|
|
# generate Doxygen input file "Doxybook"
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
set (GENERATE_HTML NO)
|
|
|
|
set (GENERATE_LATEX YES)
|
|
|
|
set (LATEX_HEADER "${CMAKE_CURRENT_BINARY_DIR}/fltk-book.tex")
|
2023-09-07 19:28:55 +03:00
|
|
|
set (DOXYFILE "Doxybook")
|
|
|
|
set (LOGFILE "${CMAKE_CURRENT_BINARY_DIR}/${DOXYFILE}_error.log")
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2021-09-21 21:28:02 +03:00
|
|
|
# configure Doxygen input file for PDF docs (Doxybook.in)
|
|
|
|
|
2020-09-20 15:44:14 +03:00
|
|
|
configure_file (
|
2020-06-13 16:19:27 +03:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
|
2023-09-07 19:28:55 +03:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${DOXYFILE}.in
|
2020-06-13 16:19:27 +03:00
|
|
|
@ONLY
|
|
|
|
)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2021-09-21 21:28:02 +03:00
|
|
|
# convert Doxybook to current doxygen version
|
|
|
|
|
|
|
|
add_custom_command (
|
2023-09-07 19:28:55 +03:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${DOXYFILE}
|
2021-09-21 21:28:02 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
2023-09-07 19:28:55 +03:00
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/convert_doxyfile
|
|
|
|
${DOXYGEN_EXECUTABLE}
|
|
|
|
${DOXYFILE}.in
|
|
|
|
${DOXYFILE}
|
|
|
|
${LOGFILE}
|
2023-09-07 14:41:47 +03:00
|
|
|
BYPRODUCTS ${LOGFILE}
|
2023-09-07 19:28:55 +03:00
|
|
|
COMMENT "Converting ${DOXYFILE} to doxygen version ${DOXYGEN_VERSION_SHORT}" VERBATIM
|
2021-09-21 21:28:02 +03:00
|
|
|
)
|
|
|
|
|
2021-02-15 21:45:20 +03:00
|
|
|
# generate LaTeX title fltk-title.tex
|
|
|
|
|
2020-09-20 15:44:14 +03:00
|
|
|
configure_file (
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/fltk-title.tex.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/fltk-title.tex
|
2020-06-13 16:19:27 +03:00
|
|
|
@ONLY
|
|
|
|
)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
# generate fltk.pdf
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-09-20 15:44:14 +03:00
|
|
|
add_custom_command (
|
2020-06-13 16:19:27 +03:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fltk.pdf
|
2020-09-20 15:44:14 +03:00
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/make_header
|
2023-08-29 18:25:10 +03:00
|
|
|
${DOXYGEN_EXECUTABLE}
|
2020-09-20 15:44:14 +03:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/fltk-title.tex
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/fltk-book.tex
|
2023-09-07 19:28:55 +03:00
|
|
|
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE}
|
2020-06-13 16:19:27 +03:00
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/make_pdf
|
|
|
|
COMMAND cp -f latex/refman.pdf fltk.pdf
|
2023-09-07 19:28:55 +03:00
|
|
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${DOXYFILE}
|
2021-09-21 21:28:02 +03:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/fltk-title.tex
|
2020-06-13 16:19:27 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
COMMENT "Generating PDF documentation" VERBATIM
|
|
|
|
)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
# add target 'pdf'
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
add_custom_target (pdf
|
|
|
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/fltk.pdf
|
|
|
|
)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
endif (OPTION_BUILD_PDF_DOCUMENTATION)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
|
|
|
#----------------------------------
|
|
|
|
# add target 'docs' for all docs
|
|
|
|
#----------------------------------
|
|
|
|
|
|
|
|
if (DOCS)
|
|
|
|
|
2020-09-20 15:44:14 +03:00
|
|
|
add_custom_target (docs
|
2020-06-13 16:19:27 +03:00
|
|
|
DEPENDS ${DOCS}
|
|
|
|
)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
|
|
|
endif (DOCS)
|
|
|
|
|
|
|
|
#----------------------------------
|
|
|
|
# install html + pdf documentation
|
|
|
|
#----------------------------------
|
|
|
|
|
2020-01-26 17:06:46 +03:00
|
|
|
if (OPTION_INSTALL_HTML_DOCUMENTATION AND OPTION_BUILD_HTML_DOCUMENTATION)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
|
|
|
|
DESTINATION ${FLTK_DATADIR}/doc/fltk
|
|
|
|
)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-01-26 17:06:46 +03:00
|
|
|
endif (OPTION_INSTALL_HTML_DOCUMENTATION AND OPTION_BUILD_HTML_DOCUMENTATION)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-01-26 17:06:46 +03:00
|
|
|
if (OPTION_INSTALL_PDF_DOCUMENTATION AND OPTION_BUILD_PDF_DOCUMENTATION)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/fltk.pdf
|
|
|
|
DESTINATION ${FLTK_DATADIR}/doc/fltk/
|
|
|
|
)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2020-01-26 17:06:46 +03:00
|
|
|
endif (OPTION_INSTALL_PDF_DOCUMENTATION AND OPTION_BUILD_PDF_DOCUMENTATION)
|