Skip to content

Commit

Permalink
[CMake] Add 'docs' target
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszstolarczuk committed Dec 23, 2024
1 parent 718c61d commit 78d2798
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 9 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ jobs:

- name: Build the documentation
run: |
mkdir build
cd build
python3 ../docs/generate_docs.py
cmake -B build -DUMF_TESTS_FAIL_ON_SKIP=ON
cmake --build build --target docs
- name: Upload artifact
uses: actions/upload-pages-artifact@0252fc4ba7626f0298f0cf00902a25c6afc77fa8 # v3.0.0
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/reusable_docs_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ jobs:
- name: Build the documentation
run: |
mkdir build
cd build
python3 ../docs/generate_docs.py
cmake -B build \
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF \
-DUMF_BUILD_CUDA_PROVIDER=OFF \
-DUMF_BUILD_TESTS=OFF \
-DUMF_BUILD_EXAMPLES=OFF \
-DUMF_DISABLE_HWLOC=ON
cmake --build build --target docs
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,17 @@ if(UMF_FORMAT_CODE_STYLE)
endif()
endif()

find_package(Python3 3.8)
if(Python3_FOUND)
message(STATUS "Adding 'docs' target for creating a documentation.")
add_custom_target(
docs
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${Python3_EXECUTABLE}
${UMF_CMAKE_SOURCE_DIR}/docs/generate_docs.py
COMMENT "Generate HTML documentation using Doxygen")
endif()

# --------------------------------------------------------------------------- #
# Configure make install/uninstall and packages
# --------------------------------------------------------------------------- #
Expand Down
22 changes: 19 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
To generate HTML documentation run the `generate_docs.py` script from the `build` dir.
It will create extra `./docs_build` directory, where the intermediate and final files
# Documentation

To generate HTML documentation run the `generate_docs.py` script from any sub-dir of the
repository (most likely `build`) or enable and use build target 'docs' (see details below).

This script will create `./docs_build` sub-directory, where the intermediate and final files
will be created. HTML docs will be in the `./docs_build/generated/html` directory.

The script requires:
## make docs

To run documentation generation via build target use CMake commands below.
To enable this target, python executable (in required version) has to be found in the system.

```bash
$ cmake -B build
$ cmake --build build --target docs
```

## Requirements

Script to generate HTML docs requires:
* [Doxygen](http://www.doxygen.nl/) at least v1.9.1
* [Python](https://www.python.org/downloads/) at least v3.8
* and python pip requirements, as defined in `third_party/requirements.txt`

0 comments on commit 78d2798

Please sign in to comment.