Skip to content

Commit

Permalink
Merge pull request #1723 from kokkos/docs/cwpearson-html-only
Browse files Browse the repository at this point in the history
Allow an HTML-only docs build
  • Loading branch information
e10harvey committed Mar 14, 2023
2 parents 26332ed + 5c27022 commit afd686e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- name: Install Dependencies
run: |
sudo apt install doxygen
sudo apt install --no-install-recommends doxygen-latex
pip install sphinx
pip install breathe
pip install sphinx-rtd-theme
Expand Down
30 changes: 18 additions & 12 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Source: https://devblogs.microsoft.com/cppblog/clear-functional-c-documentation-with-sphinx-breathe-doxygen-cmake/
# Author: Evan Harvey <eharvey@sandia.gov>
find_package(Doxygen REQUIRED)
find_package(Sphinx REQUIRED)

set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR})
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/docs/sphinx)
set(KOKKOS_INCLUDE_DIR ${Kokkos_DIR}/../../../include)

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/conf.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
Expand Down Expand Up @@ -36,12 +33,21 @@ add_custom_command(OUTPUT ${DOXYGEN_INDEX_FILE}

add_custom_target(Doxygen ALL DEPENDS ${DOXYGEN_INDEX_FILE})


add_custom_target(Sphinx ALL
COMMAND ${SPHINX_EXECUTABLE} -b html
# Tell Breathe where to find the Doxygen output
-Dbreathe_projects.${PROJECT_NAME}=${DOXYGEN_OUTPUT_DIR}/xml
${SPHINX_SOURCE} ${SPHINX_BUILD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS Doxygen
COMMENT "Generating documentation with Sphinx")
## If we can find sphinx, add that target too
find_package(Sphinx)

if (Sphinx_FOUND)
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR})
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/docs/sphinx)

add_custom_target(Sphinx ALL
COMMAND ${SPHINX_EXECUTABLE} -b html
# Tell Breathe where to find the Doxygen output
-Dbreathe_projects.${PROJECT_NAME}=${DOXYGEN_OUTPUT_DIR}/xml
${SPHINX_SOURCE} ${SPHINX_BUILD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS Doxygen
COMMENT "Generating documentation with Sphinx")
else() # Sphinx_FOUND
message(STATUS "Sphinx not found. Only Doxygen docs can be built")
endif() # Sphinx_FOUND

0 comments on commit afd686e

Please sign in to comment.