diff --git a/doc/manual/CMakeLists.txt b/doc/manual/CMakeLists.txt index 5edf520f2..a169945f5 100644 --- a/doc/manual/CMakeLists.txt +++ b/doc/manual/CMakeLists.txt @@ -1,152 +1,154 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Mon Jun 09 2014 # @date last modification: Thu Jul 03 2014 # # @brief Build the documentation # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== #------------------------------------------------------------------------------# function(get_doc_label pkg_name label) string(REPLACE "_" "-" _pkg_tex_label_dash ${pkg_name}) string(TOLOWER "${_pkg_tex_label_dash}" _pkg_tex_label) set(TOLOWER "${_pkg_tex_label_dash}" _pkg_tex_label) set(${label} "pkg:${_pkg_tex_label}" PARENT_SCOPE) endfunction() function(get_doc_package_name pkg_name pkg_tex) _package_get_option_name(${pkg_name} _opt_name) string(REPLACE "_" "\\_" _pkg_tex "${_opt_name}") set(${pkg_tex} ${_pkg_tex} PARENT_SCOPE) endfunction() #------------------------------------------------------------------------------# function(generate_package_dependency_tex_doc pkg_name FILENAME LEVEL) _package_get_option_name(${pkg_name} _opt_name) string(REPLACE "_" "\\_" _pkg_tex "${_opt_name}") get_doc_label(${pkg_name} _pkg_tex_label) file(APPEND ${FILENAME} "\\AkantuPackageNameWithLabel{${_pkg_tex}}{${_pkg_tex_label}}{${LEVEL}}\\xspace") math(EXPR _sub_level "${LEVEL}+1") _package_get_dependencies(${pkg_name} _dependencies) foreach(_dep_pkg_name ${_dependencies}) generate_package_dependency_tex_doc(${_dep_pkg_name} ${FILENAME} ${_sub_level}) endforeach() endfunction() #------------------------------------------------------------------------------# function(generate_package_tex_doc pkg_name FILENAME) get_doc_package_name(${pkg_name} _pkg_tex) get_doc_label(${pkg_name} _pkg_tex_label) file(APPEND ${FILENAME} "\n\\begin{AkantuPackage}{${_pkg_tex}}{${_pkg_tex_label}}") _package_get_documentation(${pkg_name} _doc) if (_doc) file(APPEND ${FILENAME} "${_doc}") else() _package_get_filename(${pkg_name} _file_path) _package_get_real_name(${pkg_name} _pkg) get_filename_component(_file ${_file_path} NAME) string(REPLACE "_" "\\_" _escaped_pkg "${_pkg}") set(_missing_doc "{\\color{red} TODO}: No Documentation in {\\color{blue} \\href{${_file_path}}{${_file}}}" "" "looking for the sequence: " "\\begin{cmake}" "\\package_declare_documentation(" " ${_escaped_pkg}" " \"documentation text\"" " )" "\\end{cmake}") set(_missing_doc_str "") foreach(_str ${_missing_doc}) set(_missing_doc_str "${_missing_doc_str}\n${_str}") endforeach() file(APPEND ${FILENAME} "${_missing_doc_str}") endif() _package_get_dependencies(${pkg_name} _dependencies) if(_dependencies) file(APPEND ${FILENAME} "\n\\begin{AkantuPackageDependencies}") foreach(_dep_pkg_name ${_dependencies}) generate_package_dependency_tex_doc(${_dep_pkg_name} ${FILENAME} 1) endforeach() file(APPEND ${FILENAME} "\n\\end{AkantuPackageDependencies}") endif() file(APPEND ${FILENAME} "\n\\end{AkantuPackage} ") endfunction() #------------------------------------------------------------------------------# #------------------------------------------------------------------------------# set(DOC_DEPS_TEX_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/manual-packages-doc.tex") file(WRITE ${DOC_DEPS_TEX_FILENAME} "") find_program(RUBBER_EXECUTABLE rubber) if (NOT RUBBER_EXECUTABLE) message(ERROR "Manual cannot be built without rubber latex compiler") endif() mark_as_advanced(RUBBER_EXECUTABLE) package_get_all_documentation_files(_manual_files) set(AKANTU_MANUAL_FILES_DEPEND) set(AKANTU_MANUAL_FILES_COPY_COMMAND) foreach(_f ${_manual_files}) file(RELATIVE_PATH _rel_f ${CMAKE_CURRENT_SOURCE_DIR} "${_f}") list(APPEND AKANTU_MANUAL_FILES_DEPEND ${_f}) list(APPEND AKANTU_MANUAL_FILES_COPY_COMMAND COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${_rel_f} ${_rel_f}) endforeach() set(MANUAL_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/manual.pdf) add_custom_command( OUTPUT ${MANUAL_OUTPUT} DEPENDS ${AKANTU_MANUAL_FILES_DEPEND} ${DOC_DEPS_TEX_FILENAME} ${AKANTU_MANUAL_FILES_COPY_COMMAND} COMMAND ${RUBBER_EXECUTABLE} -dfq -Wall manual WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Compiling the user's manual" ) add_custom_target(manual ALL DEPENDS ${MANUAL_OUTPUT}) install(FILES ${MANUAL_OUTPUT} DESTINATION share/akantu/doc) package_get_all_activated_packages(_package_list) foreach (_pkg_name ${_package_list}) generate_package_tex_doc(${_pkg_name} ${DOC_DEPS_TEX_FILENAME}) endforeach() + +configure_file(version-definition.tex.in "${CMAKE_CURRENT_BINARY_DIR}/version-definition.tex" @ONLY) \ No newline at end of file diff --git a/doc/manual/manual.tex b/doc/manual/manual.tex index d4e9562e6..b27df2847 100644 --- a/doc/manual/manual.tex +++ b/doc/manual/manual.tex @@ -1,48 +1,52 @@ \documentclass[openright,a4paper,11pt,fleqn]{manual} \usepackage{manual} \usepackage{manual-macros} -\newcommand{\version}{} +\IfFileExists{version-definition.tex}{ + \input{version-definition} +}{ + \newcommand{\version}{2.2} +} \graphicspath{ {./figures/} } %%% For references \todo check the coherency %% section 3.5 -> Section 3.5 %% figure 3.5 -> Figure 3.5 %% equation 3.5 -> Equation (3.5) % Title pages and Table of Contents (includes \begin{document}) \input{manual-titlepages} % Introduction chapter \input{manual-introduction} % The planning to write the documentation %\input{manual-planning} % The documentation chapter (split in parts) \input{manual-gettingstarted} \input{manual-elements} %\IfFileExists{manual-lumping.tex}{}{\input{manual-lumping}} \input{manual-solidmechanicsmodel} \IfFileExists{manual-structuralmechanicsmodel.tex}{\input{manual-structuralmechanicsmodel}}{} \IfFileExists{manual-heattransfermodel.tex}{\input{manual-heattransfermodel}}{} \input{manual-io} \IfFileExists{manual-parallel.tex}{\input{manual-parallel}}{} \IfFileExists{manual-contact.tex}{\input{manual-contact}}{} % The appendices \appendix \input{manual-appendix-elements} \input{manual-appendix-materials} \input{manual-appendix-packages} % The backmatter material (index/bibliography, included \end{document}) \input{manual-backmatter}