mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 18:46:18 +00:00
scripts: Move add_defined above extension list
This commit is contained in:
parent
f31ff82e44
commit
a5923a5d4d
|
@ -5,6 +5,28 @@
|
|||
|
||||
from pathlib import Path
|
||||
|
||||
def _add_defined(s):
|
||||
if "defined" in s:
|
||||
return s
|
||||
return "defined({})".format(s)
|
||||
|
||||
def or_(*args):
|
||||
"""
|
||||
Create an "OR" in the definition condition list.
|
||||
|
||||
Takes any number of strings directly or through e.g. "not_".
|
||||
"""
|
||||
return "({})".format(" || ".join(_add_defined(s) for s in args))
|
||||
|
||||
|
||||
def not_(s):
|
||||
"""
|
||||
Create a "NOT" in the condition list.
|
||||
|
||||
Takes a single string, directly or through e.g. "or_".
|
||||
"""
|
||||
return "(!{})".format(_add_defined(s))
|
||||
|
||||
# Each extension that we implement gets an entry in this tuple.
|
||||
# Each entry should be a list of defines that are checked for an extension:
|
||||
# the first one must be the name of the extension itself.
|
||||
|
@ -42,30 +64,6 @@ EXTENSIONS = (
|
|||
)
|
||||
|
||||
|
||||
def or_(*args):
|
||||
"""
|
||||
Create an "OR" in the definition condition list.
|
||||
|
||||
Takes any number of strings directly or through e.g. "not_".
|
||||
"""
|
||||
return "({})".format(" || ".join(_add_defined(s) for s in args))
|
||||
|
||||
|
||||
def not_(s):
|
||||
"""
|
||||
Create a "NOT" in the condition list.
|
||||
|
||||
Takes a single string, directly or through e.g. "or_".
|
||||
"""
|
||||
return "(!{})".format(_add_defined(s))
|
||||
|
||||
|
||||
def _add_defined(s):
|
||||
if "defined" in s:
|
||||
return s
|
||||
return "defined({})".format(s)
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
FN = ROOT / 'src' / 'xrt'/'state_trackers' / 'oxr' / 'oxr_extension_support.h'
|
||||
|
||||
|
|
Loading…
Reference in a new issue