etnaviv: isa: Drop capturing of python output
Is nicer for meson. Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28875>
This commit is contained in:
committed by
Marge Bot
parent
85deb9f706
commit
8c2a749f67
@@ -30,6 +30,7 @@ enum PACKED ${prefix}_${name} {
|
||||
#endif
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import sys, os
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../../compiler/isaspec")
|
||||
|
||||
@@ -37,7 +38,14 @@ from mako.template import Template
|
||||
from isa import ISA
|
||||
|
||||
def main():
|
||||
isa = ISA(sys.argv[1])
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--xml', required=True, type=str, action="store",
|
||||
help='source isaspec xml file')
|
||||
parser.add_argument('--output', required=True, type=str, action="store",
|
||||
help='output C header file')
|
||||
args = parser.parse_args()
|
||||
|
||||
isa = ISA(args.xml)
|
||||
prefix = 'isa'
|
||||
enums = {}
|
||||
|
||||
@@ -65,7 +73,8 @@ def main():
|
||||
opc = dict(sorted(opc.items(), key=lambda item: int(item[1])))
|
||||
enums['opc'] = opc
|
||||
|
||||
print(Template(template).render(prefix=prefix, enums=enums))
|
||||
with open(args.output, "w", encoding="UTF-8") as fh:
|
||||
fh.write(Template(template).render(prefix=prefix, enums=enums))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -47,13 +47,13 @@ idep_libetnaviv_decode = declare_dependency(
|
||||
sources : [etnaviv_isa],
|
||||
)
|
||||
|
||||
prog_enums_h = files('enums.h.py')
|
||||
enums_h = custom_target(
|
||||
'enums.h',
|
||||
input: ['enums.h.py', 'etnaviv.xml'],
|
||||
input: 'etnaviv.xml',
|
||||
output: 'enums.h',
|
||||
command: [prog_python, '@INPUT@'],
|
||||
capture: true,
|
||||
depend_files: isa_depend_files,
|
||||
command: [prog_python, prog_enums_h, '--xml', '@INPUT@', '--output', '@OUTPUT@'],
|
||||
depend_files: [isa_depend_files, prog_enums_h],
|
||||
)
|
||||
|
||||
encode_h = custom_target(
|
||||
|
||||
Reference in New Issue
Block a user