Skip to content

Commit 91219de

Browse files
authored
build: refactor Doxygen XML build (#110)
* build: remove auto-installation of Doxygen * build: modify `add_xml_docs` function to `target_generate_xml_docs`
1 parent 4921656 commit 91219de

File tree

6 files changed

+25
-39
lines changed

6 files changed

+25
-39
lines changed

.github/workflows/build.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ jobs:
4848
- name: Checkout
4949
uses: actions/checkout@v4.1.1
5050

51-
- name: Install Requirements
52-
run: pip3 install -r docs/requirements.txt
51+
- name: Install Dependencies
52+
run: |
53+
sudo apt-get install -y doxygen
54+
pip3 install -r docs/requirements.txt
5355
5456
- name: Build Documentation
5557
run: sphinx-build -b html docs build/docs -W --keep-going

.github/workflows/deploy.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ jobs:
2323
- name: Checkout
2424
uses: actions/checkout@v4.1.1
2525

26-
- name: Install Requirements
27-
run: pip3 install -r docs/requirements.txt
26+
- name: Install Dependencies
27+
run: |
28+
sudo apt-get install -y doxygen
29+
pip3 install -r docs/requirements.txt
2830
2931
- name: Build Documentation
3032
run: sphinx-build -b html docs docs/build -W --keep-going

CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,9 @@ if(NOT_SUBPROJECT)
7171
catch_discover_tests(errors_test)
7272
endif()
7373

74-
# Build XML documentation
7574
if(BUILD_DOCS)
76-
include(cmake/add_xml_docs.cmake)
77-
add_xml_docs(errors_docs include/errors/error.hpp)
75+
include(cmake/GenerateDocs.cmake)
76+
target_generate_xml_docs(errors)
7877
endif()
7978

8079
if(BUILD_EXAMPLES)

cmake/GenerateDocs.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Function to generate an XML documentation of a specific target.
2+
# Arguments:
3+
# - TARGET: The target for which to generate an XML documentation.
4+
function(target_generate_xml_docs TARGET)
5+
find_package(Doxygen REQUIRED)
6+
7+
# Configure Doxygen to generate an XML documentation.
8+
set(DOXYGEN_GENERATE_HTML NO)
9+
set(DOXYGEN_GENERATE_XML YES)
10+
set(DOXYGEN_XML_OUTPUT ${TARGET}_docs)
11+
12+
get_target_property(TARGET_HEADER_SET ${TARGET} HEADER_SET)
13+
doxygen_add_docs(${TARGET}_docs ${TARGET_HEADER_SET} USE_STAMP_FILE)
14+
endfunction()

cmake/add_xml_docs.cmake

Lines changed: 0 additions & 30 deletions
This file was deleted.

components/format/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ if(NOT_SUBPROJECT)
3939
catch_discover_tests(errors_format_test)
4040
endif()
4141

42-
# Build XML documentation
4342
if(BUILD_DOCS)
44-
add_xml_docs(errors_format_docs include/errors/format.hpp)
43+
target_generate_xml_docs(errors_format)
4544
endif()
4645
endif()

0 commit comments

Comments
 (0)