Skip to content

Commit 0700394

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

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-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: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Building documentation
2+
3+
To build the documentation, install Doxygen.
4+
Check the required version in the [action file](https://github.com/DiligentGraphics/github-action/blob/master/install-doxygen/action.yml).
5+
6+
Then run the following commands in the **root of the repository**.
7+
8+
**1. Build markdown pages list**
9+
10+
By default, Doxygen puts all markdown files in rather arbitrary order in a flat list.
11+
This looks very messy and is not user-friendly.
12+
The following script organizes the markdown files into a tree structure and generates a
13+
list of pages in the `Doc/pages.dox` file:
14+
15+
```bash
16+
python Doc/md_pages.py Doc/pages.dox
17+
```
18+
19+
**2. Build documentation**
20+
21+
```bash
22+
doxygen Doc/doxygen.cfg
23+
```
24+
25+
Use the `DILIGENT_BUILD_DOCS` CMake option to add `DiligentDocs` CMake targets for building documentation.
26+
27+
The documentation will be generated in the `build/docs/html` folder.
28+
Open `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)