Skip to content

Commit

Permalink
Add documentation to the cmake build system
Browse files Browse the repository at this point in the history
  • Loading branch information
gassmoeller authored and tukss committed Jun 22, 2024
1 parent b191061 commit ff320cf
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ find_package(LAPACK COMPONENTS Fortran REQUIRED)
find_package(FFTW REQUIRED)

add_subdirectory(src)

add_subdirectory(doc)
2 changes: 1 addition & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
# 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 = ['_build', 'doc/build', '**.ipynb_checkpoints']
exclude_patterns = ['_build', '**doc/build', '**.ipynb_checkpoints']
nbsphinx_allow_errors = True
nbsphinx_execute = 'never'

Expand Down
76 changes: 76 additions & 0 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#
# Copyright (C) 2024 by the authors of the RAYLEIGH code.
#
# This file is part of RAYLEIGH.
#
# RAYLEIGH is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# RAYLEIGH 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with RAYLEIGH; see the file LICENSE. If not see
# <http://www.gnu.org/licenses/>.


CMAKE_MINIMUM_REQUIRED(VERSION 3.13.4)

####################################################
# Generate the manual
####################################################

# Find the documentation sources
file(GLOB_RECURSE SOURCES
source/*)

# Build HTML target
message(STATUS "===== Configuring documentation ===============")
message(STATUS "")

ADD_CUSTOM_COMMAND(
OUTPUT
${PROJECT_BINARY_DIR}/doc/build/html/index.html
COMMAND
sphinx-build -M html ${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR}/doc/build
DEPENDS
${SOURCES}
COMMENT
"Generating the html documentation."
)

ADD_CUSTOM_TARGET(doc_html
DEPENDS
${PROJECT_BINARY_DIR}/doc/build/html/index.html
)

# Build pdf target
ADD_CUSTOM_COMMAND(
OUTPUT
${PROJECT_BINARY_DIR}/doc/build/latex/rayleigh.pdf
COMMAND
sphinx-build -M latexpdf ${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR}/doc/build
DEPENDS
${SOURCES}
COMMENT
"Generating the latexpdf documentation."
)

ADD_CUSTOM_TARGET(doc_pdf
DEPENDS
${PROJECT_BINARY_DIR}/doc/build/latex/rayleigh.pdf
)

################################################################
# The final target: Build it all
################################################################
message(STATUS "Setting up build information")
ADD_CUSTOM_TARGET(doc
DEPENDS
doc_html
doc_pdf
)

0 comments on commit ff320cf

Please sign in to comment.