Only rebuild documentation when necessary

This teaches CMake about the dependencies of the Doxygen generated
documentation so it isn't rebuilt every time.
This commit is contained in:
Camilla Löwy 2021-08-25 13:12:14 +02:00
parent 8c8def5de5
commit 150744ecca

View File

@ -1,34 +1,46 @@
# NOTE: The order of this list determines the order of items in the Guides # NOTE: The order of this list determines the order of items in the Guides
# (i.e. Pages) list in the generated documentation # (i.e. Pages) list in the generated documentation
set(GLFW_DOXYGEN_SOURCES set(source_files
"include/GLFW/glfw3.h" main.dox
"include/GLFW/glfw3native.h" news.dox
"docs/main.dox" quick.dox
"docs/news.dox" moving.dox
"docs/quick.dox" compile.dox
"docs/moving.dox" build.dox
"docs/compile.dox" intro.dox
"docs/build.dox" context.dox
"docs/intro.dox" monitor.dox
"docs/context.dox" window.dox
"docs/monitor.dox" input.dox
"docs/window.dox" vulkan.dox
"docs/input.dox" compat.dox
"docs/vulkan.dox" internal.dox)
"docs/compat.dox"
"docs/internal.dox") set(extra_files DoxygenLayout.xml extra.css spaces.svg)
set(header_paths
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h"
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h")
# Format the source list into a Doxyfile INPUT value that Doxygen can parse # Format the source list into a Doxyfile INPUT value that Doxygen can parse
foreach(path IN LISTS GLFW_DOXYGEN_SOURCES) foreach(path IN LISTS header_paths)
string(APPEND GLFW_DOXYGEN_INPUT " \\\n\"${GLFW_SOURCE_DIR}/${path}\"") string(APPEND GLFW_DOXYGEN_INPUT " \\\n\"${path}\"")
endforeach()
foreach(file IN LISTS source_files)
string(APPEND GLFW_DOXYGEN_INPUT " \\\n\"${CMAKE_CURRENT_SOURCE_DIR}/${file}\"")
endforeach() endforeach()
configure_file(Doxyfile.in Doxyfile @ONLY) configure_file(Doxyfile.in Doxyfile @ONLY)
add_custom_target(docs ALL "${DOXYGEN_EXECUTABLE}" add_custom_command(OUTPUT "html/index.html"
WORKING_DIRECTORY "${GLFW_BINARY_DIR}/docs" COMMAND "${DOXYGEN_EXECUTABLE}"
COMMENT "Generating HTML documentation" VERBATIM) WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
MAIN_DEPENDENCY Doxyfile
DEPENDS ${header_paths} ${source_files} ${extra_files}
COMMENT "Generating HTML documentation"
VERBATIM)
add_custom_target(docs ALL SOURCES "html/index.html")
set_target_properties(docs PROPERTIES FOLDER "GLFW3") set_target_properties(docs PROPERTIES FOLDER "GLFW3")