diff --git a/CMakeLists.txt b/CMakeLists.txt index e66b50be..bfa92365 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,3 +66,5 @@ find_package(LAPACK COMPONENTS Fortran REQUIRED) find_package(FFTW REQUIRED) add_subdirectory(src) + +add_subdirectory(doc) diff --git a/conf.py b/conf.py index 46753e44..7646d970 100644 --- a/conf.py +++ b/conf.py @@ -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' diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 00000000..b19a6e41 --- /dev/null +++ b/doc/CMakeLists.txt @@ -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 +# . + + +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 +)