aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakubtomsu <66876057+jakubtomsu@users.noreply.github.com>2024-04-10 12:51:12 +0200
committerGitHub <noreply@github.com>2024-04-10 12:51:12 +0200
commit3bed6ca78edeeb452ccd2d2caffa377444da5887 (patch)
treeb554ed30afd43560bc9a33defbb29e03532cb137
parent8d6892970c98f184c49a7e772783b99c41b6bbbb (diff)
Update the odin foreign imports and configs
-rw-r--r--bindgen/gen_odin.py53
1 files changed, 35 insertions, 18 deletions
diff --git a/bindgen/gen_odin.py b/bindgen/gen_odin.py
index 6ba84f3a..2d8cbeec 100644
--- a/bindgen/gen_odin.py
+++ b/bindgen/gen_odin.py
@@ -345,37 +345,54 @@ def gen_c_imports(inp, c_prefix, prefix):
macos_gl_libs = get_system_libs(prefix, 'macos', 'gl')
linux_gl_libs = get_system_libs(prefix, 'linux', 'gl')
l( 'import "core:c"')
+ l( '')
+ l( 'SOKOL_DEBUG :: #config(SOKOL_DEBUG, ODIN_DEBUG)')
+ l( 'SOKOL_USE_GL :: #config(SOKOL_USE_GL, false)')
+ l( 'SOKOL_DLL :: #config(SOKOL_DLL, false)')
+ l( '')
l( 'when ODIN_OS == .Windows {')
- l( ' when #config(SOKOL_USE_GL,false) {')
- l(f' when ODIN_DEBUG == true {{ foreign import {clib_import} {{ "{clib_prefix}_windows_x64_gl_debug.lib"{windows_gl_libs} }} }}')
- l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_windows_x64_gl_release.lib"{windows_gl_libs} }} }}')
+ l( ' when SOKOL_DLL {')
+ l( ' when SOKOL_USE_GL {')
+ l(f' when SOKOL_DEBUG {{ foreign import {clib_import} {{ "{clib_prefix}_dll_windows_x64_gl_debug.lib"{windows_gl_libs} }} }}')
+ l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_dll_windows_x64_gl_release.lib"{windows_gl_libs} }} }}')
+ l( ' } else {')
+ l(f' when SOKOL_DEBUG {{ foreign import {clib_import} {{ "{clib_prefix}_dll_windows_x64_d3d11_debug.lib"{windows_d3d11_libs} }} }}')
+ l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_dll_windows_x64_d3d11_release.lib"{windows_d3d11_libs} }} }}')
+ l( ' }')
l( ' } else {')
- l(f' when ODIN_DEBUG == true {{ foreign import {clib_import} {{ "{clib_prefix}_windows_x64_d3d11_debug.lib"{windows_d3d11_libs} }} }}')
- l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_windows_x64_d3d11_release.lib"{windows_d3d11_libs} }} }}')
+ l( ' when SOKOL_USE_GL {')
+ l(f' when SOKOL_DEBUG {{ foreign import {clib_import} {{ "{clib_prefix}_windows_x64_gl_debug.lib"{windows_gl_libs} }} }}')
+ l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_windows_x64_gl_release.lib"{windows_gl_libs} }} }}')
+ l( ' } else {')
+ l(f' when SOKOL_DEBUG {{ foreign import {clib_import} {{ "{clib_prefix}_windows_x64_d3d11_debug.lib"{windows_d3d11_libs} }} }}')
+ l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_windows_x64_d3d11_release.lib"{windows_d3d11_libs} }} }}')
+ l( ' }')
l( ' }')
l( '} else when ODIN_OS == .Darwin {')
- l( ' when #config(SOKOL_USE_GL,false) {')
+ l( ' when SOKOL_USE_GL {')
l( ' when ODIN_ARCH == .arm64 {')
- l(f' when ODIN_DEBUG == true {{ foreign import {clib_import} {{ "{clib_prefix}_macos_arm64_gl_debug.a"{macos_gl_libs} }} }}')
- l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_macos_arm64_gl_release.a"{macos_gl_libs} }} }}')
+ l(f' when SOKOL_DEBUG {{ foreign import {clib_import} {{ "{clib_prefix}_macos_arm64_gl_debug.a"{macos_gl_libs} }} }}')
+ l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_macos_arm64_gl_release.a"{macos_gl_libs} }} }}')
l( ' } else {')
- l(f' when ODIN_DEBUG == true {{ foreign import {clib_import} {{ "{clib_prefix}_macos_x64_gl_debug.a"{macos_gl_libs} }} }}')
- l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_macos_x64_gl_release.a"{macos_gl_libs} }} }}')
+ l(f' when SOKOL_DEBUG {{ foreign import {clib_import} {{ "{clib_prefix}_macos_x64_gl_debug.a"{macos_gl_libs} }} }}')
+ l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_macos_x64_gl_release.a"{macos_gl_libs} }} }}')
l( ' }')
l( ' } else {')
l( ' when ODIN_ARCH == .arm64 {')
- l(f' when ODIN_DEBUG == true {{ foreign import {clib_import} {{ "{clib_prefix}_macos_arm64_metal_debug.a"{macos_metal_libs} }} }}')
- l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_macos_arm64_metal_release.a"{macos_metal_libs} }} }}')
+ l(f' when SOKOL_DEBUG {{ foreign import {clib_import} {{ "{clib_prefix}_macos_arm64_metal_debug.a"{macos_metal_libs} }} }}')
+ l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_macos_arm64_metal_release.a"{macos_metal_libs} }} }}')
l( ' } else {')
- l(f' when ODIN_DEBUG == true {{ foreign import {clib_import} {{ "{clib_prefix}_macos_x64_metal_debug.a"{macos_metal_libs} }} }}')
- l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_macos_x64_metal_release.a"{macos_metal_libs} }} }}')
+ l(f' when SOKOL_DEBUG {{ foreign import {clib_import} {{ "{clib_prefix}_macos_x64_metal_debug.a"{macos_metal_libs} }} }}')
+ l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_macos_x64_metal_release.a"{macos_metal_libs} }} }}')
l( ' }')
l( ' }')
+ l( '} else when ODIN_OS == .Linux {')
+ l(f' when SOKOL_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( '} else {')
+ l( ' #panic("This OS is currently not supported")')
l( '}')
- l( 'else {')
- l(f' when ODIN_DEBUG == true {{ 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( '')
# Need to special case sapp_sg to avoid Odin's context keyword
if c_prefix == "sapp_sg":