From 2af2e1d58677afccbf9e485f3d821282bb4c3671 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Wed, 23 Apr 2025 14:13:47 +0200 Subject: [PATCH] Fluid: Backport update for documentation scripts from 1.5 48e22d2, based on 678c850 --- fluid/documentation/CMakeLists.txt | 25 +++++++++++-------- fluid/documentation/{make_pdf => make_pdf.in} | 9 +++++-- fluid/documentation/src/fluid-title.tex.in | 4 +-- 3 files changed, 24 insertions(+), 14 deletions(-) rename fluid/documentation/{make_pdf => make_pdf.in} (87%) diff --git a/fluid/documentation/CMakeLists.txt b/fluid/documentation/CMakeLists.txt index fccdeac97..c906ab917 100644 --- a/fluid/documentation/CMakeLists.txt +++ b/fluid/documentation/CMakeLists.txt @@ -26,19 +26,16 @@ if(FLTK_BUILD_FLUID_DOCS OR FLTK_BUILD_PDF_DOCS) # create required variables - execute_process(COMMAND date "+%Y" - OUTPUT_VARIABLE YEAR - OUTPUT_STRIP_TRAILING_WHITESPACE - ) + string(TIMESTAMP YEAR "%Y" UTC) # note: current locale is used for abbreviated month - execute_process(COMMAND date "+%b %d, %Y" - OUTPUT_VARIABLE CURRENT_DATE - OUTPUT_STRIP_TRAILING_WHITESPACE - ) + string(TIMESTAMP CURRENT_DATE "%b %d, %Y" UTC) + string(TIMESTAMP PDF_DATE "D:%Y%m%d%H%M%SZ" UTC) + string(TIMESTAMP TODAY "%B %d, %Y" UTC) + string(REPLACE " 0" " " TODAY "${TODAY}") # Find "short" doxygen version if it was built from Git - # Note: this is still needed in CMake 3.12.0 but later CMake versions + # Note: this is still needed in CMake 3.15.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 @@ -144,6 +141,8 @@ if(FLTK_BUILD_PDF_DOCS AND FLTK_BUILD_FLUID_DOCS) # convert Doxybook to current doxygen version + set(DOXY_VERSION "${DOXYGEN_VERSION_SHORT}") # + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${DOXYFILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} @@ -164,6 +163,12 @@ if(FLTK_BUILD_PDF_DOCS AND FLTK_BUILD_FLUID_DOCS) @ONLY ) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/make_pdf.in + ${CMAKE_CURRENT_BINARY_DIR}/make_pdf + @ONLY + ) + # generate fluid.pdf add_custom_command( @@ -173,7 +178,7 @@ if(FLTK_BUILD_PDF_DOCS AND FLTK_BUILD_FLUID_DOCS) ${CMAKE_CURRENT_BINARY_DIR}/fluid-title.tex ${CMAKE_CURRENT_BINARY_DIR}/fluid-book.tex COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE} - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/make_pdf + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/make_pdf COMMAND cp -f latex/refman.pdf fluid.pdf DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${DOXYFILE} ${CMAKE_CURRENT_BINARY_DIR}/fluid-title.tex diff --git a/fluid/documentation/make_pdf b/fluid/documentation/make_pdf.in similarity index 87% rename from fluid/documentation/make_pdf rename to fluid/documentation/make_pdf.in index abc7b371d..05322111d 100755 --- a/fluid/documentation/make_pdf +++ b/fluid/documentation/make_pdf.in @@ -26,10 +26,15 @@ # # Used in: Makefile and CMakeLists.txt +run_pdflatex() { + pdflatex --interaction=nonstopmode \ + "\pdfinfo{/CreationDate(@PDF_DATE@)/ModDate(@PDF_DATE@)}\input{refman.tex}" +} + ( cd latex - pdflatex --interaction=nonstopmode refman.tex + run_pdflatex makeindex refman.idx - pdflatex --interaction=nonstopmode refman.tex + run_pdflatex latex_count=5 while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log \ && [ $latex_count -gt 0 ] diff --git a/fluid/documentation/src/fluid-title.tex.in b/fluid/documentation/src/fluid-title.tex.in index 7cd13d794..5d278d194 100644 --- a/fluid/documentation/src/fluid-title.tex.in +++ b/fluid/documentation/src/fluid-title.tex.in @@ -23,9 +23,9 @@ Permission is granted to reproduce this manual or any portion for any purpose,}\ {\small provided this copyright and permission notice are preserved.}\\ \vspace*{1.5cm} -{\large Generated by Doxygen @DOXYGEN_VERSION_SHORT@}\\ +{\large Generated by Doxygen @DOXYGEN_VERSION@}\\ \vspace*{0.5cm} -\today{}\\ +@TODAY@\\ \vspace*{0.5cm} {\small Git revision @FLTK_GIT_REVISION@}\\ \end{center}