瀏覽代碼

doc: Fix passing of build macros to Doxygen

Regression in fbb54184ef006ae6644d0b52878414ec0b2af652, the dictionary
passed to generate_doxygen function was still the project_description
structure.
Angus Gratton 5 年之前
父節點
當前提交
2b270bccbf
共有 2 個文件被更改,包括 8 次插入22 次删除
  1. 5 1
      docs/conf_common.py
  2. 3 21
      docs/idf_extensions/run_doxygen.py

+ 5 - 1
docs/conf_common.py

@@ -58,6 +58,10 @@ extensions = ['breathe',
               'extensions.toctree_filter',
               'extensions.list_filter',
 
+              # Note: order is important here, events must
+              # be registered by one extension before they can be
+              # connected to another extension
+
               'idf_extensions.include_build_file',
               'idf_extensions.link_roles',
               'idf_extensions.build_system',
@@ -65,11 +69,11 @@ extensions = ['breathe',
               'idf_extensions.gen_toolchain_links',
               'idf_extensions.gen_version_specific_includes',
               'idf_extensions.kconfig_reference',
+              'idf_extensions.gen_defines',
               'idf_extensions.run_doxygen',
               'idf_extensions.gen_idf_tools_links',
               'idf_extensions.format_idf_target',
               'idf_extensions.latex_builder',
-              'idf_extensions.gen_defines',
               'idf_extensions.exclude_docs',
 
               # from https://github.com/pfalcon/sphinx_selective_exclude

+ 3 - 21
docs/idf_extensions/run_doxygen.py

@@ -21,27 +21,9 @@ ALL_KINDS = [
 
 
 def setup(app):
-    # The idf_build_system extension will emit this event once it
-    app.connect('idf-info', generate_doxygen)
-
-    return {'parallel_read_safe': True, 'parallel_write_safe': True, 'version': '0.1'}
-
-
-def _parse_defines(header_path, sdk_config_path):
-    defines = {}
-    # Note: we run C preprocessor here without any -I arguments (except "sdkconfig.h"), so assumption is
-    # that these headers are all self-contained and don't include any other headers
-    # not in the same directory
-    print("Reading macros from %s..." % (header_path))
-    processed_output = subprocess.check_output(["xtensa-esp32-elf-gcc", "-I", sdk_config_path,
-                                                "-dM", "-E", header_path]).decode()
-    for line in processed_output.split("\n"):
-        line = line.strip()
-        m = re.search("#define ([^ ]+) ?(.*)", line)
-        if m and not m.group(1).startswith("_"):
-            defines[m.group(1)] = m.group(2)
-
-    return defines
+    # The idf_build_system extension will emit this event once it has generated documentation macro definitions
+    app.connect('idf-defines-generated', generate_doxygen)
+    return {'parallel_read_safe': True, 'parallel_write_safe': True, 'version': '0.2'}
 
 
 def generate_doxygen(app, defines):