Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation rework - part 2: Updates and corrections #459

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ Sound/XRSound/**/Release-with-OrbiterRelease/
[Bb]uild/

Extern/irrKlang

Doc/**/*.log
Doc/**/*.pdf
Doc/**/*.gz
76 changes: 0 additions & 76 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,88 +283,12 @@ if(ORBITER_BUILD_D3D9CLIENT)
endif()
endif()

if (ORBITER_MAKE_DOC)

find_program(ODT_TO_PDF_COMPILER
soffice
HINTS "/Program Files/LibreOffice/program"
)

set(ODT_TO_PDF_FLAGS
"--headless --convert-to pdf --outdir <outdir> <infile>"
CACHE
STRING
"Compiler options for the OdtToPdfCompiler"
)

find_program(DOC_TO_PDF_COMPILER
soffice
HINTS "/Program Files/LibreOffice/program"
)

set(DOC_TO_PDF_FLAGS
"--headless --convert-to pdf --outdir <outdir> <infile>"
CACHE
STRING
"Compiler options for the DocToPdfCompiler"
)

endif()

# Enable Address SANitizer
include(cmake/sanitizer.cmake)
if (ORBITER_SANITIZER AND MSVC)
enable_sanitizer(${ORBITER_SANITIZER})
endif()

# For a given argument string template (odt_to_pdf_arglist) and source file name (infile)
# return the explicit argument string (arglist), full source path (source_path) and full target path (target_path)
# to invoke the ODT to PDF conversion tool

function(odt_to_pdf_arglist infile arglist source_path target_path)
string(REPLACE
"<outdir>" "${CMAKE_CURRENT_BINARY_DIR}"
tmp1_string
${ODT_TO_PDF_FLAGS}
)
string(REPLACE
"<infile>" "${CMAKE_CURRENT_SOURCE_DIR}/${infile}.odt"
tmp2_string
${tmp1_string}
)
separate_arguments(odt_arg
WINDOWS_COMMAND
${tmp2_string}
)
set(${arglist} ${odt_arg} PARENT_SCOPE)
set(${source_path} "${CMAKE_CURRENT_SOURCE_DIR}/${infile}.odt" PARENT_SCOPE)
set(${target_path} "${CMAKE_CURRENT_BINARY_DIR}/${infile}.pdf" PARENT_SCOPE)
endfunction()


# For a given argument string template (odt_to_pdf_arglist) and source file name (infile)
# return the explicit argument string (arglist), full source path (source_path) and full target path (target_path)
# to invoke the DOC to PDF conversion tool

function(doc_to_pdf_arglist infile arglist source_path target_path)
string(REPLACE
"<outdir>" "${CMAKE_CURRENT_BINARY_DIR}"
tmp1_string
${DOC_TO_PDF_FLAGS}
)
string(REPLACE
"<infile>" "${CMAKE_CURRENT_SOURCE_DIR}/${infile}.doc"
tmp2_string
${tmp1_string}
)
separate_arguments(doc_arg
WINDOWS_COMMAND
${tmp2_string}
)
set(${arglist} ${doc_arg} PARENT_SCOPE)
set(${source_path} "${CMAKE_CURRENT_SOURCE_DIR}/${infile}.doc" PARENT_SCOPE)
set(${target_path} "${CMAKE_CURRENT_BINARY_DIR}/${infile}.pdf" PARENT_SCOPE)
endfunction()

# Given a source directory (srcdir) and a target root directory (tgtroot),
# generate a list of all files found in srcdir (srclist) and a list of output files
Expand Down
94 changes: 3 additions & 91 deletions Doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,91 +1,3 @@
# Orbiter.pdf ------------------------------------------------------------

