2015-04-26 00:42:51 +03:00
|
|
|
#
|
|
|
|
# CMakeLists.txt to build docs for the FLTK project using CMake (www.cmake.org)
|
|
|
|
#
|
2024-08-12 20:58:32 +03:00
|
|
|
# Copyright 1998-2024 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
|
|
|
#
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(DOCS)
|
|
|
|
set(GENERATE_DOCS FALSE)
|
|
|
|
set(YEAR "")
|
|
|
|
set(CURRENT_DATE "")
|
|
|
|
|
|
|
|
if(FLTK_BUILD_HTML_DOCS OR FLTK_BUILD_PDF_DOCS)
|
|
|
|
set(GENERATE_DOCS TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(FLTK_INCLUDE_DRIVER_DOCS)
|
|
|
|
set(DRIVER_DOCS "DriverDev")
|
|
|
|
else()
|
|
|
|
set(DRIVER_DOCS "")
|
|
|
|
endif()
|
2018-12-29 22:04:38 +03:00
|
|
|
|
2022-08-10 19:51:53 +03:00
|
|
|
#------------------------------------------------
|
|
|
|
# generate files used for both HTML and PDF docs
|
|
|
|
#------------------------------------------------
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(GENERATE_DOCS)
|
2022-08-10 19:51:53 +03:00
|
|
|
|
|
|
|
# create required variables
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
execute_process(COMMAND date "+%Y"
|
2022-08-10 19:51:53 +03:00
|
|
|
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
|
2024-02-07 20:30:11 +03:00
|
|
|
execute_process(COMMAND date "+%b %d, %Y"
|
2022-08-10 19:51:53 +03:00
|
|
|
OUTPUT_VARIABLE CURRENT_DATE
|
2023-08-30 18:24:39 +03:00
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
2022-08-10 19:51:53 +03:00
|
|
|
)
|
|
|
|
|
2023-09-07 19:28:55 +03:00
|
|
|
# Find "short" doxygen version if it was built from Git
|
2024-08-12 20:58:32 +03:00
|
|
|
# Note: this is still needed in CMake 3.15 but later CMake versions
|
2023-09-07 19:28:55 +03:00
|
|
|
# (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
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(DOXYGEN_FOUND)
|
2022-10-03 11:49:43 +03:00
|
|
|
# strip trailing git revision if doxygen was built from source
|
2024-02-07 20:30:11 +03:00
|
|
|
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)
|
2024-02-07 20:30:11 +03:00
|
|
|
configure_file(
|
2022-08-10 19:51:53 +03:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/copyright.dox.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/copyright.dox
|
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
|
|
|
|
# configure generated.dox (includes date and versions)
|
2024-02-07 20:30:11 +03:00
|
|
|
configure_file(
|
2022-08-10 19:51:53 +03:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/generated.dox.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/generated.dox
|
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(0) # debug
|
|
|
|
fl_debug_var(YEAR)
|
|
|
|
fl_debug_var(CURRENT_DATE)
|
2024-08-12 20:58:32 +03:00
|
|
|
fl_debug_var(FLTK_GIT_REVISION)
|
2024-02-07 20:30:11 +03:00
|
|
|
fl_debug_var(DOXYGEN_FOUND)
|
|
|
|
fl_debug_var(DOXYGEN_EXECUTABLE)
|
|
|
|
fl_debug_var(DOXYGEN_VERSION)
|
|
|
|
fl_debug_var(DOXYGEN_VERSION_SHORT)
|
|
|
|
endif()
|
2022-10-03 11:49:43 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(GENERATE_DOCS)
|
2022-08-10 19:51:53 +03:00
|
|
|
|
2015-04-26 00:42:51 +03:00
|
|
|
#--------------------------
|
|
|
|
# build html documentation
|
|
|
|
#--------------------------
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_BUILD_HTML_DOCS)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2024-02-07 20:30:11 +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
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(GENERATE_HTML YES)
|
|
|
|
set(GENERATE_LATEX NO)
|
|
|
|
set(LATEX_HEADER "")
|
|
|
|
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)
|
|
|
|
|
2024-02-07 20:30:11 +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
|
|
|
|
2024-02-07 20:30:11 +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
|
|
|
|
2024-02-07 20:30:11 +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
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(FLTK_BUILD_HTML_DOCS)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
|
|
|
#--------------------------
|
|
|
|
# build pdf documentation
|
|
|
|
#--------------------------
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_BUILD_PDF_DOCS)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2024-02-07 20:30:11 +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
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(GENERATE_HTML NO)
|
|
|
|
set(GENERATE_LATEX YES)
|
|
|
|
set(LATEX_HEADER "${CMAKE_CURRENT_BINARY_DIR}/fltk-book.tex")
|
|
|
|
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)
|
|
|
|
|
2024-02-07 20:30:11 +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
|
|
|
|
|
2024-10-17 17:01:32 +03:00
|
|
|
# set DOXY_VERSION for compatibility with configure/make,
|
|
|
|
# to be replaced in fltk-title.tex.in
|
|
|
|
# FIXME: this can be simplified when configure/make is no longer supported
|
|
|
|
|
|
|
|
set(DOXY_VERSION "${DOXYGEN_VERSION_SHORT}") #
|
|
|
|
|
2024-02-07 20:30:11 +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
|
2021-09-21 21:28:02 +03:00
|
|
|
)
|
|
|
|
|
2021-02-15 21:45:20 +03:00
|
|
|
# generate LaTeX title fltk-title.tex
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
configure_file(
|
2020-09-20 15:44:14 +03:00
|
|
|
${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
|
|
|
|
2024-02-07 20:30:11 +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
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
add_custom_target(pdf
|
2020-06-13 16:19:27 +03:00
|
|
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/fltk.pdf
|
|
|
|
)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(FLTK_BUILD_PDF_DOCS)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
|
|
|
#----------------------------------
|
|
|
|
# add target 'docs' for all docs
|
|
|
|
#----------------------------------
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(DOCS)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
add_custom_target(docs
|
2020-06-13 16:19:27 +03:00
|
|
|
DEPENDS ${DOCS}
|
|
|
|
)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(DOCS)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
|
|
|
#----------------------------------
|
|
|
|
# install html + pdf documentation
|
|
|
|
#----------------------------------
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_INSTALL_HTML_DOCS AND FLTK_BUILD_HTML_DOCS)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
|
2020-06-13 16:19:27 +03:00
|
|
|
DESTINATION ${FLTK_DATADIR}/doc/fltk
|
|
|
|
)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(FLTK_INSTALL_HTML_DOCS AND FLTK_BUILD_HTML_DOCS)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_INSTALL_PDF_DOCS AND FLTK_BUILD_PDF_DOCS)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/fltk.pdf
|
2020-06-13 16:19:27 +03:00
|
|
|
DESTINATION ${FLTK_DATADIR}/doc/fltk/
|
|
|
|
)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(FLTK_INSTALL_PDF_DOCS AND FLTK_BUILD_PDF_DOCS)
|