Skip to content

Commit

Permalink
cmake: fix Doxygen documentation generation + install html & man pages
Browse files Browse the repository at this point in the history
  • Loading branch information
madebr committed Feb 23, 2024
1 parent 8e4c044 commit 7a2584b
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,17 +283,31 @@ if(PHYSFS_BUILD_DOCS)
file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n\n# Below auto-generated by cmake...\n\n")
file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "PROJECT_NUMBER = \"${PHYSFS_VERSION}\"\n")
file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "OUTPUT_DIRECTORY = \"${CMAKE_CURRENT_BINARY_DIR}/docs\"\n")
file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "INPUT = \"${CMAKE_CURRENT_SOURCE_DIR}/include\"\n")
file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n# End auto-generated section.\n\n")

set(PHYSFS_TARGETNAME_DOCS "docs" CACHE STRING "Name of 'docs' build target")

add_custom_target(
${PHYSFS_TARGETNAME_DOCS}
${DOXYGEN_EXECUTABLE} "${PHYSFS_OUTPUT_DOXYFILE}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/docs/html/index.html"
COMMAND ${DOXYGEN_EXECUTABLE} "${PHYSFS_OUTPUT_DOXYFILE}"
COMMENT "Building documentation in 'docs' directory..."
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/physfs.h" "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile"
)

add_custom_target(${PHYSFS_TARGETNAME_DOCS} ALL
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/docs/html/index.html"
)

if(NOT PHYSFS_DISABLE_INSTALL)
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/docs/html"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/physfs"
)
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/docs/man"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}"
)
endif()

else()
message(STATUS "Doxygen not found. You won't be able to build documentation.")
endif()
Expand Down

0 comments on commit 7a2584b

Please sign in to comment.