aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2025-01-26 15:50:22 +0100
committerGitHub <noreply@github.com>2025-01-26 15:50:22 +0100
commit1fd10cb16ff7e63583eb2def44d5a174ccc14bcb (patch)
treeb104c0bf0db9338632cb84cc0c0eeea17e7a3ec5
parentdb9ebdf24243572c190affde269b92725942ddd0 (diff)
parent926a41e417adb39083841c6de6f135217456e34c (diff)
Merge pull request #1204 from karl-zylinski/odin-bindgen-wasm
Make Odin bindings respect common vetting rules + easier to use WASM
-rw-r--r--bindgen/gen_odin.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/bindgen/gen_odin.py b/bindgen/gen_odin.py
index 42d58705..1d9bf82a 100644
--- a/bindgen/gen_odin.py
+++ b/bindgen/gen_odin.py
@@ -360,6 +360,8 @@ def gen_c_imports(inp, c_prefix, prefix):
linux_gl_libs = get_system_libs(prefix, 'linux', 'gl')
l( 'import "core:c"')
l( '')
+ l( '_ :: c')
+ l( '')
l( 'SOKOL_DEBUG :: #config(SOKOL_DEBUG, ODIN_DEBUG)')
l( '')
l(f'DEBUG :: #config(SOKOL_{module_name.upper()}_DEBUG, SOKOL_DEBUG)')
@@ -421,6 +423,9 @@ def gen_c_imports(inp, c_prefix, prefix):
l(f' when DEBUG {{ foreign import {clib_import} {{ "{clib_prefix}_linux_x64_gl_debug.a"{linux_gl_libs} }} }}')
l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_linux_x64_gl_release.a"{linux_gl_libs} }} }}')
l( ' }')
+ l( '} else when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {')
+ l(f' // Feed {clib_prefix}_wasm_gl_debug.a or {clib_prefix}_wasm_gl_release.a into emscripten compiler.')
+ l(f' foreign import {clib_import} {{ "env.o" }}')
l( '} else {')
l( ' #panic("This OS is currently not supported")')
l( '}')