Skip to content

Commit 6a70407

Browse files
committed
build: add doc target
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.
1 parent df27705 commit 6a70407

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

CMakeLists.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,45 @@ if (ZYDIS_BUILD_TOOLS AND NOT ZYAN_NO_LIBC)
440440
endif ()
441441
endif ()
442442

443+
# =============================================================================================== #
444+
# Doxygen documentation #
445+
# =============================================================================================== #
446+
find_package(Doxygen)
447+
if (DOXYGEN_FOUND)
448+
find_file(DOXYGEN_AWESOME_CSS
449+
"doxygen-awesome.css"
450+
PATHS "." ".." "/usr/share"
451+
PATH_SUFFIXES "doxygen-awesome-css"
452+
NO_DEFAULT_PATH
453+
)
454+
find_file(DOXYGEN_AWESOME_SIDEBAR_ONLY_CSS
455+
"doxygen-awesome-sidebar-only.css"
456+
PATHS "." ".." "/usr/share"
457+
PATH_SUFFIXES "doxygen-awesome-css"
458+
NO_DEFAULT_PATH
459+
)
460+
461+
set(DOXYGEN_JAVADOC_AUTOBRIEF YES)
462+
set(DOXYGEN_QT_AUTOBRIEF YES)
463+
set(DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES)
464+
set(DOXYGEN_TOC_INCLUDE_HEADINGS 0)
465+
set(DOXYGEN_EXTRACT_LOCAL_CLASSES NO)
466+
set(DOXYGEN_HIDE_SCOPE_NAMES YES)
467+
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE "README.md")
468+
set(DOXYGEN_GENERATE_TREEVIEW YES)
469+
set(DOXYGEN_DISABLE_INDEX NO)
470+
set(DOXYGEN_FULL_SIDEBAR NO)
471+
set(DOXYGEN_HTML_EXTRA_STYLESHEET "${DOXYGEN_AWESOME_CSS}" "${DOXYGEN_AWESOME_SIDEBAR_ONLY_CSS}")
472+
473+
doxygen_add_docs(doc "./include" "./README.md" "./files.dox" ALL)
474+
475+
install(
476+
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html/"
477+
DESTINATION "${CMAKE_INSTALL_DOCDIR}/api"
478+
COMPONENT Documentation
479+
)
480+
endif()
481+
443482
# =============================================================================================== #
444483
# Manpages #
445484
# =============================================================================================== #

0 commit comments

Comments
 (0)