Commit 722fb0f4 authored by jannick.wolters's avatar jannick.wolters
Browse files

added first test version of sphinx doc


Former-commit-id: 82fddb9d
parent ec87706a
cmake_minimum_required( VERSION 3.12.4 )
project( KiT-RT VERSION 0.1.0 LANGUAGES CXX )
project( KiT-RT VERSION 0.0.2 LANGUAGES CXX )
### OPTIONS #####################################
option( build_tests "enables compiling of unit_tests" OFF )
option( build_doc "builds Doxygen and Sphinx documentation" OFF )
#################################################
### COMPILER ####################################
......@@ -81,26 +86,64 @@ target_compile_options( ${CMAKE_PROJECT_NAME} PUBLIC "$<$<CONFIG:RELEASE>:${KITR
### BUILD UNIT TESTS ############################
include( CTest )
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/ext/Catch2/contrib ${CMAKE_MODULE_PATH} )
include( Catch )
set( CATCH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/ext/Catch2/single_include/catch2 )
add_compile_definitions( BUILD_TESTING )
add_compile_definitions( TESTS_PATH="${CMAKE_SOURCE_DIR}/tests/" )
add_library( Catch INTERFACE )
target_include_directories( Catch INTERFACE ${CATCH_INCLUDE_DIR} )
file( GLOB_RECURSE TEST_SRCS RELATIVE ${CMAKE_SOURCE_DIR} "tests/*.cpp" )
list( REMOVE_ITEM SRCS "src/main.cpp" )
add_executable( unit_tests ${TEST_SRCS} ${SRCS} ${EXT_SRCS} )
target_link_libraries( unit_tests Catch ${CORE_LIBRARIES} )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:DEBUG>:${KITRT_DEBUG_OPTIONS}>" )
if( CMAKE_COMPILER_IS_GNUCXX )
if( build_tests )
include( CTest )
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/ext/Catch2/contrib ${CMAKE_MODULE_PATH} )
include( Catch )
set( CATCH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/ext/Catch2/single_include/catch2 )
add_compile_definitions( BUILD_TESTING )
add_compile_definitions( TESTS_PATH="${CMAKE_SOURCE_DIR}/tests/" )
add_library( Catch INTERFACE )
target_include_directories( Catch INTERFACE ${CATCH_INCLUDE_DIR} )
file( GLOB_RECURSE TEST_SRCS RELATIVE ${CMAKE_SOURCE_DIR} "tests/*.cpp" )
list( REMOVE_ITEM SRCS "src/main.cpp" )
add_executable( unit_tests ${TEST_SRCS} ${SRCS} ${EXT_SRCS} )
target_link_libraries( unit_tests Catch ${CORE_LIBRARIES} )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:DEBUG>:${KITRT_DEBUG_OPTIONS}>" )
if( CMAKE_COMPILER_IS_GNUCXX )
set( CODE_COVERAGE_OPTIONS --coverage -g -O0 -w )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:DEBUG>:${CODE_COVERAGE_OPTIONS}>" )
target_link_libraries( unit_tests Catch gcov )
endif()
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:RELWITHDEBINFO>:${KITRT_RELWITHDEBINFO_OPTIONS}>" )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:RELEASE>:${KITRT_RELEASE_OPTIONS}>" )
catch_discover_tests( unit_tests )
endif()
#################################################
### BUILD DOCUMENTATION #########################
if( build_doc )
find_package( Doxygen REQUIRED )
find_package( Sphinx REQUIRED )
file( GLOB_RECURSE DOC_HEADER RELATIVE ${CMAKE_SOURCE_DIR} "include/*.h" )
set( DOXYGEN_INPUT_DIR ${PROJECT_SOURCE_DIR} )
set( DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/docs/doxygen )
set( DOXYGEN_INDEX_FILE ${DOXYGEN_OUTPUT_DIR}/html/index.html )
set( DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/../doc/Doxyfile.in )
set( DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile )
configure_file( ${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY )
file( MAKE_DIRECTORY ${DOXYGEN_OUTPUT_DIR} )
add_custom_command( OUTPUT ${DOXYGEN_INDEX_FILE}
DEPENDS ${DOC_HEADER}
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT}
MAIN_DEPENDENCY ${DOXYFILE_OUT} ${DOXYFILE_IN}
COMMENT "Generating documentaion with Doxygen"
VERBATIM )
add_custom_target( Doxygen ALL DEPENDS ${DOXYGEN_INDEX_FILE} )
set( SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../doc )
set( SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/docs/sphinx )
set( SPHINX_INDEX_FILE ${SPHINX_BUILD}/index.html )
add_custom_command( OUTPUT ${SPHINX_INDEX_FILE}
COMMAND ${SPHINX_EXECUTABLE} -b html -Dbreathe_projects.CatCutifier=${DOXYGEN_OUTPUT_DIR}/xml ${SPHINX_SOURCE} ${SPHINX_BUILD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../doc/index.rst ${DOXYGEN_INDEX_FILE}
MAIN_DEPENDENCY ${SPHINX_SOURCE}/conf.py
COMMENT "Converting documentation from Doxygen to Sphinx" )
add_custom_target( Sphinx ALL DEPENDS ${SPHINX_INDEX_FILE} )
endif()
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:RELWITHDEBINFO>:${KITRT_RELWITHDEBINFO_OPTIONS}>" )
target_compile_options( unit_tests PUBLIC "$<$<CONFIG:RELEASE>:${KITRT_RELEASE_OPTIONS}>" )
catch_discover_tests( unit_tests )
enable_testing()
#################################################
find_program( SPHINX_EXECUTABLE
NAMES sphinx-build
DOC "Path to sphinx-build executable" )
include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( Sphinx
"Failed to find sphinx-build executable"
SPHINX_EXECUTABLE )
This diff is collapsed.
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'KiT-RT'
copyright = '2020, TBD'
author = 'TBD'
# The full version, including alpha/beta/rc tags
release = '0.1'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'breathe',
'sphinx_rtd_theme'
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The master toctree document.
master_doc = 'index'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
breathe_projects = {
"KiT-RT": "../code/build/debug/docs/doxygen/xml/",
}
breathe_default_project = "KiT-RT"
.. KiT-RT documentation master file, created by
sphinx-quickstart on Mon Nov 30 16:55:47 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to KiT-RT's documentation!
==================================
.. toctree::
:maxdepth: 2
:caption: Contents:
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Docs
====
.. doxygenclass:: Mesh
:members:
......@@ -28,6 +28,7 @@ RUN apt-get update \
libxinerama-dev \
python3 \
python3-pip \
doxygen \
&& apt-get clean \
&& apt-get autoremove --purge \
&& rm -rf /var/lib/apt/lists/*
......@@ -48,6 +49,6 @@ RUN wget -nc --no-check-certificate --quiet https://www.vtk.org/files/release/8.
&& cd - \
&& rm -rf VTK-*
RUN pip3 install numpy pygmsh==6.1.1 Pillow pydicom gcovr
RUN pip3 install numpy pygmsh==6.1.1 Pillow pydicom gcovr sphinx_rtd_theme breathe
WORKDIR /home
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment