From 7981624792ff1510f29eedd57fcc61542fd4156e Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 4 Aug 2023 23:59:04 -0700 Subject: [PATCH] don't build html docs unless we have to --- .github/workflows/build-linux.yml | 4 ++++ .github/workflows/build-windows.yml | 5 ++++- .github/workflows/test.yml | 2 ++ CMakeLists.txt | 23 +++++++++++++++++------ 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index a4609128b..f7088a234 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -29,6 +29,9 @@ on: docs: type: boolean default: false + html: + type: boolean + default: true stonesense: type: boolean default: false @@ -118,6 +121,7 @@ jobs: -DBUILD_SIZECHECK:BOOL=${{ inputs.extras }} \ -DBUILD_SKELETON:BOOL=${{ inputs.extras }} \ -DBUILD_DOCS:BOOL=${{ inputs.docs }} \ + -DBUILD_DOCS_NO_HTML:BOOL=${{ !inputs.html }} \ -DBUILD_TESTS:BOOL=${{ inputs.tests }} \ -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }} \ -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} \ diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 987dfc562..50d7f6936 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -29,6 +29,9 @@ on: docs: type: boolean default: false + html: + type: boolean + default: true stonesense: type: boolean default: false @@ -91,7 +94,7 @@ jobs: win-msvc - name: Cross-compile env: - CMAKE_EXTRA_ARGS: '-DBUILD_LIBRARY=${{ inputs.platform-files }} -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} -DBUILD_DOCS:BOOL=${{ inputs.docs }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }} -DBUILD_TESTS:BOOL=${{ inputs.tests }} -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }}' + CMAKE_EXTRA_ARGS: '-DBUILD_LIBRARY=${{ inputs.platform-files }} -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} -DBUILD_DOCS:BOOL=${{ inputs.docs }} -DBUILD_DOCS_NO_HTML:BOOL=${{ !inputs.html }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }} -DBUILD_TESTS:BOOL=${{ inputs.tests }} -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }}' run: | cd build bash -x build-win64-from-linux.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c74b559ea..0934d6d00 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,7 @@ jobs: artifact-name: test-msvc cache-id: test docs: true + html: false tests: true build-linux: @@ -35,6 +36,7 @@ jobs: stonesense: ${{ matrix.plugins == 'all' }} extras: ${{ matrix.plugins == 'all' }} docs: true + html: false tests: true gcc-ver: ${{ matrix.gcc }} secrets: inherit diff --git a/CMakeLists.txt b/CMakeLists.txt index d3db43a6c..4e0e30f44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ else(CMAKE_CONFIGURATION_TYPES) endif(CMAKE_CONFIGURATION_TYPES) option(BUILD_DOCS "Choose whether to build the documentation (requires python and Sphinx)." OFF) +option(BUILD_DOCS_NO_HTML "Don't build the HTML docs, only the in-game docs." OFF) option(REMOVE_SYMBOLS_FROM_DF_STUBS "Remove debug symbols from DF stubs. (Reduces libdfhack size to about half but removes a few useful symbols)" ON) macro(CHECK_GCC compiler_path) @@ -468,7 +469,14 @@ if(BUILD_DOCS) "${CMAKE_CURRENT_SOURCE_DIR}/conf.py" ) - set(SPHINX_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/html/.buildinfo") + if(BUILD_DOCS_NO_HTML) + set(SPHINX_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/text/index.txt") + set(SPHINX_BUILD_TARGETS text) + else() + set(SPHINX_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/html/.buildinfo") + set(SPHINX_BUILD_TARGETS html text) + endif() + set_property( DIRECTORY PROPERTY ADDITIONAL_CLEAN_FILES TRUE "${CMAKE_CURRENT_SOURCE_DIR}/docs/changelogs" @@ -485,9 +493,10 @@ if(BUILD_DOCS) "${CMAKE_BINARY_DIR}/docs/text" "${CMAKE_BINARY_DIR}/docs/xml" ) + add_custom_command(OUTPUT ${SPHINX_OUTPUT} COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/docs/build.py" - html text --sphinx="${SPHINX_EXECUTABLE}" -- -q -W + ${SPHINX_BUILD_TARGETS} --sphinx="${SPHINX_EXECUTABLE}" -- -q -W DEPENDS ${SPHINX_DEPS} COMMENT "Building documentation with Sphinx" ) @@ -500,10 +509,12 @@ if(BUILD_DOCS) add_custom_command(TARGET dfhack_docs POST_BUILD COMMAND ${CMAKE_COMMAND} -E touch ${SPHINX_OUTPUT}) - install(DIRECTORY ${dfhack_SOURCE_DIR}/docs/html/ - DESTINATION ${DFHACK_USERDOC_DESTINATION}/docs - FILES_MATCHING PATTERN "*" - PATTERN html/_sources EXCLUDE) + if(NOT BUILD_DOCS_NO_HTML) + install(DIRECTORY ${dfhack_SOURCE_DIR}/docs/html/ + DESTINATION ${DFHACK_USERDOC_DESTINATION}/docs + FILES_MATCHING PATTERN "*" + PATTERN html/_sources EXCLUDE) + endif() install(DIRECTORY ${dfhack_SOURCE_DIR}/docs/text/ DESTINATION ${DFHACK_USERDOC_DESTINATION}/docs) install(FILES docs/changelogs/news.rst docs/changelogs/news-dev.rst DESTINATION ${DFHACK_USERDOC_DESTINATION})