Skip to content

Commit d8d4619

Browse files
Added DILIGENT_BUILD_DOCS option to enable DiligentDocs CMake target
1 parent e6ee2ff commit d8d4619

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ project(DiligentEngine)
1414
option(DILIGENT_BUILD_TOOLS "Build DiligentTools module" ON)
1515
option(DILIGENT_BUILD_FX "Build DiligentFX module" ON)
1616
option(DILIGENT_BUILD_SAMPLES "Build DiligentSamples module" ON)
17+
option(DILIGENT_BUILD_DOCS "Build documentation" OFF)
1718

1819
add_subdirectory(DiligentCore)
1920
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/DiligentCorePro")
@@ -47,6 +48,10 @@ if(${DILIGENT_BUILD_SAMPLES})
4748
add_subdirectory(DiligentSamples)
4849
endif()
4950

51+
if(${DILIGENT_BUILD_DOCS})
52+
add_subdirectory(Doc)
53+
endif()
54+
5055
if(TARGET GLTFViewer)
5156
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT GLTFViewer)
5257
elseif(TARGET Asteroids)

Doc/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
cmake_minimum_required (VERSION 3.10)
2+
3+
set(DOXYGEN_CONFIG_FILE "${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg")
4+
set(MD_PAGES_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/md_pages.py")
5+
set(PAGES_DOX "${CMAKE_CURRENT_SOURCE_DIR}/pages.dox")
6+
7+
add_custom_target(DiligentDocs
8+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.." # Need to run in the root of the repo
9+
COMMAND python "${MD_PAGES_SCRIPT}" "${PAGES_DOX}"
10+
COMMAND doxygen "${DOXYGEN_CONFIG_FILE}"
11+
COMMENT "Building documentation..."
12+
)

Doc/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Building Documentation
2+
3+
To build the documentation, install [Doxygen](https://www.doxygen.nl).
4+
Check the required version in the [GitHub Action file](https://github.com/DiligentGraphics/github-action/blob/master/install-doxygen/action.yml).
5+
6+
Then, from the **root** of the repository, run the following commands:
7+
8+
**1. Generate the Markdown pages list**
9+
10+
By default, Doxygen lists all Markdown files in a flat, arbitrary order, which can look messy and isn't
11+
very user-friendly. Use the script below to organize the Markdown files into a tree structure and generate
12+
the `Doc/pages.dox` file:
13+
14+
```bash
15+
python Doc/md_pages.py Doc/pages.dox
16+
```
17+
18+
**2. Build the documentation**
19+
20+
```bash
21+
doxygen Doc/doxygen.cfg
22+
```
23+
24+
Alternatively, you can enable the `DILIGENT_BUILD_DOCS` CMake option to add the `DiligentDocs` target.
25+
26+
The generated documentation will be placed in `build/docs/html`.
27+
Open `build/docs/html/index.html` in your browser to view the documentation.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,7 @@ Available CMake options are summarized in the table below:
724724
| `DILIGENT_BUILD_SAMPLE_BASE_ONLY` | No | Build only SampleBase project and no other samples/tutorials |
725725
| `DILIGENT_BUILD_TESTS` | No | Build Unit Tests |
726726
| `DILIGENT_BUILD_WIN32_GUI_AS_CONSOLE` | No | Build Windows GUI applications using the console subsystem |
727+
| `DILIGENT_BUILD_DOCS` | No | Build documentation using Doxygen |
727728
| `DILIGENT_NO_GLSLANG` | No | Do not build GLSLang and SPRIV-Tools |
728729
| `DILIGENT_NO_HLSL` | No | Disable HLSL support in non-Direct3D backends |
729730
| `DILIGENT_NO_FORMAT_VALIDATION` | Yes | Disable source code formatting validation |

0 commit comments

Comments
 (0)