Skip to content

Commit

Permalink
Setting correct version in LaTeX documentation
Browse files Browse the repository at this point in the history
Due to the fact that on `tex` files it is not possible to use the normal environment replacement strategy of cmake the `@VERSION@` does not get replaced anymore.
An internal LaTeX possibility (see: https://tex.stackexchange.com/a/583976/44119) looks like to be LateX version dependent, so a Cmake-Python solution
  • Loading branch information
albert-github committed May 20, 2023
1 parent 63236f7 commit 2afc513
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doc/CMakeLists.txt
Expand Up @@ -202,9 +202,9 @@ add_custom_target(run_doxygen
add_custom_target(doxygen_pdf
COMMENT "Generating Doxygen Manual PDF."
COMMAND ${CMAKE_COMMAND} -E remove refman.tex
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc/doxygen_manual.tex .
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc/manual.sty .
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/doc/doxygen_logo.pdf .
COMMAND ${CMAKE_COMMAND} -E chdir ${PROJECT_BINARY_DIR}/latex ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/doc/doxygen_manual_latex.py "${VERSION}" "${PROJECT_BINARY_DIR}/doc/doxygen_manual.tex" "${PROJECT_BINARY_DIR}/latex/doxygen_manual.tex"
COMMAND ${PDFLATEX} -shell-escape doxygen_manual.tex
COMMAND ${MAKEINDEX} doxygen_manual.idx
COMMAND ${PDFLATEX} -shell-escape doxygen_manual.tex
Expand Down
10 changes: 10 additions & 0 deletions doc/doxygen_manual_latex.py
@@ -0,0 +1,10 @@
import sys

version = sys.argv[1]
inputFile = sys.argv[2]
outputFile = sys.argv[3]

with open(outputFile,"w") as out_file:
with open(inputFile,"r") as in_file:
for line in in_file:
out_file.write(line.replace("@VERSION@",version))

0 comments on commit 2afc513

Please sign in to comment.