3
# Copyright © 2021 Intel Corporation
5
# Permission is hereby granted, free of charge, to any person obtaining a
6
# copy of this software and associated documentation files (the
7
# "Software"), to deal in the Software without restriction, including
8
# without limitation the rights to use, copy, modify, merge, publish,
9
# distribute, sub license, and/or sell copies of the Software, and to
10
# permit persons to whom the Software is furnished to do so, subject to
11
# the following conditions:
13
# The above copyright notice and this permission notice (including the
14
# next paragraph) shall be included in all copies or substantial portions
17
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20
# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
21
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
from mako.template import Template
32
'src/compiler/nir/nir.h',
37
TEMPLATE_DOXYFILE = Template("""
39
DOXYFILE_ENCODING = UTF-8
42
INPUT = ${' '.join(input_files)}
43
XML_OUTPUT = ${output_xml}
50
# Add aliases for easily writing reStructuredText in comments
51
ALIASES = "rst=\\verbatim embed:rst:leading-asterisk"
52
ALIASES += "endrst=\endverbatim"
54
ENABLE_PREPROCESSING = YES
56
EXPAND_ONLY_PREDEF = YES
58
# Defines required to keep doxygen from tripping on our attribute macros
60
PREDEFINED += ATTRIBUTE_CONST=
61
PREDEFINED += MUST_CHECK=
64
def run_doxygen(output_path, input_paths=[]):
65
doxyfile = tempfile.NamedTemporaryFile(mode='w', delete=False)
67
doxyfile.write(TEMPLATE_DOXYFILE.render(
68
input_files=[ os.path.abspath(i) for i in input_paths ],
69
output_xml=os.path.abspath(output_path),
73
subprocess.run(['doxygen', doxyfile.name])
77
os.unlink(doxyfile.name)
79
if __name__ == '__main__':
80
parser = argparse.ArgumentParser()
81
parser.add_argument('--out-dir',
82
help='Output XML directory.',
84
args = parser.parse_args()
86
this_dir = os.path.dirname(os.path.abspath(__file__))
87
mesa_dir = os.path.join(this_dir, '..')
91
return os.path.join(mesa_dir, p)
93
input_paths = [ fixpath(p) for p in INPUT_PATHS ]
95
run_doxygen(args.out_dir, input_paths)