mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
Utilize foreign import constant strings for foreign imports
This commit is contained in:
Vendored
+23
-66
@@ -97,76 +97,33 @@ MAX_TEXT_BUFFER_LENGTH :: #config(RAYLIB_MAX_TEXT_BUFFER_LENGTH, 1024)
|
||||
RAYLIB_SHARED :: #config(RAYLIB_SHARED, false)
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
when RAYLIB_SHARED {
|
||||
@(extra_linker_flags="/NODEFAULTLIB:msvcrt")
|
||||
foreign import lib {
|
||||
"windows/raylibdll.lib",
|
||||
"system:Winmm.lib",
|
||||
"system:Gdi32.lib",
|
||||
"system:User32.lib",
|
||||
"system:Shell32.lib",
|
||||
}
|
||||
} else {
|
||||
@(extra_linker_flags="/NODEFAULTLIB:libcmt")
|
||||
foreign import lib {
|
||||
"windows/raylib.lib",
|
||||
"system:Winmm.lib",
|
||||
"system:Gdi32.lib",
|
||||
"system:User32.lib",
|
||||
"system:Shell32.lib",
|
||||
}
|
||||
_WINDOWS_LIB :: "windows/raylib" +" dll" when RAYLIB_SHARED else "" + ".lib"
|
||||
@(extra_linker_flags="/NODEFAULTLIB:msvcrt")
|
||||
foreign import lib {
|
||||
"windows/raylibdll.lib" when RAYLIB_SHARED else "windows/raylib.lib" ,
|
||||
"system:Winmm.lib",
|
||||
"system:Gdi32.lib",
|
||||
"system:User32.lib",
|
||||
"system:Shell32.lib",
|
||||
}
|
||||
} else when ODIN_OS == .Linux {
|
||||
when RAYLIB_SHARED {
|
||||
foreign import lib {
|
||||
// Note(bumbread): I'm not sure why in `linux/` folder there are
|
||||
// multiple copies of raylib.so, but since these bindings are for
|
||||
// particular version of the library, I better specify it. Ideally,
|
||||
// though, it's best specified in terms of major (.so.4)
|
||||
"linux/libraylib.so.500",
|
||||
"system:dl",
|
||||
"system:pthread",
|
||||
}
|
||||
} else {
|
||||
foreign import lib {
|
||||
"linux/libraylib.a",
|
||||
"system:dl",
|
||||
"system:pthread",
|
||||
}
|
||||
foreign import lib {
|
||||
// Note(bumbread): I'm not sure why in `linux/` folder there are
|
||||
// multiple copies of raylib.so, but since these bindings are for
|
||||
// particular version of the library, I better specify it. Ideally,
|
||||
// though, it's best specified in terms of major (.so.4)
|
||||
"linux/libraylib.so.500" when RAYLIB_SHARED else "linux/libraylib.a",
|
||||
"system:dl",
|
||||
"system:pthread",
|
||||
}
|
||||
} else when ODIN_OS == .Darwin {
|
||||
when ODIN_ARCH == .arm64 {
|
||||
when RAYLIB_SHARED {
|
||||
foreign import lib {
|
||||
"macos-arm64/libraylib.500.dylib",
|
||||
"system:Cocoa.framework",
|
||||
"system:OpenGL.framework",
|
||||
"system:IOKit.framework",
|
||||
}
|
||||
} else {
|
||||
foreign import lib {
|
||||
"macos-arm64/libraylib.a",
|
||||
"system:Cocoa.framework",
|
||||
"system:OpenGL.framework",
|
||||
"system:IOKit.framework",
|
||||
}
|
||||
}
|
||||
} else {
|
||||
when RAYLIB_SHARED {
|
||||
foreign import lib {
|
||||
"macos/libraylib.500.dylib",
|
||||
"system:Cocoa.framework",
|
||||
"system:OpenGL.framework",
|
||||
"system:IOKit.framework",
|
||||
}
|
||||
} else {
|
||||
foreign import lib {
|
||||
"macos/libraylib.a",
|
||||
"system:Cocoa.framework",
|
||||
"system:OpenGL.framework",
|
||||
"system:IOKit.framework",
|
||||
}
|
||||
}
|
||||
foreign import lib {
|
||||
"macos" +
|
||||
"-arm64" when ODIN_ARCH == .arm64 else "" +
|
||||
"/libraylib" + ".500.dylib" when RAYLIB_SHARED else ".a",
|
||||
"system:Cocoa.framework",
|
||||
"system:OpenGL.framework",
|
||||
"system:IOKit.framework",
|
||||
}
|
||||
} else {
|
||||
foreign import lib "system:raylib"
|
||||
|
||||
Reference in New Issue
Block a user