build: Switch to using FindFulkanHeaders
Vulkan-Headers was a submodule, and is now an external dependency.
Switch repo to use the external location and disconnected the
submodule.
diff --git a/scripts/object_tracker_generator.py b/scripts/object_tracker_generator.py
index 8d4b68a..6bcfbcb 100644
--- a/scripts/object_tracker_generator.py
+++ b/scripts/object_tracker_generator.py
@@ -85,7 +85,8 @@
indentFuncProto = True,
indentFuncPointer = False,
alignFuncParam = 0,
- expandEnumerants = True):
+ expandEnumerants = True,
+ valid_usage_path = ''):
GeneratorOptions.__init__(self, filename, directory, apiname, profile,
versions, emitversions, defaultExtensions,
addExtensions, removeExtensions, emitExtensions, sortProcedure)
@@ -100,6 +101,7 @@
self.indentFuncPointer = indentFuncPointer
self.alignFuncParam = alignFuncParam
self.expandEnumerants = expandEnumerants
+ self.valid_usage_path = valid_usage_path
# ObjectTrackerOutputGenerator - subclass of OutputGenerator.
@@ -254,26 +256,6 @@
self.object_types = [] # List of all handle types
self.valid_vuids = set() # Set of all valid VUIDs
self.vuid_dict = dict() # VUID dictionary (from JSON)
- # Cover cases where file is built from scripts directory, Lin/Win, or Android build structure
- # Set cwd to the script directory to more easily locate the header.
- previous_dir = os.getcwd()
- os.chdir(os.path.dirname(sys.argv[0]))
- vuid_filename_locations = [
- './Vulkan-Headers/registry/validusage.json',
- '../Vulkan-Headers/registry/validusage.json',
- '../../Vulkan-Headers/registry/validusage.json',
- '../../../Vulkan-Headers/registry/validusage.json'
- ]
- for vuid_filename in vuid_filename_locations:
- if os.path.isfile(vuid_filename):
- json_file = open(vuid_filename, 'r')
- self.vuid_dict = json.load(json_file)
- json_file.close()
- break
- if len(self.vuid_dict) == 0:
- print("Error: Could not find, or error loading validusage.json")
- sys.exit(1)
- os.chdir(previous_dir)
#
# Check if the parameter passed in is optional
def paramIsOptional(self, param):
@@ -381,6 +363,17 @@
# Called at beginning of processing as file is opened
def beginFile(self, genOpts):
OutputGenerator.beginFile(self, genOpts)
+
+ self.valid_usage_path = genOpts.valid_usage_path
+ vu_json_filename = os.path.join(self.valid_usage_path + os.sep, 'validusage.json')
+ if os.path.isfile(vu_json_filename):
+ json_file = open(vu_json_filename, 'r')
+ self.vuid_dict = json.load(json_file)
+ json_file.close()
+ if len(self.vuid_dict) == 0:
+ print("Error: Could not find, or error loading %s/validusage.json\n", vu_json_filename)
+ sys.exit(1)
+
# Build a set of all vuid text strings found in validusage.json
for json_vuid_string in self.ExtractVUIDs(self.vuid_dict):
self.valid_vuids.add(json_vuid_string)