Skip to content

Commit

Permalink
build: add doc target
Browse files Browse the repository at this point in the history
This patch adds a doc target generating Doxygen documentation similarly
to <zyantific/zycore-c#51>, but with some extra
bits: if doxygen-awesome.css is found on the host system, CMake will
automatically use it to generate themed documentation.

Using `doxygen_add_docs()` requires setting the various Doxygen options
in CMakeLists.txt, so there's currently a bit of duplication as the same
options are also contained in Doxyfile and Doxyfile-themed. I couldn't
remove the two standalone files as they are still required by the
doc.yml CI/CD pipeline, as `zydoc` runs Doxygen itself; as a solution,
`zydoc` could add support for a `--doxygen-generated <path>` flag that
tells it to use already generated Doxygen documentation instead of
generating its own.
  • Loading branch information
Tachi107 committed Oct 1, 2022
1 parent df27705 commit 6a70407
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,45 @@ if (ZYDIS_BUILD_TOOLS AND NOT ZYAN_NO_LIBC)
endif ()
endif ()

# =============================================================================================== #
# Doxygen documentation #
# =============================================================================================== #
find_package(Doxygen)
if (DOXYGEN_FOUND)
find_file(DOXYGEN_AWESOME_CSS
"doxygen-awesome.css"
PATHS "." ".." "/usr/share"
PATH_SUFFIXES "doxygen-awesome-css"
NO_DEFAULT_PATH
)
find_file(DOXYGEN_AWESOME_SIDEBAR_ONLY_CSS
"doxygen-awesome-sidebar-only.css"
PATHS "." ".." "/usr/share"
PATH_SUFFIXES "doxygen-awesome-css"
NO_DEFAULT_PATH
)

set(DOXYGEN_JAVADOC_AUTOBRIEF YES)
set(DOXYGEN_QT_AUTOBRIEF YES)
set(DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES)
set(DOXYGEN_TOC_INCLUDE_HEADINGS 0)
set(DOXYGEN_EXTRACT_LOCAL_CLASSES NO)
set(DOXYGEN_HIDE_SCOPE_NAMES YES)
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE "README.md")
set(DOXYGEN_GENERATE_TREEVIEW YES)
set(DOXYGEN_DISABLE_INDEX NO)
set(DOXYGEN_FULL_SIDEBAR NO)
set(DOXYGEN_HTML_EXTRA_STYLESHEET "${DOXYGEN_AWESOME_CSS}" "${DOXYGEN_AWESOME_SIDEBAR_ONLY_CSS}")

doxygen_add_docs(doc "./include" "./README.md" "./files.dox" ALL)

install(
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html/"
DESTINATION "${CMAKE_INSTALL_DOCDIR}/api"
COMPONENT Documentation
)
endif()

# =============================================================================================== #
# Manpages #
# =============================================================================================== #
Expand Down

0 comments on commit 6a70407

Please sign in to comment.