Skip to content

Commit

Permalink
Doxygen: Build documentation and host on GitHub Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
DeathCamel58 committed Sep 27, 2024
1 parent 62032d0 commit fa58c6b
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/doxygen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CMake

on:
push:
branches: [ "main" ]

permissions:
contents: read
pages: write
id-token: write

jobs:
documenation:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Install Doxygen
run: sudo apt-get install -y doxygen graphviz

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12

- name: Generate Documentation
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config Debug --target docs

- name: Upload GitHub Pages artifact
uses: actions/[email protected]
with:
path: docs

- name: Deploy artifact
uses: actions/deploy-pages@v4
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ compile_commands.json
# CMake typical build dirs
/cmake_build*
/cmake-build*

# Doxygen
docs
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,25 @@ endif()
include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
include(CPack)

# Add documentation option
option(BUILD_DOC "Build documentation" ON)

# Check if Doxygen is installed
find_package(Doxygen OPTIONAL_COMPONENTS dot dia)
if (DOXYGEN_FOUND)
set(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
set(DOXYGEN_HTML_OUTPUT docs)
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE README.md)

message("Doxygen build started")

doxygen_add_docs(
docs
include
README.md
COMMENT "Generate docs"
)
else (DOXYGEN_FOUND)
message("Doxygen need to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ This library currently supports:

* Engine Library, as used on "Prime"-series DJ equipment.

Documentation can be viewed on [GitHub Pages](https://xcso.github.io/libdjinterop/)

State of Support
================

Expand Down

0 comments on commit fa58c6b

Please sign in to comment.