diff options
| author | Andre Weissflog <floooh@gmail.com> | 2022-07-28 19:08:41 +0200 |
|---|---|---|
| committer | Andre Weissflog <floooh@gmail.com> | 2022-07-28 19:08:41 +0200 |
| commit | 61ec0b4a220cbd150f1efb96779631768a54ad31 (patch) | |
| tree | a854f81454b5c4e21ce529a87720faf0842b6f46 /bindgen | |
| parent | 808d23133caffc91febd3ac36c6b0a1db31ad144 (diff) | |
gen_odin.py: add GL vs Metal/D3D11 backend selection via define
Diffstat (limited to 'bindgen')
| -rw-r--r-- | bindgen/gen_odin.py | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/bindgen/gen_odin.py b/bindgen/gen_odin.py index 34f9ed4c..35e738e2 100644 --- a/bindgen/gen_odin.py +++ b/bindgen/gen_odin.py @@ -382,27 +382,42 @@ def gen_c_imports(inp, prefix): clib_prefix = f'sokol_{inp["module"]}' clib_import = f'{clib_prefix}_clib' windows_d3d11_libs = get_system_libs(prefix, 'windows', 'd3d11') + windows_gl_libs = get_system_libs(prefix, 'windows', 'gl') macos_metal_libs = get_system_libs(prefix, 'macos', 'metal') macos_gl_libs = get_system_libs(prefix, 'macos', 'gl') linux_gl_libs = get_system_libs(prefix, 'linux', 'gl') - l('when ODIN_OS == .Windows {') - 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('}') - l('else when ODIN_OS == .Darwin {') - 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(' } else {') - l(f' when ODIN_DEBUG == true {{ foreign import {clib_import} {{ "{clib_prefix}_macos_x64_metal_debug.a"{macos_gl_libs} }} }}') - l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_macos_x64_metal_release.a"{macos_gl_libs} }} }}') - l(' }') - l('}') - l('else {') + 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( ' } 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( ' }') + l( '} else when ODIN_OS == .Darwin {') + l( ' when #config(SOKOL_USE_GL,false) {') + 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( ' } 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( ' }') + 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( ' } 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( ' }') + l( ' }') + l( '}') + l( 'else {') l(f' when ODIN_DEBUG == true {{ foreign import {clib_import} {{ "{clib_prefix}_linux_x64_gl_debug.lib"{linux_gl_libs} }} }}') l(f' else {{ foreign import {clib_import} {{ "{clib_prefix}_linux_x64_gl_release.lib"{linux_gl_libs} }} }}') - l('}') - l('@(default_calling_convention="c")') + l( '}') + l( '@(default_calling_convention="c")') l(f"foreign {clib_import} {{") prefix = inp['prefix'] for decl in inp['decls']: |