[Mesa-dev] [RESEND v4 10/16] anv: Generate anv_entrypoints header and code in one command
Dylan Baker
dylan at pnwbakers.com
Tue Mar 7 21:14:51 UTC 2017
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 <dylanx.c.baker at intel.com>
---
src/intel/vulkan/Android.mk | 5 ++++-
src/intel/vulkan/Makefile.am | 6 ++----
src/intel/vulkan/anv_entrypoints_gen.py | 19 ++++++++-----------
3 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/src/intel/vulkan/Android.mk b/src/intel/vulkan/Android.mk
index 8fc7924..43bceec 100644
--- a/src/intel/vulkan/Android.mk
+++ b/src/intel/vulkan/Android.mk
@@ -182,7 +182,10 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \
LOCAL_GENERATED_SOURCES += $(intermediates)/anv_entrypoints.c
$(intermediates)/anv_entrypoints.c:
- $(VK_ENTRYPOINTS_SCRIPT) code $@ --xml $(MESA_TOP)/src/vulkan/registry/vk.xml
+ $(VK_ENTRYPOINTS_SCRIPT) \
+ --xml $(MESA_TOP)/src/vulkan/registry/vk.xml \
+ --outdir $(intermediates)
+$(intermediates)/anv_entrypoints.h: $(intermediates)/anv_entrypoints.c
LOCAL_SHARED_LIBRARIES := libdrm_intel
diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am
index cd841ba..1bfbeaa 100644
--- a/src/intel/vulkan/Makefile.am
+++ b/src/intel/vulkan/Makefile.am
@@ -146,13 +146,11 @@ libvulkan_intel_la_SOURCES = $(VULKAN_GEM_FILES)
vulkan_api_xml = $(top_srcdir)/src/vulkan/registry/vk.xml
-anv_entrypoints.h: anv_entrypoints_gen.py $(vulkan_api_xml)
- $(AM_V_GEN)$(PYTHON2) $(srcdir)/anv_entrypoints_gen.py \
- --xml $(vulkan_api_xml) header $@
anv_entrypoints.c: anv_entrypoints_gen.py $(vulkan_api_xml)
$(AM_V_GEN)$(PYTHON2) $(srcdir)/anv_entrypoints_gen.py \
- --xml $(vulkan_api_xml) code $@
+ --xml $(vulkan_api_xml) --outdir $(builddir)
+anv_entrypoints.h: anv_entrypoints.c
BUILT_SOURCES = $(VULKAN_GENERATED_FILES)
CLEANFILES = $(BUILT_SOURCES) dev_icd.json intel_icd. at host_cpu@.json
diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py
index 47dc44b..895ec94 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__':
--
git-series 0.9.1
More information about the mesa-dev
mailing list