diff --git a/documentation/CMakeLists.txt b/documentation/CMakeLists.txt index c240531e5..acbdc6aeb 100644 --- a/documentation/CMakeLists.txt +++ b/documentation/CMakeLists.txt @@ -36,13 +36,13 @@ if (OPTION_BUILD_HTML_DOCUMENTATION) set (GENERATE_LATEX NO) set (LATEX_HEADER "") - configure_file( + configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY ) - configure_file( + configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/src/tiny.png ${CMAKE_CURRENT_BINARY_DIR}/html/tiny.png COPYONLY @@ -51,7 +51,6 @@ if (OPTION_BUILD_HTML_DOCUMENTATION) # 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 @@ -73,28 +72,31 @@ if (OPTION_BUILD_PDF_DOCUMENTATION) set (GENERATE_LATEX YES) set (LATEX_HEADER "${CMAKE_CURRENT_BINARY_DIR}/fltk-book.tex") - configure_file( + # strip potential " (Git-hash)" from the original version + string (REGEX REPLACE " .*$" "" DOXY_VERSION ${DOXYGEN_VERSION}) + execute_process (COMMAND date +%Y + OUTPUT_VARIABLE YEAR + ) + + configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxybook @ONLY ) - # generate LaTeX header fltk-book.tex - - 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 + configure_file ( + ${CMAKE_CURRENT_SOURCE_DIR}/src/fltk-title.tex.in + ${CMAKE_CURRENT_BINARY_DIR}/fltk-title.tex @ONLY ) # generate fltk.pdf - add_custom_command( + add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fltk.pdf + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/make_header + ${CMAKE_CURRENT_BINARY_DIR}/fltk-title.tex + ${CMAKE_CURRENT_BINARY_DIR}/fltk-book.tex COMMAND ${DOXYGEN_EXECUTABLE} Doxybook COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/make_pdf COMMAND cp -f latex/refman.pdf fltk.pdf @@ -105,7 +107,6 @@ if (OPTION_BUILD_PDF_DOCUMENTATION) # add target 'pdf' add_custom_target (pdf - # ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/fltk.pdf ) @@ -117,8 +118,7 @@ endif (OPTION_BUILD_PDF_DOCUMENTATION) if (DOCS) - add_custom_target(docs - # ALL + add_custom_target (docs DEPENDS ${DOCS} ) diff --git a/documentation/Makefile b/documentation/Makefile index 5e95ad5b8..43be79ffd 100644 --- a/documentation/Makefile +++ b/documentation/Makefile @@ -66,7 +66,7 @@ dist: docs clean: $(RM) Doxyfile Doxybook - $(RM) fltk.pdf refman.pdf src/fltk-book.tex + $(RM) fltk.pdf refman.pdf src/fltk-book.tex src/fltk-book.tex.in $(RMDIR) html latex $(RM) *~ *.bck *.bak *.log $(RM) $(MANPAGES) $(SRC_DOCDIR)/*.0 @@ -180,9 +180,14 @@ refman.pdf: $(HTMLFILES) Doxybook src/fltk-book.tex ./make_pdf src/fltk-book.tex: src/fltk-book.tex.in - DOXY_VERSION=`$(DOXYDOC) --version`; \ + echo "Generating $@ ..." + DOXY_VERSION=`$(DOXYDOC) --version|cut -f1 -d' '`; \ YEAR=`date +%Y`; \ sed -e"s/@YEAR@/$$YEAR/g" \ -e"s/@FLTK_VERSION@/$(FLTK_VERSION)/g" \ -e"s/@DOXY_VERSION@/$$DOXY_VERSION/g" \ < $< > $@ + +src/fltk-book.tex.in: src/fltk-title.tex.in + echo "Generating $@ ..." + ./make_header src/fltk-title.tex.in src/fltk-book.tex.in diff --git a/documentation/make_header b/documentation/make_header new file mode 100755 index 000000000..44af365dc --- /dev/null +++ b/documentation/make_header @@ -0,0 +1,58 @@ +#!/bin/sh +# +# Create a new LaTeX header file for doxygen PDF docs +# +# Note: this LaTeX file depends on Doxygen and LaTeX versions, resp. +# and needs therefore to be created with current Doxygen and LaTeX +# versions on the build system. +# +# Usage: +# +# $ sh make_header input-file output-file +# +# where 'input-file' is the pure (LaTeX) title page (template) +# and 'output-file' is the generated (LaTeX) title page (template) +# to be used by `make' or `cmake` to generate the final LaTeX page +# header (combined doxygen template + FLTK title page). +# +#======================================================================= +# This script requires a posix shell and uses the following commands: +# cat, rm and sed and (obviously) doxygen +#======================================================================= + +# input and output file names +FLTK_HEAD="$1" +DOXY_HEAD="$2" +# temp file +DOXY_TEMP="doxy-header.tex.$$" + +if test x$FLTK_HEAD = x; then + echo "usage: $0 fltk-header-file output-file" + exit 1 +fi + +if test x$DOXY_HEAD = x; then + echo "usage: $0 fltk-header-file output-file" + exit 1 +fi + +# Create the doxygen LaTeX header template and replace the LaTeX +# code between (and including) the lines containing +# - 'begin{titlepage}' and +# - 'end{titlepage}' +# with our PDF document title page (LaTeX code) and write the +# result to $DOXY_HEAD. + +doxygen -w latex $DOXY_TEMP /dev/null /dev/null + +# combine three parts of these files to the output file +# using '( ... ) > $DOXY_HEAD' to write (concatenate) +# all three parts to one file + +( sed -e'/begin{titlepage}/,$d' < $DOXY_TEMP + cat $FLTK_HEAD + sed -e'1,/end{titlepage}/d' < $DOXY_TEMP +) > $DOXY_HEAD + +# cleanup +rm -f $DOXY_TEMP diff --git a/documentation/src/fltk-book.tex.in b/documentation/src/fltk-book.tex.in deleted file mode 100644 index 880d06ead..000000000 --- a/documentation/src/fltk-book.tex.in +++ /dev/null @@ -1,161 +0,0 @@ -% Latex header for FLTK generated by doxygen 1.8.13 -\batchmode -\documentclass[twoside]{book} - -% Packages required by doxygen -\usepackage{fixltx2e} -\usepackage{calc} -\usepackage{doxygen} -\usepackage[export]{adjustbox} % also loads graphicx -\usepackage{graphicx} -\usepackage[utf8]{inputenc} -\usepackage{makeidx} -\usepackage{multicol} -\usepackage{multirow} -\PassOptionsToPackage{warn}{textcomp} -\usepackage{textcomp} -\usepackage[nointegrals]{wasysym} -\usepackage[table]{xcolor} - -% Font selection -\usepackage[T1]{fontenc} -\usepackage[scaled=.90]{helvet} -\usepackage{courier} -\usepackage{amssymb} -\usepackage{sectsty} -\renewcommand{\familydefault}{\sfdefault} -\allsectionsfont{% - \fontseries{bc}\selectfont% - \color{darkgray}% -} -\renewcommand{\DoxyLabelFont}{% - \fontseries{bc}\selectfont% - \color{darkgray}% -} -\newcommand{\+}{\discretionary{\mbox{\scriptsize$\hookleftarrow$}}{}{}} - -% Page & text layout -\usepackage{geometry} -\geometry{% - a4paper,% - top=2.5cm,% - bottom=2.5cm,% - left=2.5cm,% - right=2.5cm% -} -\tolerance=750 -\hfuzz=15pt -\hbadness=750 -\setlength{\emergencystretch}{15pt} -\setlength{\parindent}{0cm} -\setlength{\parskip}{3ex plus 2ex minus 2ex} -\makeatletter -\renewcommand{\paragraph}{% - \@startsection{paragraph}{4}{0ex}{-1.0ex}{1.0ex}{% - \normalfont\normalsize\bfseries\SS@parafont% - }% -} -\renewcommand{\subparagraph}{% - \@startsection{subparagraph}{5}{0ex}{-1.0ex}{1.0ex}{% - \normalfont\normalsize\bfseries\SS@subparafont% - }% -} -\makeatother - -% Headers & footers -\usepackage{fancyhdr} -\pagestyle{fancyplain} -\fancyhead[LE]{\fancyplain{}{\bfseries\thepage}} -\fancyhead[CE]{\fancyplain{}{}} -\fancyhead[RE]{\fancyplain{}{\bfseries\leftmark}} -\fancyhead[LO]{\fancyplain{}{\bfseries\rightmark}} -\fancyhead[CO]{\fancyplain{}{}} -\fancyhead[RO]{\fancyplain{}{\bfseries\thepage}} -\fancyfoot[LE]{\fancyplain{}{}} -\fancyfoot[CE]{\fancyplain{}{}} -\fancyfoot[RE]{\fancyplain{}{\bfseries\scriptsize Generated by Doxygen }} -\fancyfoot[LO]{\fancyplain{}{\bfseries\scriptsize Generated by Doxygen }} -\fancyfoot[CO]{\fancyplain{}{}} -\fancyfoot[RO]{\fancyplain{}{}} -\renewcommand{\footrulewidth}{0.4pt} -\renewcommand{\chaptermark}[1]{% - \markboth{#1}{}% -} -\renewcommand{\sectionmark}[1]{% - \markright{\thesection\ #1}% -} - -% Indices & bibliography -\usepackage{natbib} -\usepackage[titles]{tocloft} -\setcounter{tocdepth}{3} -\setcounter{secnumdepth}{5} -\makeindex - -% Hyperlinks (required, but should be loaded last) -\usepackage{ifpdf} -\ifpdf - \usepackage[pdftex,pagebackref=true]{hyperref} -\else - \usepackage[ps2pdf,pagebackref=true]{hyperref} -\fi -\hypersetup{% - colorlinks=true,% - linkcolor=blue,% - citecolor=blue,% - unicode% -} - -% Custom commands -\newcommand{\clearemptydoublepage}{% - \newpage{\pagestyle{empty}\cleardoublepage}% -} - -\usepackage{caption} -\captionsetup{labelsep=space,justification=centering,font={bf},singlelinecheck=off,skip=4pt,position=top} - -%===== C O N T E N T S ===== - -\begin{document} - -% Titlepage & ToC -\hypersetup{pageanchor=false, - bookmarksnumbered=true, - pdfencoding=unicode - } -\pagenumbering{alph} -\begin{titlepage} -\vspace*{5cm} -\begin{center}% -{\Huge FLTK @FLTK_VERSION@ Programming Manual}\\ -\vspace*{2cm} -\begin{DoxyImageNoCaption} - \mbox{\includegraphics[width=6cm]{FL200.png}} -\end{DoxyImageNoCaption}\\ -\vspace*{2cm} -{\Large -Revision 11 by F. Costantini, D. Gibson, M. Melcher, \\ -A. Schlosser, B. Spitzak, and M. Sweet.}\\ -\vspace*{1.5cm} -{\large Copyright 1998-@YEAR@ by Bill Spitzak and others.}\\ -\vspace*{0.75cm} -{\small -This software and manual are provided under the terms of the GNU Library General Public License.}\\ -{\small -Permission is granted to reproduce this manual or any portion for any purpose,}\\ -{\small -provided this copyright and permission notice are preserved.}\\ -\vspace*{2.5cm} -{\large Generated by Doxygen @DOXY_VERSION@}\\ -\vspace*{0.5cm} -\today{}\\ -\end{center} -\end{titlepage} -\clearemptydoublepage -\pagenumbering{roman} -\tableofcontents -\clearemptydoublepage -\pagenumbering{arabic} -\hypersetup{pageanchor=true} - -%--- Begin generated contents --- diff --git a/documentation/src/fltk-title.tex.in b/documentation/src/fltk-title.tex.in new file mode 100644 index 000000000..8a10747ea --- /dev/null +++ b/documentation/src/fltk-title.tex.in @@ -0,0 +1,33 @@ +% +% FLTK PDF documentation title page (LaTeX) +% +\begin{titlepage} +\vspace*{5cm} +\begin{center}% +{\Huge FLTK @FLTK_VERSION@ Programming Manual}\\ +\vspace*{2cm} +\begin{DoxyImageNoCaption} + \mbox{\includegraphics[width=6cm]{FL200.png}} +\end{DoxyImageNoCaption}\\ +\vspace*{2cm} +{\Large +Revision 11 by F. Costantini, D. Gibson, M. Melcher, \\ +A. Schlosser, B. Spitzak, and M. Sweet.}\\ +\vspace*{1.5cm} +{\large Copyright 1998-@YEAR@ by Bill Spitzak and others.}\\ +\vspace*{0.75cm} +{\small +This software and manual are provided under the terms of the GNU Library General Public License.}\\ +{\small +Permission is granted to reproduce this manual or any portion for any purpose,}\\ +{\small +provided this copyright and permission notice are preserved.}\\ +\vspace*{2.5cm} +{\large Generated by Doxygen @DOXY_VERSION@}\\ +\vspace*{0.5cm} +\today{}\\ +\end{center} +\end{titlepage} +% +% end of FLTK PDF documentation title page (LaTeX) +%