···88# Each extension that we implement gets an entry in this tuple.
99# Each entry should be a list of defines that are checked for an extension:
1010# the first one must be the name of the extension itself.
1111+# The second and later items might be modified using or_() and not_().
1112# Keep sorted, KHR, EXT, Vendor, experimental (same order).
1213EXTENSIONS = (
1314 ['XR_KHR_android_create_instance', 'XR_USE_PLATFORM_ANDROID'],
···4041 ['XR_MNDX_force_feedback_curl'],
4142)
42434444+4545+def or_(*args):
4646+ """
4747+ Create an "OR" in the definition condition list.
4848+4949+ Takes any number of strings directly or through e.g. "not_".
5050+ """
5151+ return "({})".format(" || ".join(_add_defined(s) for s in args))
5252+5353+5454+def not_(s):
5555+ """
5656+ Create a "NOT" in the condition list.
5757+5858+ Takes a single string, directly or through e.g. "or_".
5959+ """
6060+ return "(!{})".format(_add_defined(s))
6161+6262+6363+def _add_defined(s):
6464+ if "defined" in s:
6565+ return s
6666+ return "defined({})".format(s)
6767+6868+4369ROOT = Path(__file__).resolve().parent.parent
4470FN = ROOT / 'src' / 'xrt'/'state_trackers' / 'oxr' / 'oxr_extension_support.h'
4571···6086 ext_name = data[0]
6187 trimmed_name = trim_ext_name(ext_name)
6288 upper_name = trimmed_name.upper()
6363- condition = " && ".join("defined({})".format(x) for x in data)
8989+ condition = " && ".join(_add_defined(x) for x in data)
64906591 parts.append(f"""
6692/*