瀏覽代碼

Merge pull request #1039 from barnamumtyan/macos-dylib

Added support for dynamic libraries on macos in sokol-odin port.
Andre Weissflog 1 年之前
父節點
當前提交
55bc9cf3fa
共有 1 個文件被更改,包括 24 次插入13 次删除
  1. 24 13
      bindgen/gen_odin.py

+ 24 - 13
bindgen/gen_odin.py

@@ -372,21 +372,32 @@ def gen_c_imports(inp, c_prefix, prefix):
     l( '        }')
     l( '        }')
     l( '    }')
     l( '    }')
     l( '} else when ODIN_OS == .Darwin {')
     l( '} else when ODIN_OS == .Darwin {')
-    l( '    when USE_GL {')
-    l( '        when ODIN_ARCH == .arm64 {')
-    l(f'            when 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 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( '    when USE_DLL {')
+    l(f'             when  USE_GL && ODIN_ARCH == .arm64 &&  DEBUG {{ foreign import {clib_import} {{ "../dylib/sokol_dylib_macos_arm64_gl_debug.dylib" }} }}')
+    l(f'        else when  USE_GL && ODIN_ARCH == .arm64 && !DEBUG {{ foreign import {clib_import} {{ "../dylib/sokol_dylib_macos_arm64_gl_release.dylib" }} }}')
+    l(f'        else when  USE_GL && ODIN_ARCH == .amd64 &&  DEBUG {{ foreign import {clib_import} {{ "../dylib/sokol_dylib_macos_x64_gl_debug.dylib" }} }}')
+    l(f'        else when  USE_GL && ODIN_ARCH == .amd64 && !DEBUG {{ foreign import {clib_import} {{ "../dylib/sokol_dylib_macos_x64_gl_release.dylib" }} }}')
+    l(f'        else when !USE_GL && ODIN_ARCH == .arm64 &&  DEBUG {{ foreign import {clib_import} {{ "../dylib/sokol_dylib_macos_arm64_metal_debug.dylib" }} }}')
+    l(f'        else when !USE_GL && ODIN_ARCH == .arm64 && !DEBUG {{ foreign import {clib_import} {{ "../dylib/sokol_dylib_macos_arm64_metal_release.dylib" }} }}')
+    l(f'        else when !USE_GL && ODIN_ARCH == .amd64 &&  DEBUG {{ foreign import {clib_import} {{ "../dylib/sokol_dylib_macos_x64_metal_debug.dylib" }} }}')
+    l(f'        else when !USE_GL && ODIN_ARCH == .amd64 && !DEBUG {{ foreign import {clib_import} {{ "../dylib/sokol_dylib_macos_x64_metal_release.dylib" }} }}')
     l( '    } else {')
     l( '    } else {')
-    l( '        when ODIN_ARCH == .arm64 {')
-    l(f'            when 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( '        when USE_GL {')
+    l( '            when ODIN_ARCH == .arm64 {')
+    l(f'                when 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 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( '        } else {')
-    l(f'            when 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( '            when ODIN_ARCH == .arm64 {')
+    l(f'                when 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 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( '        }')
     l( '    }')
     l( '    }')
     l( '} else when ODIN_OS == .Linux {')
     l( '} else when ODIN_OS == .Linux {')