Skip to content

Commit

Permalink
build: add support to auto-install doxygen if not found
Browse files Browse the repository at this point in the history
  • Loading branch information
threeal committed Jul 10, 2023
1 parent 1e4ac70 commit 34a309e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3.5.3

- name: Install requirements
run: |
sudo apt-get install -y doxygen
- name: Configure and build documentation
uses: threeal/cmake-action@v1.2.0
with:
Expand Down
20 changes: 17 additions & 3 deletions error/cmake/target_generate_xml_docs.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# A function that generates XML documentation from the specified target.
# A function that generates XML documentation for the specified target.
function(target_generate_xml_docs TARGET)
# Try to install Doxygen if not found
find_program(DOXYGEN_PROGRAM doxygen)
if(NOT DOXYGEN_PROGRAM)
find_program(APT_GET_PROGRAM apt-get)
if(APT_GET_PROGRAM)
message(STATUS "Doxygen could not be found, installing...")
execute_process(COMMAND ${APT_GET_PROGRAM} install -y doxygen)
endif()

find_program(BREW_PROGRAM brew)
if(BREW_PROGRAM)
message(STATUS "Doxygen could not be found, installing...")
execute_process(COMMAND ${BREW_PROGRAM} install doxygen)
endif()
endif()

# Try to find Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
Expand All @@ -25,7 +41,5 @@ function(target_generate_xml_docs TARGET)
# Generate XML documentation for the target
doxygen_add_docs(${TARGET}_docs ${HEADER_FILES} USE_STAMP_FILE)
add_dependencies(${TARGET} ${TARGET}_docs)
else()
message(WARNING "Could not found Doxygen!")
endif()
endfunction()

0 comments on commit 34a309e

Please # to comment.