Skip to content

Commit 8c37a35

Browse files
committed
build: use parallelization except on Windows
This is similar to LizardByte/Sunshine#3361, except now multithreaded processing is not used on Windows. Unlike LizardByte/Sunshine#3361, we're now enabling parallelization for both dot graph generation and other doxygen processing tasks as well (except on Windows). To check for Windows, we use the macro `CMAKE_HOST_WIN32` rather than the more well-known `WIN32`, because what matters here is the host platform, not the target platform. In most cases, these will be the same, but the issue with parallelization is related to Windows as a host, not a target. In other words, using Windows to build the documentation for a macOS project should still be single-threaded.
1 parent 4c05198 commit 8c37a35

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,23 @@ add_custom_command(
9292
file(RELATIVE_PATH DOXYGEN_BUILD_DIR_RELATIVE "${SOURCE_DOCS_DIR}" "${DOXYGEN_BUILD_DIR_CMAKE}")
9393
message(STATUS "DOXYGEN_BUILD_DIR_RELATIVE: ${DOXYGEN_BUILD_DIR_RELATIVE}")
9494

95+
if(CMAKE_HOST_WIN32)
96+
# On Windows, we have to build the documentation using only a single thread to
97+
# avoid the build mysteriously taking forever.
98+
# See https://github.com/doxygen/doxygen/issues/9694
99+
set(DOXYGEN_NUM_THREADS 1)
100+
else()
101+
set(DOXYGEN_NUM_THREADS 0)
102+
endif()
103+
95104
# build docs
96105
add_custom_target(docs ALL
97106
COMMENT "Building Doxygen documentation"
98107
WORKING_DIRECTORY "${SOURCE_DOCS_DIR}"
99108
COMMAND ${CMAKE_COMMAND} -E env
100109
READTHEDOCS_OUTPUT=${DOXYGEN_BUILD_DIR_RELATIVE}
101110
READTHEDOCS_VERSION=${DOXYGEN_PROJECT_VERSION}
111+
DOXYCONFIG_THREADS=${DOXYGEN_NUM_THREADS}
102112
${DOXYGEN_EXECUTABLE} doxyconfig-Doxyfile
103113
VERBATIM
104114
DEPENDS FONT_AWESOME_FILES

doxyconfig-Doxyfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ DISABLE_INDEX = NO
107107
DOCBOOK_OUTPUT = docbook
108108
DOT_GRAPH_MAX_NODES = 50
109109
DOT_IMAGE_FORMAT = svg
110-
DOT_NUM_THREADS = 1
110+
DOT_NUM_THREADS = $(DOXYCONFIG_THREADS)
111111
EXTRACT_ALL = NO
112112
FULL_SIDEBAR = NO
113113
GENERATE_HTML = YES
@@ -122,7 +122,7 @@ MACRO_EXPANSION = YES
122122
MAN_OUTPUT = man
123123
MARKDOWN_ID_STYLE = GITHUB
124124
MARKDOWN_SUPPORT = YES
125-
NUM_PROC_THREADS = 1
125+
NUM_PROC_THREADS = $(DOXYCONFIG_THREADS)
126126
PROJECT_NUMBER = $(READTHEDOCS_VERSION)
127127
OUTPUT_DIRECTORY = $(READTHEDOCS_OUTPUT)
128128
RECURSIVE = YES

0 commit comments

Comments
 (0)