diff options
| author | Andre Weissflog <floooh@gmail.com> | 2021-01-03 15:10:16 +0100 |
|---|---|---|
| committer | Andre Weissflog <floooh@gmail.com> | 2021-01-03 15:10:16 +0100 |
| commit | 5894182dddc2e0fd6531e5a2deb5d9cf7662ea2a (patch) | |
| tree | 4edebae434a29dacbc1f8620a0cf93835e722f4c /bindgen | |
| parent | 2fda9c9d3875760e2c722668d33b312cc84e2b12 (diff) | |
bindgen: build zig-bindings with SOKOL_ZIG_BINDINGS define
Diffstat (limited to 'bindgen')
| -rw-r--r-- | bindgen/gen_all.py | 2 | ||||
| -rw-r--r-- | bindgen/gen_ir.py | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/bindgen/gen_all.py b/bindgen/gen_all.py index 17929af6..0cbaa5ca 100644 --- a/bindgen/gen_all.py +++ b/bindgen/gen_all.py @@ -15,5 +15,5 @@ for task in tasks: c_prefix = task[1] module_name = task[2] print(f' {c_header_path} => {module_name}.zig') - ir = gen_ir.gen(c_header_path, module_name, c_prefix) + ir = gen_ir.gen(c_header_path, module_name, c_prefix, ["-DSOKOL_ZIG_BINDINGS"]) gen_zig.gen(c_header_path, ir) diff --git a/bindgen/gen_ir.py b/bindgen/gen_ir.py index 165da199..7e026add 100644 --- a/bindgen/gen_ir.py +++ b/bindgen/gen_ir.py @@ -85,11 +85,14 @@ def parse_decl(decl): else: return None -def clang(header_path): - return subprocess.check_output(['clang', '-Xclang', '-ast-dump=json', header_path]) +def clang(header_path, additional_options): + cmd = ['clang', '-Xclang', '-ast-dump=json' ] + cmd.extend(additional_options) + cmd.append(header_path) + return subprocess.check_output(cmd) -def gen(header_path, module, prefix): - ast = clang(header_path) +def gen(header_path, module, prefix, clang_options): + ast = clang(header_path, clang_options) inp = json.loads(ast) outp = {} outp['module'] = module |