Skip to content
Snippets Groups Projects
Commit 536eb40a authored by Daniel Vonk's avatar Daniel Vonk Committed by Daniel Vonk
Browse files

Build scripts for sphinx

parent f48cfbeb
No related branches found
No related tags found
2 merge requests!19Merge develop into main,!13Add CI System to Sassena and Modernize Build-System
......@@ -29,7 +29,78 @@ set(DOXYGEN_DOT_TRANSPARENT YES)
set(DOXYGEN_GENERATE_HTML YES)
set(DOXYGEN_GENERATE_MAN NO)
set(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doxygen)
set(MIXED_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mixedout)
set(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(SPHINX_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/sphinx)
doxygen_add_docs(
sass-doxygen-docs ${PROJECT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generates doxygen documentation"
)
find_program(
SPHINX_EXECUTABLE
NAMES sphinx-build
DOC "Path to sphinx-build executable"
)
if(NOT SPHINX_EXECUTABLE)
message(FATAL_ERROR "SASS_BUILD_DOCS or BUILD_DOCS was requested but Sphinx could not be found. "
"Install sphinx and its modules, or re-run CMake with doc building disabled.")
endif()
# Install doxysphinx, used to convert Doxygen's output to markdown
find_program(DOXYSPHINX_EXECUTABLE doxysphinx)
if(NOT DOXYSPHINX_EXECUTABLE)
message(
FATAL_ERROR
"\ndoxysphinx (a Doxygen HTML to reStructureText converter) could not be found. "
"This tool is required to build the API documentation. Consider installing it by "
"following the directions at https://boschglobal.github.io/doxysphinx/docs/getting_started.html."
)
endif()
file(GLOB _sphinx_sources *.rst)
# add_custom_command(
# OUTPUT docs-sphinx
# COMMAND ${SPHINX_EXECUTABLE} -b html -d _build/doctrees . _build/html
# COMMENT "Building HTML documentation with Sphinx"
# )
file(GLOB _top_level_rst_and_md_files *.md *.rst)
add_custom_command(
OUTPUT docs-sass-doxysphinx
# Copy Sphinx sources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/sphinx ${MIXED_OUTPUT_DIRECTORY}/sphinx/docs
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_top_level_rst_and_md_files} ${MIXED_OUTPUT_DIRECTORY}/sphinx/docs
# Copy Doxygen sources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${DOXYGEN_OUTPUT_DIRECTORY} ${MIXED_OUTPUT_DIRECTORY}/sphinx/docs/doxygen
# Run doxysphinx to convert Doxygen output into Sphinx compatible output.
COMMAND ${DOC_PYTHON_ENV} ${DOXYSPHINX_EXECUTABLE} build ${MIXED_OUTPUT_DIRECTORY}/sphinx/docs
${SPHINX_OUTPUT_DIRECTORY} ${MIXED_OUTPUT_DIRECTORY}/sphinx/docs/doxygen/html
# Call to run Doxygen prior to this block
DEPENDS sass-doxygen-docs
WORKING_DIRECTORY ${DOXYGEN_OUTPUT_DIRECTORY}
COMMENT "Preparing Sphinx and Doxygen files for merging"
)
# Build Sphinx documentation
add_custom_command(
OUTPUT docs-sass-sphinx
COMMAND ${DOC_PYTHON_ENV} ${Python3_EXECUTABLE} ${SPHINX_EXECUTABLE} -b html ${MIXED_OUTPUT_DIRECTORY}/sphinx/docs
${SPHINX_OUTPUT_DIRECTORY} -c ${CMAKE_CURRENT_LIST_DIR}/sphinx -Wj auto
WORKING_DIRECTORY ${MIXED_OUTPUT_DIRECTORY}/sphinx/docs
DEPENDS docs-sass-doxysphinx
MAIN_DEPENDENCY ${CMAKE_CURRENT_LIST_DIR}/sphinx/conf.py
COMMENT "Generating documentation with Sphinx"
)
# Auto start generating documentation as part of ALL
add_custom_target(
docs-sass ALL
DEPENDS docs-sass-sphinx
COMMENT "Starting to generate Sphinx documentation."
)
Sassena
======
*Sassena* docs generated by sphinx
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment