2022-03-14 05:44:12 +00:00
|
|
|
# ---- Dependencies ----
|
|
|
|
|
2022-09-10 16:28:07 +00:00
|
|
|
set(extract_timestamps "")
|
|
|
|
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
|
|
|
|
set(extract_timestamps DOWNLOAD_EXTRACT_TIMESTAMP YES)
|
|
|
|
endif ()
|
|
|
|
|
2022-03-14 05:44:12 +00:00
|
|
|
include(FetchContent)
|
|
|
|
FetchContent_Declare(
|
2022-09-10 16:28:07 +00:00
|
|
|
mcss URL
|
|
|
|
https://github.com/friendlyanon/m.css/releases/download/release-1/mcss.zip
|
|
|
|
URL_MD5 00cd2757ebafb9bcba7f5d399b3bec7f
|
|
|
|
SOURCE_DIR "${PROJECT_BINARY_DIR}/mcss"
|
|
|
|
UPDATE_DISCONNECTED YES
|
|
|
|
${extract_timestamps}
|
2022-03-14 05:44:12 +00:00
|
|
|
)
|
|
|
|
FetchContent_MakeAvailable(mcss)
|
|
|
|
|
|
|
|
find_package(Python3 3.6 REQUIRED)
|
|
|
|
|
|
|
|
# ---- Declare documentation target ----
|
|
|
|
|
|
|
|
set(
|
2022-09-10 16:28:07 +00:00
|
|
|
DOXYGEN_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/docs"
|
|
|
|
CACHE PATH "Path for the generated Doxygen documentation"
|
2022-03-14 05:44:12 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(working_dir "${PROJECT_BINARY_DIR}/docs")
|
|
|
|
|
2022-09-10 16:28:07 +00:00
|
|
|
foreach (file IN ITEMS Doxyfile conf.py)
|
|
|
|
configure_file("docs/${file}.in" "${working_dir}/${file}" @ONLY)
|
|
|
|
endforeach ()
|
2022-03-14 05:44:12 +00:00
|
|
|
|
|
|
|
set(mcss_script "${mcss_SOURCE_DIR}/documentation/doxygen.py")
|
|
|
|
set(config "${working_dir}/conf.py")
|
|
|
|
|
|
|
|
add_custom_target(
|
2022-09-10 16:28:07 +00:00
|
|
|
docs
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E remove_directory
|
|
|
|
"${DOXYGEN_OUTPUT_DIRECTORY}/html"
|
|
|
|
"${DOXYGEN_OUTPUT_DIRECTORY}/xml"
|
|
|
|
COMMAND "${Python3_EXECUTABLE}" "${mcss_script}" "${config}"
|
|
|
|
COMMENT "Building documentation using Doxygen and m.css"
|
|
|
|
WORKING_DIRECTORY "${working_dir}"
|
|
|
|
VERBATIM
|
2022-03-14 05:44:12 +00:00
|
|
|
)
|