-
Notifications
You must be signed in to change notification settings - Fork 456
Extending Glad
Glad supports a basic plugin API using setuptools entry points.
Currently two entry points are supported:
Glad uses these entrpoints as well and exposes builtin language backends and
specifications this way. See setup.py
for examples.
To add additional specifications extend the glad.specifications
entry point with
a glad.parse.Specification
class, usually inheriting from glad.parse.Specification
and overriding the glad.parse.Specification.DISPLAY_NAME
,
glad.parse.Specification.API
and glad.parse.Specification.NAME
static variables is enough.
E.g. the OpenGL specification:
class GL(Specification):
DISPLAY_NAME = 'OpenGL'
API = 'https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/master/xml/'
NAME = 'gl'
Add a generator class to the glad.language
entry point to add an additional language.
A language is (for now) just a generator which accepts a feautre set and turns it
into code. The builtin glad.language.generator.BaseGenerator
uses
Jinja2 to generate code.