| 1 |
# Distributed under the original FontForge BSD 3-clause license |
| 2 |
|
| 3 |
# If you add or remove files from the sphinx folder, run the docs-manifest |
| 4 |
# target to regenerate the manifest. This is so that CMake can track the |
| 5 |
# dependencies correctly, so it knows when to rerun sphinx. |
| 6 |
|
| 7 |
# CAVEAT: |
| 8 |
# sphinx runs its own dependency tracking so it does not regenerate |
| 9 |
# everything if already run before. But its dependency tracking is not |
| 10 |
# perfect, so if you are moving files around or renaming documents, it is |
| 11 |
# best to manually delete the output folder and rerun from scratch. |
| 12 |
|
| 13 |
add_custom_target(docs-manifest |
| 14 |
"${CMAKE_COMMAND}" |
| 15 |
-P "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/scripts/GenerateDocsManifest.cmake" |
| 16 |
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" |
| 17 |
) |
| 18 |
|
| 19 |
# Read dependencies |
| 20 |
file(STRINGS manifest.txt _manifest) |
| 21 |
configure_file(manifest.txt manifest.txt COPYONLY) |
| 22 |
|
| 23 |
add_custom_command(OUTPUT sphinx-docs |
| 24 |
COMMAND "${Sphinx_BUILD_BINARY}" -q -n -W -b html -d doctrees "${CMAKE_CURRENT_SOURCE_DIR}/sphinx" sphinx-docs |
| 25 |
DEPENDS ${_manifest} |
| 26 |
) |
| 27 |
|
| 28 |
add_custom_target(docs ALL DEPENDS sphinx-docs) |
| 29 |
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/sphinx-docs/" |
| 30 |
DESTINATION ${CMAKE_INSTALL_DOCDIR} |
| 31 |
COMPONENT docs |
| 32 |
) |