<div dir="ltr">Thanks!<br><div><br>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 28, 2017 at 10:56 AM, Emil Velikov <span dir="ltr"><<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Emil Velikov <<a href="mailto:emil.velikov@collabora.com">emil.velikov@collabora.com</a>><br>
<br>
Do not hardcode the file in the python script, but pass it via the build<br>
system(s). The former is the only one that should know about the file<br>
locaiton/tree structure.<br>
<br>
Cc: Dylan Baker <<a href="mailto:dylan@pnwbakers.com">dylan@pnwbakers.com</a>><br>
Signed-off-by: Emil Velikov <<a href="mailto:emil.velikov@collabora.com">emil.velikov@collabora.com</a>><br>
---<br>
src/vulkan/Android.mk | 2 +-<br>
src/vulkan/Makefile.am | 2 +-<br>
src/vulkan/util/gen_enum_to_<wbr>str.py | 5 ++---<br>
3 files changed, 4 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/src/vulkan/Android.mk b/src/vulkan/Android.mk<br>
index 0825c1ac10..9f71d8ff8f 100644<br>
--- a/src/vulkan/Android.mk<br>
+++ b/src/vulkan/Android.mk<br>
@@ -45,7 +45,7 @@ vulkan_api_xml = $(MESA_TOP)/src/vulkan/<wbr>registry/vk.xml<br>
$(LOCAL_GENERATED_SOURCES): $(MESA_TOP)/src/vulkan/util/<wbr>gen_enum_to_str.py $(vulkan_api_xml)<br>
@echo "target Generated: $(PRIVATE_MODULE) <= $(notdir $(@))"<br>
@mkdir -p $(dir $@)<br>
- $(hide) $(MESA_PYTHON2) $(MESA_TOP)/src/vulkan/util/<wbr>gen_enum_to_str.py --outdir $(intermediates)/util<br>
+ $(hide) $(MESA_PYTHON2) $(MESA_TOP)/src/vulkan/util/<wbr>gen_enum_to_str.py --xml $(vulkan_api_xml) --outdir $(intermediates)/util<br>
<br>
LOCAL_EXPORT_C_INCLUDE_DIRS := \<br>
$(intermediates)<br>
diff --git a/src/vulkan/Makefile.am b/src/vulkan/Makefile.am<br>
index e28a81c8cf..f7aca8e937 100644<br>
--- a/src/vulkan/Makefile.am<br>
+++ b/src/vulkan/Makefile.am<br>
@@ -16,7 +16,7 @@ BUILT_SOURCES = \<br>
<br>
util/vk_enum_to_str.c util/vk_enum_to_str.h: util/gen_enum_to_str.py $(vulkan_api_xml)<br>
$(MKDIR_GEN)<br>
- $(PYTHON_GEN) $(srcdir)/util/gen_enum_to_<wbr>str.py --outdir $(top_builddir)/src/vulkan/<wbr>util<br>
+ $(PYTHON_GEN) $(srcdir)/util/gen_enum_to_<wbr>str.py --xml $(vulkan_api_xml) --outdir $(top_builddir)/src/vulkan/<wbr>util<br>
<br>
libvulkan_util_la_SOURCES = $(VULKAN_UTIL_GENERATED_FILES)<br>
<br>
diff --git a/src/vulkan/util/gen_enum_to_<wbr>str.py b/src/vulkan/util/gen_enum_to_<wbr>str.py<br>
index 8c11569b6a..fb31addf94 100644<br>
--- a/src/vulkan/util/gen_enum_to_<wbr>str.py<br>
+++ b/src/vulkan/util/gen_enum_to_<wbr>str.py<br>
@@ -29,8 +29,6 @@ import xml.etree.cElementTree as et<br>
<br>
from mako.template import Template<br>
<br>
-VK_XML = os.path.join(os.path.dirname(_<wbr>_file__), '..', 'registry', 'vk.xml')<br>
-<br>
COPYRIGHT = textwrap.dedent(u"""\<br>
* Copyright © 2017 Intel Corporation<br>
*<br>
@@ -160,13 +158,14 @@ def xml_parser(filename):<br>
<br>
def main():<br>
parser = argparse.ArgumentParser()<br>
+ parser.add_argument('--xml', help='Vulkan API XML file.', required=True)<br>
parser.add_argument('--outdir'<wbr>,<br>
help='Directory to put the generated files in',<br>
required=True)<br>
<br>
args = parser.parse_args()<br>
<br>
- enums = xml_parser(VK_XML)<br>
+ enums = xml_parser(args.xml)<br>
for template, file_ in [(C_TEMPLATE, os.path.join(args.outdir, 'vk_enum_to_str.c')),<br>
(H_TEMPLATE, os.path.join(args.outdir, 'vk_enum_to_str.h'))]:<br>
with open(file_, 'wb') as f:<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.1<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>