Skip to content

Commit

Permalink
Initial doxygen setup
Browse files Browse the repository at this point in the history
Documentation

Organize, setup versioned docs

Deploy docs to Github pages

Update doxygen header

Use Doxygen 1.12.0 for github pages builds

Improved Process Recovery docs writeup

'make doc' -> 'make docs'
  • Loading branch information
Matthew-Whitlock committed Nov 22, 2024
1 parent f5447ef commit e0ce1f8
Show file tree
Hide file tree
Showing 18 changed files with 1,414 additions and 50 deletions.
54 changes: 54 additions & 0 deletions .github/scripts/build-gh-pages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash


set -e

echo "Installing apt packages"
sudo apt-get update >/dev/null
sudo apt-get install -y wget git cmake graphviz >/dev/null

echo "Installing Doxygen"
wget https://www.doxygen.nl/files/doxygen-1.12.0.linux.bin.tar.gz >/dev/null
tar -xzf doxygen-1.12.0.linux.bin.tar.gz >/dev/null
export PATH="$PWD/doxygen-1.12.0/bin:$PATH"

#List of branches to build docs for
#TODO: Remove doxygen branch once tested
BRANCHES="doxygen master develop"

build-docs() (
git checkout $1

#The CMake Doxygen stuff is weird, and doesn't
#properly clean up and/or overwrite old outputs.
#So to make sure we get the correct doc configs,
#we need to delete everything
#We put the docs themselves into a hidden directory
#so they don't get included in this glob
rm -rf ./*

cmake ../ -DBUILD_DOCS=ON -DDOCS_ONLY=ON \
-DFENIX_DOCS_MAN=OFF -DFENIX_BRANCH=$1 \
-DFENIX_DOCS_OUTPUT=$PWD/.docs
make docs
)

git clone https://www.github.com/sandialabs/Fenix.git
mkdir Fenix/build
cd Fenix/build

for branch in $BRANCHES; do
echo "Building docs for $branch"

#TODO: Fail if any branch fails to build,
# once the develop and master branches have doxygen
# merged in
build-docs $branch || true

echo
echo
done

if [ -n "$GITHUB_ENV" ]; then
echo "DOCS_DIR=$PWD/.docs" >> $GITHUB_ENV
fi
40 changes: 40 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish GH Pages

on:
push:
branches:
- master
- develop
- doxygen # TODO: Remove after testing

#Only one of this workflow runs at a time
concurrency:
group: docs
cancel-in-progress: true

jobs:
build-pages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build pages
run: /bin/bash .github/scripts/build-gh-pages.sh

- name: Upload documentation artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.DOCS_DIR }}

deploy-docs:
needs: build-pages
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write

steps:
- name: Deploy documentation to GH Pages
uses: actions/deploy-pages@v4

35 changes: 20 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,42 @@ set(FENIX_VERSION_MAJOR 1)
set(FENIX_VERSION_MINOR 0)

option(BUILD_EXAMPLES "Builds example programs from the examples directory" OFF)
option(BUILD_TESTING "Builds tests and test modes of files" ON)

option(BUILD_TESTING "Builds tests and test modes of files" ON)
option(BUILD_DOCS "Builds documentation if is doxygen found" ON)
option(DOCS_ONLY "Only build documentation" OFF)

#Solves an issue with some system environments putting their MPI headers before
#the headers CMake includes. Forces non-system MPI headers when incorrect headers
#detected in include path.
option(FENIX_SYSTEM_INC_FIX "Attempts to force overriding any system MPI headers" ON)
option(FENIX_PROPAGATE_INC_FIX "Attempt overriding system MPI headers in linking projects" ON)

find_package(MPI REQUIRED)

if(${FENIX_SYSTEM_INC_FIX})
include(cmake/systemMPIOverride.cmake)
endif()
if(NOT DOCS_ONLY)
find_package(MPI REQUIRED)

if(${FENIX_SYSTEM_INC_FIX})
include(cmake/systemMPIOverride.cmake)
endif()

add_subdirectory(src)
add_subdirectory(src)

include(CTest)
list(APPEND MPIEXEC_PREFLAGS "--with-ft;mpi")

include(CTest)
list(APPEND MPIEXEC_PREFLAGS "--with-ft;mpi")
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if(BUILD_TESTING)
add_subdirectory(test)
endif()


if(BUILD_TESTING)
add_subdirectory(test)
endif()

if(BUILD_DOCS)
add_subdirectory(doc)
endif()

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/fenix-config.h.in
Expand Down
39 changes: 39 additions & 0 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
find_package(Doxygen)

set(FENIX_DOCS_OUTPUT ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Documentation output directory")
set(FENIX_DOCS_MAN "YES" CACHE BOOL "Option to disable man page generation for CI builds")
set(FENIX_BRANCH "local" CACHE BOOL "Git branch being documented, or local if not building for Github Pages")

if(NOT DOXYGEN_FOUND)
message(STATUS "Doxygen not found, `make docs` disabled")
return()
endif()

list(APPEND DOXYGEN_EXAMPLE_PATH markdown)
list(APPEND DOXYGEN_IMAGE_PATH images)

set(DOXYGEN_USE_MDFILE_AS_MAINPAGE markdown/Introduction.md)
set(DOXYGEN_LAYOUT_FILE DoxygenLayout.xml)
set(DOXYGEN_OUTPUT_DIRECTORY ${FENIX_DOCS_OUTPUT})

set(DOXYGEN_GENERATE_MAN ${FENIX_DOCS_MAN})

set(DOXYGEN_QUIET YES)
set(DOXYGEN_WARN_IF_UNDOCUMENTED NO)
set(DOXYGEN_WARN_IF_DOC_ERROR YES)
set(DOXYGEN_WARN_NO_PARAMDOC YES)
set(DOXYGEN_SHOW_INCLUDE_FILES NO)
set(DOXYGEN_WARN_IF_UNDOC_ENUM_VAL NO)

list(APPEND DOXYGEN_ALIASES "returnstatus=@return FENIX_SUCCESS if successful, any [return code](@ref ReturnCodes) otherwise.")
list(APPEND DOXYGEN_ALIASES "unimplemented=@qualifier UNIMPLEMENTED @brief @htmlonly <span class=\\\"mlabel\\\"> @endhtmlonly UNIMPLEMENTED @htmlonly </span> @endhtmlonly")

add_subdirectory(html)

doxygen_add_docs(docs
markdown/Introduction.md fake_init.h ../include ../src
ALL
COMMENT "Generate Fenix documentation")
message(STATUS "Run `make docs` to build documentation")

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/man DESTINATION ${CMAKE_INSTALL_PREFIX})
Loading

0 comments on commit e0ce1f8

Please sign in to comment.