Skip to content

Commit e83ac0b

Browse files
[CMake] Add 'docs' target
1 parent 2e19ff3 commit e83ac0b

File tree

4 files changed

+39
-9
lines changed

4 files changed

+39
-9
lines changed

.github/workflows/docs.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ jobs:
4242

4343
- name: Build the documentation
4444
run: |
45-
mkdir build
46-
cd build
47-
python3 ../docs/generate_docs.py
45+
cmake -B build -DUMF_TESTS_FAIL_ON_SKIP=ON
46+
cmake --build build --target docs
4847
4948
- name: Upload artifact
5049
uses: actions/upload-pages-artifact@0252fc4ba7626f0298f0cf00902a25c6afc77fa8 # v3.0.0

.github/workflows/reusable_docs_build.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ jobs:
3131
3232
- name: Build the documentation
3333
run: |
34-
mkdir build
35-
cd build
36-
python3 ../docs/generate_docs.py
34+
cmake -B build \
35+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF \
36+
-DUMF_BUILD_CUDA_PROVIDER=OFF \
37+
-DUMF_BUILD_TESTS=OFF \
38+
-DUMF_BUILD_EXAMPLES=OFF \
39+
-DUMF_DISABLE_HWLOC=ON
40+
cmake --build build --target docs

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,17 @@ if(UMF_FORMAT_CODE_STYLE)
755755
endif()
756756
endif()
757757

758+
find_package(Python3)
759+
if(Python3_FOUND)
760+
message(STATUS "Adding 'docs' target")
761+
add_custom_target(
762+
docs
763+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
764+
COMMAND ${Python3_EXECUTABLE}
765+
${UMF_CMAKE_SOURCE_DIR}/docs/generate_docs.py
766+
COMMENT "Generate HTML documentation using Doxygen")
767+
endif()
768+
758769
# --------------------------------------------------------------------------- #
759770
# Configure make install/uninstall and packages
760771
# --------------------------------------------------------------------------- #

docs/README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1-
To generate HTML documentation run the `generate_docs.py` script from the `build` dir.
2-
It will create extra `./docs_build` directory, where the intermediate and final files
1+
# Documentation
2+
3+
To generate HTML documentation run the `generate_docs.py` script from any sub-dir of the
4+
repository (most likely `build`) or enable and use build target 'docs' (see details below).
5+
6+
This script will create `./docs_build` sub-directory, where the intermediate and final files
37
will be created. HTML docs will be in the `./docs_build/generated/html` directory.
48

5-
The script requires:
9+
## make docs
10+
11+
To run documentation generation via build target use CMake commands below.
12+
To enable this target, python executable has to be found in the system.
13+
14+
```bash
15+
$ cmake -B build
16+
$ cmake --build build --target docs
17+
```
18+
19+
## Requirements
20+
21+
Script to generate HTML docs requires:
622
* [Doxygen](http://www.doxygen.nl/) at least v1.9.1
723
* [Python](https://www.python.org/downloads/) at least v3.8
824
* and python pip requirements, as defined in `third_party/requirements.txt`

0 commit comments

Comments
 (0)