Skip to content

Commit e00aa16

Browse files
committed
Add cmake option for specifying that the doc github repo should be set up
1 parent 8d17eb8 commit e00aa16

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
run: |
2323
mkdir build
2424
cd build
25-
cmake .. -DRAPIDJSON_BUILD_DOC=ON -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF
25+
cmake .. -DRAPIDJSON_BUILD_DOC_FOR_PUBLISH=ON -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF
2626
cmake --build .
2727
- name: Add changes & push to deploy
2828
run: |

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ endif()
150150
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
151151

152152
option(RAPIDJSON_BUILD_DOC "Build rapidjson documentation." ON)
153+
option(RAPIDJSON_BUILD_DOC_FOR_PUBLISH "Build rapidjson documentation and prepare the html directory for publication to gh-pages branch" OFF)
154+
if(RAPIDJSON_BUILD_DOC_FOR_PUBLISH)
155+
set(RAPIDJSON_BUILD_DOC ON)
156+
endif()
153157
option(RAPIDJSON_BUILD_EXAMPLES "Build rapidjson examples." ON)
154158
option(RAPIDJSON_BUILD_TESTS "Build rapidjson perftests and unittests." ON)
155159
option(RAPIDJSON_BUILD_THIRDPARTY_GTEST

doc/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,17 @@ ELSE()
1111

1212
file(GLOB DOXYFILES ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile*)
1313

14+
set(GIT_COMMANDS)
15+
if(RAPIDJSON_BUILD_DOC_FOR_PUBLISH)
16+
set(
17+
GIT_COMMANDS
18+
COMMAND git fetch origin gh-pages
19+
COMMAND git worktree add -f ${CMAKE_CURRENT_BINARY_DIR}/html gh-pages
20+
)
21+
endif()
22+
1423
add_custom_command(OUTPUT html
15-
COMMAND git fetch origin gh-pages
16-
COMMAND git worktree add -f ${CMAKE_CURRENT_BINARY_DIR}/html gh-pages
24+
${GIT_COMMANDS}
1725
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
1826
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/html
1927
DEPENDS ${MARKDOWN_DOC} ${SOURCES} ${DOXYFILES}

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ to the gh-pages branch as below.
137137
```
138138
mkdir build_docs
139139
cd build_docs
140-
cmake .. -DRAPIDJSON_BUILD_DOC=ON -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF
140+
cmake .. -DRAPIDJSON_BUILD_DOC_FOR_PUBLISH=ON -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF
141141
cmake --build .
142142
cd doc/html
143143
git add -A

0 commit comments

Comments
 (0)