anv,vulkan: Move anv_icd.py to a common location
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 30 Jan 2021 16:08:37 +0000 (10:08 -0600)
committerMarge Bot <eric+marge@anholt.net>
Thu, 4 Feb 2021 20:02:12 +0000 (20:02 +0000)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8792>

src/intel/vulkan/anv_icd.py [deleted file]
src/intel/vulkan/meson.build
src/vulkan/util/meson.build
src/vulkan/util/vk_icd_gen.py [new file with mode: 0644]

diff --git a/src/intel/vulkan/anv_icd.py b/src/intel/vulkan/anv_icd.py
deleted file mode 100644 (file)
index d5401e8..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-# Copyright 2017 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sub license, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice (including the
-# next paragraph) shall be included in all copies or substantial portions
-# of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
-# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import argparse
-import json
-import os.path
-import re
-import xml.etree.ElementTree as et
-
-def get_xml_patch_version(xml_file):
-    xml = et.parse(xml_file)
-    for d in xml.findall('.types/type'):
-        if d.get('category', None) != 'define':
-            continue
-
-        name = d.find('.name')
-        if name.text != 'VK_HEADER_VERSION':
-            continue;
-
-        return name.tail.strip()
-
-if __name__ == '__main__':
-    parser = argparse.ArgumentParser()
-    parser.add_argument('--api-version', required=True,
-                        help='Vulkan API version.')
-    parser.add_argument('--xml', required=False,
-                        help='Vulkan registry XML for patch version')
-    parser.add_argument('--lib-path', required=True,
-                        help='Path to installed library')
-    parser.add_argument('--out', required=False,
-                        help='Output json file.')
-    args = parser.parse_args()
-
-    version = args.api_version
-    if args.xml:
-        re.match(r'\d+\.\d+', version)
-        version = version + '.' + get_xml_patch_version(args.xml)
-    else:
-        re.match(r'\d+\.\d+\.\d+', version)
-
-    json_data = {
-        'file_format_version': '1.0.0',
-        'ICD': {
-            'library_path': args.lib_path,
-            'api_version': version,
-        },
-    }
-
-    json_params = {
-        'indent': 4,
-        'sort_keys': True,
-        'separators': (',', ': '),
-    }
-
-    if args.out:
-        with open(args.out, 'w') as f:
-            json.dump(json_data, f, **json_params)
-    else:
-        print(json.dumps(json_data, **json_params))
index 686438064e3ded17b6cd94ea1bb3dd9559a3d301..d3d72d5a15a2e89a40bc90b3e74b44d3bb319843 100644 (file)
@@ -58,7 +58,7 @@ anv_extensions_h = custom_target(
 
 intel_icd = custom_target(
   'intel_icd',
-  input : ['anv_icd.py', vk_api_xml],
+  input : [vk_icd_gen, vk_api_xml],
   output : 'intel_icd.@0@.json'.format(host_machine.cpu()),
   command : [
     prog_python, '@INPUT0@',
index 842c61675e73e408cff41a5e91ed595ad67ebc05..20cc60529549c420a18c77f5a3c00cd8457f4439 100644 (file)
@@ -20,6 +20,7 @@
 
 vk_entrypoints_gen = files('vk_entrypoints_gen.py')
 vk_extensions_gen = files('vk_extensions_gen.py')
+vk_icd_gen = files('vk_icd_gen.py')
 
 files_vulkan_util = files(
   'vk_alloc.h',
diff --git a/src/vulkan/util/vk_icd_gen.py b/src/vulkan/util/vk_icd_gen.py
new file mode 100644 (file)
index 0000000..d5401e8
--- /dev/null
@@ -0,0 +1,78 @@
+# Copyright 2017 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sub license, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice (including the
+# next paragraph) shall be included in all copies or substantial portions
+# of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+import argparse
+import json
+import os.path
+import re
+import xml.etree.ElementTree as et
+
+def get_xml_patch_version(xml_file):
+    xml = et.parse(xml_file)
+    for d in xml.findall('.types/type'):
+        if d.get('category', None) != 'define':
+            continue
+
+        name = d.find('.name')
+        if name.text != 'VK_HEADER_VERSION':
+            continue;
+
+        return name.tail.strip()
+
+if __name__ == '__main__':
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--api-version', required=True,
+                        help='Vulkan API version.')
+    parser.add_argument('--xml', required=False,
+                        help='Vulkan registry XML for patch version')
+    parser.add_argument('--lib-path', required=True,
+                        help='Path to installed library')
+    parser.add_argument('--out', required=False,
+                        help='Output json file.')
+    args = parser.parse_args()
+
+    version = args.api_version
+    if args.xml:
+        re.match(r'\d+\.\d+', version)
+        version = version + '.' + get_xml_patch_version(args.xml)
+    else:
+        re.match(r'\d+\.\d+\.\d+', version)
+
+    json_data = {
+        'file_format_version': '1.0.0',
+        'ICD': {
+            'library_path': args.lib_path,
+            'api_version': version,
+        },
+    }
+
+    json_params = {
+        'indent': 4,
+        'sort_keys': True,
+        'separators': (',', ': '),
+    }
+
+    if args.out:
+        with open(args.out, 'w') as f:
+            json.dump(json_data, f, **json_params)
+    else:
+        print(json.dumps(json_data, **json_params))