# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
-"""Create enum to string functions for vulking using vk.xml."""
+"""Create enum to string functions for vulkan using vk.xml."""
from __future__ import print_function
+import argparse
import os
import textwrap
import xml.etree.cElementTree as et
from mako.template import Template
-VK_XML = os.path.join(os.path.dirname(__file__), '..', 'registry', 'vk.xml')
-
COPYRIGHT = textwrap.dedent(u"""\
* Copyright © 2017 Intel Corporation
*
def main():
- enums = xml_parser(VK_XML)
- for template, file_ in [(C_TEMPLATE, 'util/vk_enum_to_str.c'),
- (H_TEMPLATE, 'util/vk_enum_to_str.h')]:
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--xml', help='Vulkan API XML file.', required=True)
+ parser.add_argument('--outdir',
+ help='Directory to put the generated files in',
+ required=True)
+
+ args = parser.parse_args()
+
+ enums = xml_parser(args.xml)
+ for template, file_ in [(C_TEMPLATE, os.path.join(args.outdir, 'vk_enum_to_str.c')),
+ (H_TEMPLATE, os.path.join(args.outdir, 'vk_enum_to_str.h'))]:
with open(file_, 'wb') as f:
f.write(template.render(
file=os.path.basename(__file__),