Skip to content

Commit

Permalink
Doc compilation ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
parcollet committed Feb 12, 2024
1 parent a886e75 commit 0649b31
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
37 changes: 37 additions & 0 deletions share/cmake/Modules/FindSphinx.cmake
Original file line number Diff line number Diff line change
@@ -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 )

0 comments on commit 0649b31

Please sign in to comment.