odt_to_pdf_arglist("Orbiter" arglist src out)
add_custom_command(
OUTPUT ${out}
COMMAND ${ODT_TO_PDF_COMPILER} ${arglist}
DEPENDS ${src}
JOB_POOL soffice
)
add_custom_target(OrbiterDoc
DEPENDS ${out}
)
add_dependencies(${OrbiterTgt}
OrbiterDoc
)
set_target_properties(OrbiterDoc
PROPERTIES
FOLDER Doc
)
install(FILES ${out}
DESTINATION ${ORBITER_INSTALL_DOC_DIR}
)

# OrbiterConfig.pdf ------------------------------------------------------

odt_to_pdf_arglist("OrbiterConfig" arglist src out)
add_custom_command(
OUTPUT ${out}
COMMAND ${ODT_TO_PDF_COMPILER} ${arglist}
DEPENDS ${src}
JOB_POOL soffice
)
add_custom_target(OrbiterConfigDoc
DEPENDS ${out}
)
add_dependencies(${OrbiterTgt}
OrbiterConfigDoc
)
set_target_properties(OrbiterConfigDoc
PROPERTIES
FOLDER Doc
)
install(FILES ${out}
DESTINATION ${ORBITER_INSTALL_DOC_DIR}
)

# PlanetTextures.pdf -----------------------------------------------------

odt_to_pdf_arglist("PlanetTextures" arglist src out)
add_custom_command(
OUTPUT ${out}
COMMAND ${ODT_TO_PDF_COMPILER} ${arglist}
DEPENDS ${src}
JOB_POOL soffice
)
add_custom_target(PlanetTexturesDoc
DEPENDS ${out}
)
add_dependencies(${OrbiterTgt}
PlanetTexturesDoc
)
set_target_properties(PlanetTexturesDoc
PROPERTIES
FOLDER Doc
)
install(FILES ${out}
DESTINATION ${ORBITER_INSTALL_DOC_DIR}
)

# Credit.pdf -------------------------------------------------------------

doc_to_pdf_arglist("Credit" arglist src out)
add_custom_command(
OUTPUT ${out}
COMMAND ${DOC_TO_PDF_COMPILER} ${arglist}
DEPENDS ${src}
JOB_POOL soffice
)
add_custom_target(OrbiterCreditDoc
DEPENDS ${out}
)
add_dependencies(OrbiterDoc
OrbiterCreditDoc
)
install(FILES ${out}
DESTINATION ${ORBITER_INSTALL_DOC_DIR}
)

# Technotes --------------------------------------------------------------

add_subdirectory(Technotes)
add_subdirectory("Orbiter Developer Manual")
add_subdirectory("Orbiter Technical Reference")
add_subdirectory("Orbiter User Manual")
Binary file removed Doc/Credit.doc
Binary file not shown.
Binary file removed Doc/D3D9Client.pdf
Binary file not shown.
29 changes: 29 additions & 0 deletions Doc/Orbiter Developer Manual/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
set(name "Orbiter Developer Manual")

set(src_path ${CMAKE_CURRENT_SOURCE_DIR}/${name}.tex)
set(out_path ${CMAKE_CURRENT_BINARY_DIR}/${name}.pdf)
set(pdflatex_cmd ${PDFLATEX_COMPILER} --synctex=1 -output-directory=${CMAKE_CURRENT_BINARY_DIR} ${src_path})
set(bibtex_cmd ${BIBTEX_COMPILER} ${CMAKE_CURRENT_BINARY_DIR}/${name})

add_custom_command(
OUTPUT ${out_path}
COMMAND ${pdflatex_cmd}
COMMAND ${bibtex_cmd}
COMMAND ${pdflatex_cmd}
DEPENDS ${src_path}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
JOB_POOL latex
)
add_custom_target(OrbiterDeveloperManual
DEPENDS ${out_path}
)
add_dependencies(${OrbiterTgt}
OrbiterDeveloperManual
)
set_target_properties(OrbiterDeveloperManual
PROPERTIES
FOLDER Doc
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.pdf
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Doc
)
Loading
Loading