From fa58c6b26824ac5165c0e70beec319d348db2cc2 Mon Sep 17 00:00:00 2001 From: Dylan Corrales Date: Fri, 27 Sep 2024 15:59:00 -0400 Subject: [PATCH 1/2] Doxygen: Build documentation and host on GitHub Pages --- .github/workflows/doxygen.yml | 37 +++++++++++++++++++++++++++++++++++ .gitignore | 3 +++ CMakeLists.txt | 22 +++++++++++++++++++++ README.md | 2 ++ 4 files changed, 64 insertions(+) create mode 100644 .github/workflows/doxygen.yml diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml new file mode 100644 index 0000000..aaaa98b --- /dev/null +++ b/.github/workflows/doxygen.yml @@ -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/upload-pages-artifact@v3.0.1 + with: + path: docs + + - name: Deploy artifact + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index 1e8863e..91cc74f 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ compile_commands.json # CMake typical build dirs /cmake_build* /cmake-build* + +# Doxygen +docs diff --git a/CMakeLists.txt b/CMakeLists.txt index 82f0b1a..9a42fe7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/README.md b/README.md index 6890a46..bf62cc8 100644 --- a/README.md +++ b/README.md @@ -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 ================ From ad84c7406126a70c024c73789851afcb5ff3a9c1 Mon Sep 17 00:00:00 2001 From: Adam Szmigin Date: Tue, 8 Oct 2024 00:02:46 +0100 Subject: [PATCH 2/2] URL typo, build docs in build dir --- .github/workflows/doxygen.yml | 2 +- .gitignore | 3 --- CMakeLists.txt | 1 - README.md | 2 +- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index aaaa98b..2390b16 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -31,7 +31,7 @@ jobs: - name: Upload GitHub Pages artifact uses: actions/upload-pages-artifact@v3.0.1 with: - path: docs + path: ${{github.workspace}}/build/docs - name: Deploy artifact uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index 91cc74f..1e8863e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,3 @@ compile_commands.json # CMake typical build dirs /cmake_build* /cmake-build* - -# Doxygen -docs diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a42fe7..f502cb7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -292,7 +292,6 @@ 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) diff --git a/README.md b/README.md index bf62cc8..e840d51 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ 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/) +Documentation can be viewed on [GitHub Pages](https://xsco.github.io/libdjinterop/) State of Support ================