Skip to content

Commit

Permalink
Fix dependencies when creating latex document
Browse files Browse the repository at this point in the history
  • Loading branch information
renn0xtek9 committed May 8, 2024
1 parent 8651be3 commit d973e6e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 57 deletions.
62 changes: 12 additions & 50 deletions cmake_modules/CreateLatexDocument.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,64 +18,26 @@ MACRO (CreateLatexDocument _name _texsrc _resources _bibliography)
ADD_CUSTOM_TARGET (
${_name}
DEPENDS ${_output_folder}/${_name}.pdf
SOURCES ${_texsrcs})
SOURCES ${_texsrc})

ADD_CUSTOM_COMMAND (
OUTPUT ${_output_folder}/${_name}.bcf ${_output_folder}/${_name}.idx
${_output_folder}/${_name}.nlo
OUTPUT ${_output_folder}/${_name}.pdf
DEPENDS ${_texsrc} ${_resources} ${_bibliography}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${_texsrcs} ${_resources}
# COMMAND cmake -E copy ${_resources} ${_output_folder}
COMMAND cmake -E copy ${_texsrc} ${_output_folder}
COMMENT "Generating ${_name}"
VERBATIM
COMMAND ${PDFLATEX} -output-directory ${_output_folder}
${CMAKE_CURRENT_SOURCE_DIR}/${_name}.tex
COMMENT "First pass software internal documentation")

# Runnig biber on the .blg created by the firs pass of pdflatex
ADD_CUSTOM_COMMAND (
OUTPUT ${_output_folder}/${_name}.blg
COMMENT "Running ${BIBER} on ${_output_folder}/${_name}.bcf"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${BIBER} --input-directory ${_output_folder} --output-directory
${_output_folder} ${_name}.bcf
DEPENDS ${_output_folder}/${_name}.bcf ${_bibliography})

# Running the make_index
SET (
_index_output
"${CMAKE_CURRENT_BINARY_DIR}/${_name}.ilg ${_output_folder}/${_name}.ind")
ADD_CUSTOM_COMMAND (
OUTPUT ${_index_output}
DEPENDS ${_output_folder}/${_name}.idx
COMMENT "Runnning ${MAKEINDEX} on ${_output_folder}/${_name}.idx"
WORKING_DIRECTORY ${_output_folder}
COMMAND ${MAKEINDEX} ${_name}.idx)

# Running make_index for glossary and acronyms
SET (
_glossary_output
"${_output_folder}/${_name}.nls ${_output_folder}/${_name}.ilg ${_output_folder}/${_name}.gls ${_output_folder}/${_name}.glo ${_output_folder}/${_name}.acr ${_output_folder}/${_name}.acn"
)
ADD_CUSTOM_COMMAND (
OUTPUT ${_glossary_output}
DEPENDS ${_output_folder}/${_name}.nlo
WORKING_DIRECTORY ${_output_folder}
COMMAND ${MAKEINDEX} ${_name}.nlo -s nomencl.ist -o ${_name}.nls
COMMAND ${MAKEINDEX} -s ${_name}.ist -t ${_name}.glg -o ${_name}.gls
${_name}.glo
COMMAND ${MAKEINDEX} -s ${_name}.ist -t ${_name}.alg -o ${_name}.acr
${_name}.acn)

# The final pass
ADD_CUSTOM_COMMAND (
OUTPUT ${_output_folder}/${_name}.pdf
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${_output_folder}/${_name}.blg ${_index_output} ${_glossary_output}
# COMMAND cmake -E copy ${_resources} ${_output_folder}
VERBATIM
COMMAND cd ${_output_folder} && ${MAKEINDEX} ${_name}.idx
COMMAND cd ${_output_folder} && ${MAKEINDEX} ${_name}.nlo -s nomencl.ist -o
${_name}.nls
COMMAND cd ${_output_folder} && ${MAKEINDEX} -s ${_name}.ist -t ${_name}.glg
-o ${_name}.gls ${_name}.glo
COMMAND cd ${_output_folder} && ${MAKEINDEX} -s ${_name}.ist -t ${_name}.alg
-o ${_name}.acr ${_name}.acn
COMMAND ${PDFLATEX} -output-directory ${_output_folder}
${_output_folder}/${_name}.tex
COMMENT "Building software internal documentation")
${CMAKE_CURRENT_SOURCE_DIR}/${_name}.tex)

ENDMACRO ()
10 changes: 5 additions & 5 deletions documentation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ CREATELATEXDOCUMENT (
SET (DOCUMENTATION_OUTPUT_FOLDER "${CMAKE_CURRENT_BINARY_DIR}")
SET (ENV{DOCUMENTATION_OUTPUT_FOLDER} ${DOCUMENTATION_OUTPUT_FOLDER})
ADD_CUSTOM_COMMAND (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/code-documentation/html/index.html
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/code-documentation.doxygen
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/code_documentation/html/index.html
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/code_documentation.doxygen
VERBATIM
COMMAND doxygen ${CMAKE_CURRENT_SOURCE_DIR}/code-documentation.doxygen
COMMAND doxygen ${CMAKE_CURRENT_SOURCE_DIR}/code_documentation.doxygen
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Building code documentation")
ADD_CUSTOM_TARGET (
code_documentation
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/code-documentation.doxygen
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/code_documentation.doxygen
COMMENT "Target code documentation"
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/code-documentation/html/index.html)
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/code_documentation/html/index.html)
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ PROJECT_LOGO = documentation/resources/project_or_company_logo.png
<!-- PROJECT_VERSION = 1.0 -->

# Set the output directory for the generated documentation
OUTPUT_DIRECTORY = $(DOCUMENTATION_OUTPUT_FOLDER)/code-documentation/
OUTPUT_DIRECTORY = $(DOCUMENTATION_OUTPUT_FOLDER)/code_documentation/
CREATE_SUBDIRS = YES

# Set the input directories for the source code
Expand Down
2 changes: 1 addition & 1 deletion documentation/requirements_document.tex
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ \section{The first section}
\label{reference}
\end{figure}

The first equation is referenced as \ref{eq:eqFirstequation}
The first equation is referenced as \ref{eq:eqFirstequation}.
\begin{equation}
S~=~\Pi R^2
\label{eq:eqFirstequation}
Expand Down

0 comments on commit d973e6e

Please sign in to comment.