From 4b92732a3b3cda651fb83e507fac3e21dcc5667e Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Sun, 12 Dec 2021 21:04:19 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=BE=D0=BA=D1=83?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 +- MyxCMake/functions/MyxCMakeDocBreathe.cmake | 78 ++++ MyxCMake/functions/MyxCMakeDocDoxygen.cmake | 55 +++ MyxCMake/functions/doc/Doxyfile.in | 383 ++++++++++++++++++++ MyxCMake/functions/doc/breathe-conf.py.in | 185 ++++++++++ MyxCMake/modules/MyxCMakeCommon.cmake | 5 +- 6 files changed, 704 insertions(+), 4 deletions(-) create mode 100644 MyxCMake/functions/MyxCMakeDocBreathe.cmake create mode 100644 MyxCMake/functions/MyxCMakeDocDoxygen.cmake create mode 100644 MyxCMake/functions/doc/Doxyfile.in create mode 100644 MyxCMake/functions/doc/breathe-conf.py.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 2456e94..2f3db2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.0) -project(myx-cmake VERSION 0.2.4 LANGUAGES) +project(myx-cmake VERSION 0.2.6 LANGUAGES) include(GNUInstallDirs) file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake diff --git a/MyxCMake/functions/MyxCMakeDocBreathe.cmake b/MyxCMake/functions/MyxCMakeDocBreathe.cmake new file mode 100644 index 0000000..b1964d9 --- /dev/null +++ b/MyxCMake/functions/MyxCMakeDocBreathe.cmake @@ -0,0 +1,78 @@ +set(BREATHE_FOUND AUTO CACHE STRING "Enable Breathe documentation generator") +set_property(CACHE BREATHE_FOUND PROPERTY STRINGS ON OFF AUTO) + +find_package(Doxygen) +find_package(Perl) +set(Python_ADDITIONAL_VERSIONS 3.9;3.8;3.7;3.6;3.5;3.4;3.3;3.2) +find_package(PythonInterp) +if(PYTHONINTERP_FOUND) + find_package(Sphinx) + include(FindPythonModule) + find_python_module(breathe) + find_python_module(recommonmark) + if(DOXYGEN_FOUND + AND PERL_FOUND + AND PYTHONINTERP_FOUND + AND SPHINX_EXECUTABLE + AND breathe + AND recommonmark) + set(BREATHE_FOUND ON CACHE STRING "Breathe documentation generator enabled" FORCE) + else() + set(BREATHE_FOUND OFF CACHE STRING "Breathe documentation generator disabled" FORCE) + endif() +else() + set(BREATHE_FOUND OFF CACHE STRING "Breathe documentation generator disabled" FORCE) +endif() + +function(myx_cmake_add_breathe_target target) + set(options) + set(oneValueArgs COMMENT) + set(multiValueArgs) + + cmake_parse_arguments(_BREATHE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + if(BREATHE_FOUND) + set(WORK_DIR ${CMAKE_BINARY_DIR}/_breathe) + set(BREATHE_DOCS_BUILD_DIR ${WORK_DIR}) + set(GENERATE_XML YES) + set(GENERATE_HTML NO) + set(GENERATE_LATEX NO) + set(CONF_FILE ${CMLIB_MODULE_DIR}/doxygen/breathe-conf.py.in) + set(DOXY_FILE ${CMLIB_MODULE_DIR}/doxygen/Doxyfile.in) + + configure_file(${CONF_FILE} ${WORK_DIR}/conf.py @ONLY) + configure_file(${DOXY_FILE} ${WORK_DIR}/Doxyfile @ONLY) + + add_custom_target( + ${target} + VERBATIM + COMMAND ${SPHINX_EXECUTABLE} -q -b html -c ${WORK_DIR} -d ${WORK_DIR}/cache ${WORK_DIR} + ${CMAKE_BINARY_DIR}/doc/breathe + COMMENT "Building ${target} documentation with Breathe") + + set(INDEX_MD_FILE ${CMAKE_SOURCE_DIR}/doc/breathe/index.md.in) + if(EXISTS ${INDEX_MD_FILE}) + configure_file(${INDEX_MD_FILE} ${WORK_DIR}/index.md @ONLY) + file(GLOB MD_FILES ${CMAKE_SOURCE_DIR}/doc/breathe/*.md) + if(MD_FILES) + add_custom_command(TARGET ${target} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MD_FILES} ${WORK_DIR}) + endif() + endif() + + set(INDEX_RST_FILE ${CMAKE_SOURCE_DIR}/doc/breathe/index.rst.in) + if(EXISTS ${INDEX_RST_FILE}) + configure_file(${INDEX_RST_FILE} ${WORK_DIR}/index.rst @ONLY) + file(GLOB RST_FILES ${CMAKE_SOURCE_DIR}/doc/breathe/*.rst) + if(RST_FILES) + add_custom_command(TARGET ${target} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${RST_FILES} ${WORK_DIR}) + endif() + endif() + install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/breathe/ + COMPONENT doc OPTIONAL + DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/breathe) + else() + message(STATUS "CMLIB warning:") + add_custom_target(${target} VERBATIM COMMENT " Breathe is not found. Skipping target ${target} build") + endif() +endfunction() diff --git a/MyxCMake/functions/MyxCMakeDocDoxygen.cmake b/MyxCMake/functions/MyxCMakeDocDoxygen.cmake new file mode 100644 index 0000000..7eefe39 --- /dev/null +++ b/MyxCMake/functions/MyxCMakeDocDoxygen.cmake @@ -0,0 +1,55 @@ +function(myx_cmake_doc_doxygen) + set(DOXYGEN_FOUND AUTO CACHE STRING "Enable Doxygen documentation generator") + set_property(CACHE DOXYGEN_FOUND PROPERTY STRINGS ON OFF AUTO) + + find_package(Doxygen) + if(DOXYGEN_FOUND) + set(DOXYGEN_FOUND ON CACHE STRING "Doxygen documentation generator enabled" FORCE) + else() + set(DOXYGEN_FOUND OFF CACHE STRING "Doxygen documentation generator disabled" FORCE) + endif() + + set(_target "myx-cmake-doc-doxygen-${CMAKE_PROJECT_NAME}") + if(NOT DOXYGEN_FOUND) + message(STATUS "MyxCMake:") + add_custom_target(${_target} VERBATIM COMMENT " Doxygen is not found. Skipping target ${_target} build") + return() + endif() + + if(NOT TARGET ${_target}) + set(options) + set(oneValueArgs SQLITE LATEX HTML) + set(multiValueArgs) + cmake_parse_arguments(_arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + set(GENERATE_XML YES) + set(GENERATE_HTML NO) + set(GENERATE_LATEX NO) + if(_arg_HTML) + set(GENERATE_HTML YES) + endif() + if(_arg_LATEX) + set(GENERATE_LATEX YES) + endif() + if(_arg_SQLITE) + set(GENERATE_SQLITE YES) + endif() + + set(work_dir ${CMAKE_BINARY_DIR}/doc/doxygen) + configure_file(${MYX_CMAKE_FUNCTIONS_DIR}/doc/Doxyfile.in ${work_dir}/Doxyfile @ONLY) + + add_custom_target(${_target} + VERBATIM + WORKING_DIRECTORY ${work_dir} + COMMAND "${CMAKE_COMMAND}" -E remove -f "${work_dir}/doxygen_sqlite3.db" + COMMAND ${DOXYGEN_EXECUTABLE} ${work_dir}/Doxyfile + COMMENT "Generating API documentation with Doxygen") + if(_arg_HTML) + install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/doxygen/html/ + COMPONENT doc OPTIONAL + DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/doxygen) + endif() + else() + message(STATUS "MyxCMake: target ${_target} is already defined.") + endif() +endfunction() diff --git a/MyxCMake/functions/doc/Doxyfile.in b/MyxCMake/functions/doc/Doxyfile.in new file mode 100644 index 0000000..216efcd --- /dev/null +++ b/MyxCMake/functions/doc/Doxyfile.in @@ -0,0 +1,383 @@ +# Doxyfile 1.8.16 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = "@DOXYGEN_PROJECT_TITLE@" +PROJECT_NUMBER = +PROJECT_BRIEF = +PROJECT_LOGO = +OUTPUT_DIRECTORY = "@OUTPUT_DIRECTORY@" +CREATE_SUBDIRS = NO +ALLOW_UNICODE_NAMES = NO +OUTPUT_LANGUAGE = Russian +OUTPUT_TEXT_DIRECTION = None +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = "@CMAKE_HOME_DIRECTORY@/src" +STRIP_FROM_INC_PATH = "@CMAKE_HOME_DIRECTORY@/src" +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +JAVADOC_BANNER = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +ALIASES = +TCL_SUBST = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +OPTIMIZE_OUTPUT_SLICE = NO +EXTENSION_MAPPING = +MARKDOWN_SUPPORT = YES +TOC_INCLUDE_HEADINGS = 5 +AUTOLINK_SUPPORT = YES +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +GROUP_NESTED_COMPOUNDS = NO +SUBGROUPING = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO +LOOKUP_CACHE_SIZE = 0 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_PRIV_VIRTUAL = NO +EXTRACT_PACKAGE = NO +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = YES +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +HIDE_SCOPE_NAMES = NO +HIDE_COMPOUND_REFERENCE= NO +SHOW_INCLUDE_FILES = YES +SHOW_GROUPED_MEMB_INC = NO +FORCE_LOCAL_INCLUDES = NO +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +STRICT_PROTO_MATCHING = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_FILES = YES +SHOW_NAMESPACES = YES +FILE_VERSION_FILTER = +LAYOUT_FILE = +CITE_BIB_FILES = +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_AS_ERROR = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = "@CMAKE_HOME_DIRECTORY@/src" \ + "@CMAKE_HOME_DIRECTORY@/doc/doxygen" +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +FILTER_SOURCE_PATTERNS = +USE_MDFILE_AS_MAINPAGE = +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +SOURCE_TOOLTIPS = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +CLANG_ASSISTED_PARSING = NO +CLANG_OPTIONS = +CLANG_DATABASE_PATH = +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = @GENERATE_HTML@ +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_EXTRA_STYLESHEET = +HTML_EXTRA_FILES = +HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_GAMMA = 80 +HTML_TIMESTAMP = NO +HTML_DYNAMIC_MENUS = YES +HTML_DYNAMIC_SECTIONS = NO +HTML_INDEX_NUM_ENTRIES = 100 +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_NAME = Publisher +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +CHM_INDEX_ENCODING = +BINARY_TOC = NO +TOC_EXPAND = NO +GENERATE_QHP = NO +QCH_FILE = +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +QHP_CUST_FILTER_NAME = +QHP_CUST_FILTER_ATTRS = +QHP_SECT_FILTER_ATTRS = +QHG_LOCATION = +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project +DISABLE_INDEX = NO +GENERATE_TREEVIEW = YES +ENUM_VALUES_PER_LINE = 4 +TREEVIEW_WIDTH = 250 +EXT_LINKS_IN_WINDOW = NO +FORMULA_FONTSIZE = 10 +FORMULA_TRANSPARENT = YES +USE_MATHJAX = NO +MATHJAX_FORMAT = HTML-CSS +MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2 +MATHJAX_EXTENSIONS = +MATHJAX_CODEFILE = +SEARCHENGINE = YES +SERVER_BASED_SEARCH = NO +EXTERNAL_SEARCH = NO +SEARCHENGINE_URL = +SEARCHDATA_FILE = searchdata.xml +EXTERNAL_SEARCH_ID = +EXTRA_SEARCH_MAPPINGS = +#--------------------------------------------------------------------------- +# Configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = @GENERATE_LATEX@ +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +LATEX_MAKEINDEX_CMD = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4 +EXTRA_PACKAGES = +LATEX_HEADER = +LATEX_FOOTER = +LATEX_EXTRA_STYLESHEET = +LATEX_EXTRA_FILES = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +LATEX_SOURCE_CODE = NO +LATEX_BIB_STYLE = plain +LATEX_TIMESTAMP = NO +LATEX_EMOJI_DIRECTORY = +#--------------------------------------------------------------------------- +# Configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +RTF_SOURCE_CODE = NO +#--------------------------------------------------------------------------- +# Configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_SUBDIR = +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# Configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = @GENERATE_XML@ +XML_OUTPUT = xml +XML_PROGRAMLISTING = YES +XML_NS_MEMB_FILE_SCOPE = NO +#--------------------------------------------------------------------------- +# Configuration options related to the DOCBOOK output +#--------------------------------------------------------------------------- +GENERATE_DOCBOOK = NO +DOCBOOK_OUTPUT = docbook +DOCBOOK_PROGRAMLISTING = NO +#--------------------------------------------------------------------------- +# Configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# Configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration options related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +EXTERNAL_PAGES = YES +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +DIA_PATH = +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = YES +DOT_NUM_THREADS = 0 +DOT_FONTNAME = Helvetica +DOT_FONTSIZE = 10 +DOT_FONTPATH = +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = YES +UML_LIMIT_NUM_FIELDS = 10 +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = YES +CALLER_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +INTERACTIVE_SVG = YES +DOT_PATH = @DOXYGEN_DOT_PATH@ +DOTFILE_DIRS = +MSCFILE_DIRS = +DIAFILE_DIRS = +PLANTUML_JAR_PATH = +PLANTUML_CFG_FILE = +PLANTUML_INCLUDE_PATH = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES + diff --git a/MyxCMake/functions/doc/breathe-conf.py.in b/MyxCMake/functions/doc/breathe-conf.py.in new file mode 100644 index 0000000..d9c0848 --- /dev/null +++ b/MyxCMake/functions/doc/breathe-conf.py.in @@ -0,0 +1,185 @@ +#!@PYTHON_EXECUTABLE@ +# -*- coding: utf-8 -*- +# + +import os +import subprocess +import sys + +# -- General configuration ------------------------------------------------ + +# At top on conf.py (with other import statements) +import recommonmark +from recommonmark.parser import CommonMarkParser +from recommonmark.transform import AutoStructify +from recommonmark.states import DummyStateMachine +# Monkey patch to fix recommonmark 0.4 doc reference issues. +orig_run_role = DummyStateMachine.run_role +def run_role(self, name, options=None, content=None): + if name == 'doc': + name = 'any' + return orig_run_role(self, name, options, content) +DummyStateMachine.run_role = run_role + +source_parsers = { + '.md': CommonMarkParser +} + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'breathe', 'sphinx.ext.autosectionlabel', 'recommonmark' +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +source_suffix = ['.rst', '.md'] + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = '@DOXYGEN_PROJECT_TITLE@' +author = '@AUTHOR_NAME@' +copyright = '@CMLIB_YEAR@, ' + author + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '@PROJECT_VERSION@' +# The full version, including alpha/beta/rc tags. +release = '' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = ['_build', '_output', 'Thumbs.db', '.DS_Store'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = [] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# This is required for the alabaster theme +# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars +html_sidebars = { + '**': [ + 'relations.html', # needs 'show_related': True theme option to display + 'searchbox.html', + ] +} + +# -- Options for HTMLHelp output ------------------------------------------ + +# Output file base name for HTML help builder. +htmlhelp_basename = '@PROJECT_NAME@doc' + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, '@PROJECT_NAME@.tex', '@PROJECT_NAME@ Documentation', + author, 'manual'), +] + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [(master_doc, '@PROJECT_NAME@', '@PROJECT_NAME@ Documentation', [author], 1)] + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, '@PROJECT_NAME@', '@PROJECT_NAME@ Documentation', author, '@PROJECT_NAME@', + 'One line description of project.', 'Miscellaneous'), +] + +breathe_projects = {'@PROJECT_NAME@': '@BREATHE_DOCS_BUILD_DIR@/xml'} + + +def run_doxygen(folder): + """Run the doxygen make command in the designated folder""" + + try: + retcode = subprocess.call("cd {}; doxygen".format(folder), shell=True) + if retcode < 0: + sys.stderr.write( + "doxygen terminated by signal {}".format(-retcode)) + except OSError as e: + sys.stderr.write("doxygen execution failed: {}".format(e)) + + +def setup(app): + run_doxygen('@BREATHE_DOCS_BUILD_DIR@') + app.add_config_value('recommonmark_config', { + 'enable_auto_toc_tree': True, + 'enable_eval_rst': True, + 'enable_auto_doc_ref': True, + 'enable_math': True, + 'enable_inline_math': True + }, True) + app.add_transform(AutoStructify) diff --git a/MyxCMake/modules/MyxCMakeCommon.cmake b/MyxCMake/modules/MyxCMakeCommon.cmake index 3eb4095..f82ab6b 100644 --- a/MyxCMake/modules/MyxCMakeCommon.cmake +++ b/MyxCMake/modules/MyxCMakeCommon.cmake @@ -33,9 +33,8 @@ include(MyxCMakeAddSharedLibrary) include(MyxCMakeAddStaticLibrary) include(MyxCMakePkgConfig) include(MyxCMakeNinjaGeneratorHelper) - -# include(CMLibDocDoxygen) include(CMLibDocBreathe) - +include(CMLibDocDoxygen) +include(CMLibDocBreathe) include(MyxCMakeExternalProject) include(MyxCMakeCPack) include(MyxCMakeUninstall)