diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d4377d..fbb137a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,8 +37,9 @@ jobs: python3-numpy python3-pip python3-sphinx - python3-sphinx-rtd-theme && - pip3 install myst-parser linkify-it-py + python3-sphinx-rtd-theme + python3-myst-parser && + pip3 install linkify-it-py - name: Install homebrew dependencies if: matrix.os == 'macos-14' diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 348a081..646dd6f 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -24,13 +24,13 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in ${CMAKE_CURRENT_BINARY_DIR # --------------------------------- find_package(Sphinx REQUIRED) -MESSAGE(STATUS "SPHINX_EXECUTABLE = ${SPHINX_EXECUTABLE}") +MESSAGE(STATUS "SPHINXBUILD_EXECUTABLE = ${SPHINXBUILD_EXECUTABLE}") # Sphinx has internal caching, always run it add_custom_target(${PROJECT_NAME}_docs_sphinx ALL) add_custom_command( TARGET ${PROJECT_NAME}_docs_sphinx - COMMAND PYTHONPATH=${PROJECT_BINARY_DIR}/python:${h5_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SPHINX_EXECUTABLE} -c . -j8 -b html ${CMAKE_CURRENT_SOURCE_DIR} html + COMMAND PYTHONPATH=${PROJECT_BINARY_DIR}/python:${h5_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SPHINXBUILD_EXECUTABLE} -c . -j8 -b html ${CMAKE_CURRENT_SOURCE_DIR} html ) #option(Sphinx_Only "When building the documentation, skip the Python Modules and the generation of C++ Api and example outputs" OFF) diff --git a/share/cmake/Modules/FindSphinx.cmake b/share/cmake/Modules/FindSphinx.cmake new file mode 100644 index 0000000..6901b85 --- /dev/null +++ b/share/cmake/Modules/FindSphinx.cmake @@ -0,0 +1,37 @@ +# Copyright Olivier Parcollet 2017. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# This module looks for sphinx documentation tool +# and define a function that prepares the Makefile for sphinx-build + +find_program(SPHINXBUILD_EXECUTABLE + NAMES sphinx-build + PATHS /usr/bin /opt/local/bin /usr/local/bin #opt/sphinx-doc/bin + PATH_SUFFIXES bin + ) + +if (NOT SPHINXBUILD_EXECUTABLE) + message(FATAL_ERROR "I cannot find sphinx to build the triqs documentation") +endif() + +execute_process( + COMMAND "${SPHINXBUILD_EXECUTABLE}" --version + OUTPUT_VARIABLE SPHINXBUILD_VERSION + ERROR_VARIABLE SPHINXBUILD_VERSION + ) +if (SPHINXBUILD_VERSION MATCHES "[Ss]phinx.* ([0-9]+\\.[0-9]+(\\.|b)[0-9]+)") + set (SPHINXBUILD_VERSION "${CMAKE_MATCH_1}") +endif() + +if (SPHINXBUILD_VERSION VERSION_EQUAL 1.6.3) + message(FATAL_ERROR "sphinx-build found at ${SPHINXBUILD_EXECUTABLE} but version 1.6.3 has a bug. Upgrade sphinx.") +else() + message(STATUS "sphinx-build program found at ${SPHINXBUILD_EXECUTABLE} with version ${SPHINXBUILD_VERSION}") +endif () + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sphinx DEFAULT_MSG SPHINXBUILD_EXECUTABLE) + +mark_as_advanced( SPHINXBUILD_EXECUTABLE )