1b877906bSopenharmony_ci
2b877906bSopenharmony_ci# NOTE: The order of this list determines the order of items in the Guides
3b877906bSopenharmony_ci#       (i.e. Pages) list in the generated documentation
4b877906bSopenharmony_ciset(source_files
5b877906bSopenharmony_ci    main.md
6b877906bSopenharmony_ci    news.md
7b877906bSopenharmony_ci    quick.md
8b877906bSopenharmony_ci    moving.md
9b877906bSopenharmony_ci    compile.md
10b877906bSopenharmony_ci    build.md
11b877906bSopenharmony_ci    intro.md
12b877906bSopenharmony_ci    context.md
13b877906bSopenharmony_ci    monitor.md
14b877906bSopenharmony_ci    window.md
15b877906bSopenharmony_ci    input.md
16b877906bSopenharmony_ci    vulkan.md
17b877906bSopenharmony_ci    compat.md
18b877906bSopenharmony_ci    internal.md)
19b877906bSopenharmony_ci
20b877906bSopenharmony_ciset(extra_files DoxygenLayout.xml header.html footer.html extra.css spaces.svg)
21b877906bSopenharmony_ci
22b877906bSopenharmony_ciset(header_paths
23b877906bSopenharmony_ci    "${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h"
24b877906bSopenharmony_ci    "${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h")
25b877906bSopenharmony_ci
26b877906bSopenharmony_ci# Format the source list into a Doxyfile INPUT value that Doxygen can parse
27b877906bSopenharmony_ciforeach(path IN LISTS header_paths)
28b877906bSopenharmony_ci    string(APPEND GLFW_DOXYGEN_INPUT " \\\n\"${path}\"")
29b877906bSopenharmony_ciendforeach()
30b877906bSopenharmony_ciforeach(file IN LISTS source_files)
31b877906bSopenharmony_ci    string(APPEND GLFW_DOXYGEN_INPUT " \\\n\"${CMAKE_CURRENT_SOURCE_DIR}/${file}\"")
32b877906bSopenharmony_ciendforeach()
33b877906bSopenharmony_ci
34b877906bSopenharmony_ciset(DOXYGEN_SKIP_DOT TRUE)
35b877906bSopenharmony_cifind_package(Doxygen)
36b877906bSopenharmony_ci
37b877906bSopenharmony_ciif (NOT DOXYGEN_FOUND OR DOXYGEN_VERSION VERSION_LESS "1.9.8")
38b877906bSopenharmony_ci    message(STATUS "Documentation generation requires Doxygen 1.9.8 or later")
39b877906bSopenharmony_cielse()
40b877906bSopenharmony_ci    configure_file(Doxyfile.in Doxyfile @ONLY)
41b877906bSopenharmony_ci    add_custom_command(OUTPUT "html/index.html"
42b877906bSopenharmony_ci                       COMMAND "${DOXYGEN_EXECUTABLE}"
43b877906bSopenharmony_ci                       WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
44b877906bSopenharmony_ci                       MAIN_DEPENDENCY Doxyfile
45b877906bSopenharmony_ci                       DEPENDS ${header_paths} ${source_files} ${extra_files}
46b877906bSopenharmony_ci                       COMMENT "Generating HTML documentation"
47b877906bSopenharmony_ci                       VERBATIM)
48b877906bSopenharmony_ci
49b877906bSopenharmony_ci    add_custom_target(docs ALL SOURCES "html/index.html")
50b877906bSopenharmony_ci    set_target_properties(docs PROPERTIES FOLDER "GLFW3")
51b877906bSopenharmony_ci
52b877906bSopenharmony_ci    if (GLFW_INSTALL)
53b877906bSopenharmony_ci        install(DIRECTORY "${GLFW_BINARY_DIR}/docs/html"
54b877906bSopenharmony_ci                DESTINATION "${CMAKE_INSTALL_DOCDIR}")
55b877906bSopenharmony_ci    endif()
56b877906bSopenharmony_ciendif()
57b877906bSopenharmony_ci
58