From 8211e3e60d941ed62c4a0d22de3967a8ded7d805 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 3 Mar 2017 14:22:44 -0800 Subject: anv: Generate anv_entrypoints header and code in one command This produces the header and the code in one command, saving the need to call the same script twice, which parses the same XML file. Signed-off-by: Dylan Baker --- src/intel/vulkan/anv_entrypoints_gen.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/intel/vulkan') diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py index 47dc44b55dd..895ec949986 100644 --- a/src/intel/vulkan/anv_entrypoints_gen.py +++ b/src/intel/vulkan/anv_entrypoints_gen.py @@ -354,10 +354,9 @@ def gen_code(entrypoints): def main(): parser = argparse.ArgumentParser() - parser.add_argument('target', choices=['header', 'code'], - help='Which file to generate.') - parser.add_argument('file', help='Where to write the file.') - parser.add_argument('--xml', help='Vulkan API XML file.') + parser.add_argument('--outdir', help='Where to write the files.', + required=True) + parser.add_argument('--xml', help='Vulkan API XML file.', required=True) args = parser.parse_args() doc = et.parse(args.xml) @@ -375,13 +374,11 @@ def main(): # For outputting entrypoints.h we generate a anv_EntryPoint() prototype # per entry point. - if args.target == 'header': - with open(args.file, 'wb') as f: - f.write(TEMPLATE_H.render(entrypoints=entrypoints, - filename=os.path.basename(__file__))) - else: - with open(args.file, 'wb') as f: - f.write(gen_code(entrypoints)) + with open(os.path.join(args.outdir, 'anv_entrypoints.h'), 'wb') as f: + f.write(TEMPLATE_H.render(entrypoints=entrypoints, + filename=os.path.basename(__file__))) + with open(os.path.join(args.outdir, 'anv_entrypoints.c'), 'wb') as f: + f.write(gen_code(entrypoints)) if __name__ == '__main__': -- cgit v1.2.3