-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
MDEV-39718: Produce Markdown plugin API documentation #5112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # Copyright (c) 2026, MariaDB Corporation | ||
| # | ||
| # This program is free software; you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation; version 2 of the License. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, write to the Free Software | ||
| # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA | ||
|
|
||
| SET(WITH_PLUGIN_API_DOCS yes CACHE STRING "Produce the API docs") | ||
|
|
||
| # Produce plugin API docs. The docs are generated as part of the build, | ||
| # but only if WITH_PLUGIN_API_DOCS is set to yes. The docs are generated | ||
| # using doxygen and moxygen, and are output to the api_docs directory | ||
| # in the build directory. | ||
| # First doxygen is called to produce XML output into api_docs/xml, | ||
| # and then moxygen is called to produce markdown output into api_docs/md out | ||
| # of the XML output. | ||
|
|
||
| # Call with a list of sources, e.g. | ||
| # PLUGIN_API_DOCS_GENERATE(foo.h bar.h) | ||
|
|
||
| MACRO (PLUGIN_API_DOCS_GENERATE) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
| IF (NOT WITH_PLUGIN_API_DOCS) | ||
| RETURN() | ||
| ENDIF() | ||
| CMAKE_PARSE_ARGUMENTS(ARG | ||
| "" | ||
| "" | ||
| "" | ||
| ${ARGN} | ||
| ) | ||
| SET(SOURCES ${ARG_UNPARSED_ARGUMENTS}) | ||
| LIST(REMOVE_AT SOURCES 0) | ||
|
Comment on lines
+39
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line removes the first element from the |
||
| MESSAGE(STATUS "Will generate plugin API docs") | ||
|
|
||
| FIND_PACKAGE(Doxygen REQUIRED) | ||
| FIND_PROGRAM(MOXYGEN_BIN moxygen REQUIRED) | ||
|
|
||
| FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/api_docs) | ||
| FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/api_docs/md) | ||
|
|
||
| SET(DOXYGEN_FILE_PATTERNS *.h) | ||
| SET(DOXYGEN_GENERATE_HTML NO) | ||
| SET(DOXYGEN_WARN_IF_UNDOCUMENTED NO) | ||
| SET(DOXYGEN_GENERATE_XML YES) | ||
| SET(DOXYGEN_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) | ||
| SET(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/api_docs) | ||
| SET(DOXYGEN_WARN_AS_ERROR YES) | ||
| SET(DOXYGEN_EXTRACT_ALL YES) | ||
| SET(DOXYGEN_QUIET YES) | ||
| SET(DOXYGEN_XML_PROGRAMLISTING YES) | ||
| doxygen_add_docs(plugin_api ${SOURCES} ALL USE_STAMP_FILE COMMENT "Generating plugin API XML docs with doxygen") | ||
| ADD_CUSTOM_COMMAND(TARGET plugin_api POST_BUILD | ||
| COMMAND ${MOXYGEN_BIN} --quiet | ||
| --source-root ${CMAKE_SOURCE_DIR} | ||
| ${CMAKE_BINARY_DIR}/api_docs/xml | ||
| WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/api_docs/md | ||
| BYPRODUCTS ${CMAKE_BINARY_DIR}/api_docs/md/api.md | ||
| COMMENT "Generating plugin API docs with moxygen" | ||
| ) | ||
| ENDMACRO() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The option
WITH_PLUGIN_API_DOCSis defined as aSTRINGwith a default ofyes. It is more idiomatic in CMake to use theOPTION()command orSET(... CACHE BOOL ...)for boolean flags. Additionally, since this feature introduces new build-time dependencies (doxygenandmoxygen), it should ideally default toOFFto avoid breaking existing build environments that lack these tools by default.