From 150744ecca502c9af0631233d9d398fdf773a4db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 25 Aug 2021 13:12:14 +0200 Subject: [PATCH] Only rebuild documentation when necessary This teaches CMake about the dependencies of the Doxygen generated documentation so it isn't rebuilt every time. --- docs/CMakeLists.txt | 56 +++++++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index d88888d4..19694085 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -1,34 +1,46 @@ # NOTE: The order of this list determines the order of items in the Guides # (i.e. Pages) list in the generated documentation -set(GLFW_DOXYGEN_SOURCES - "include/GLFW/glfw3.h" - "include/GLFW/glfw3native.h" - "docs/main.dox" - "docs/news.dox" - "docs/quick.dox" - "docs/moving.dox" - "docs/compile.dox" - "docs/build.dox" - "docs/intro.dox" - "docs/context.dox" - "docs/monitor.dox" - "docs/window.dox" - "docs/input.dox" - "docs/vulkan.dox" - "docs/compat.dox" - "docs/internal.dox") +set(source_files + main.dox + news.dox + quick.dox + moving.dox + compile.dox + build.dox + intro.dox + context.dox + monitor.dox + window.dox + input.dox + vulkan.dox + compat.dox + 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 -foreach(path IN LISTS GLFW_DOXYGEN_SOURCES) - string(APPEND GLFW_DOXYGEN_INPUT " \\\n\"${GLFW_SOURCE_DIR}/${path}\"") +foreach(path IN LISTS header_paths) + 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() configure_file(Doxyfile.in Doxyfile @ONLY) -add_custom_target(docs ALL "${DOXYGEN_EXECUTABLE}" - WORKING_DIRECTORY "${GLFW_BINARY_DIR}/docs" - COMMENT "Generating HTML documentation" VERBATIM) +add_custom_command(OUTPUT "html/index.html" + COMMAND "${DOXYGEN_EXECUTABLE}" + 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")