Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: use parallelization except on Windows
Browse files Browse the repository at this point in the history
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.
cathyjf committed Nov 3, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 4c05198 commit 8c37a35
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -92,13 +92,23 @@ add_custom_command(
file(RELATIVE_PATH DOXYGEN_BUILD_DIR_RELATIVE "${SOURCE_DOCS_DIR}" "${DOXYGEN_BUILD_DIR_CMAKE}")
message(STATUS "DOXYGEN_BUILD_DIR_RELATIVE: ${DOXYGEN_BUILD_DIR_RELATIVE}")

if(CMAKE_HOST_WIN32)
# On Windows, we have to build the documentation using only a single thread to
# avoid the build mysteriously taking forever.
# See https://github.com/doxygen/doxygen/issues/9694
set(DOXYGEN_NUM_THREADS 1)
else()
set(DOXYGEN_NUM_THREADS 0)
endif()

# build docs
add_custom_target(docs ALL
COMMENT "Building Doxygen documentation"
WORKING_DIRECTORY "${SOURCE_DOCS_DIR}"
COMMAND ${CMAKE_COMMAND} -E env
READTHEDOCS_OUTPUT=${DOXYGEN_BUILD_DIR_RELATIVE}
READTHEDOCS_VERSION=${DOXYGEN_PROJECT_VERSION}
DOXYCONFIG_THREADS=${DOXYGEN_NUM_THREADS}
${DOXYGEN_EXECUTABLE} doxyconfig-Doxyfile
VERBATIM
DEPENDS FONT_AWESOME_FILES
4 changes: 2 additions & 2 deletions doxyconfig-Doxyfile
Original file line number Diff line number Diff line change
@@ -107,7 +107,7 @@ DISABLE_INDEX = NO
DOCBOOK_OUTPUT = docbook
DOT_GRAPH_MAX_NODES = 50
DOT_IMAGE_FORMAT = svg
DOT_NUM_THREADS = 1
DOT_NUM_THREADS = $(DOXYCONFIG_THREADS)
EXTRACT_ALL = NO
FULL_SIDEBAR = NO
GENERATE_HTML = YES
@@ -122,7 +122,7 @@ MACRO_EXPANSION = YES
MAN_OUTPUT = man
MARKDOWN_ID_STYLE = GITHUB
MARKDOWN_SUPPORT = YES
NUM_PROC_THREADS = 1
NUM_PROC_THREADS = $(DOXYCONFIG_THREADS)
PROJECT_NUMBER = $(READTHEDOCS_VERSION)
OUTPUT_DIRECTORY = $(READTHEDOCS_OUTPUT)
RECURSIVE = YES

0 comments on commit 8c37a35

Please sign in to comment.