add 'shared' config to vendor libraries

This commit is contained in:
flysand7
2023-10-14 21:21:34 +11:00
parent 77210ffa56
commit cf937c6341
15 changed files with 249 additions and 77 deletions
+64 -21
View File
@@ -95,35 +95,78 @@ MAX_TEXT_BUFFER_LENGTH :: #config(RAYLIB_MAX_TEXT_BUFFER_LENGTH, 1024)
#assert(size_of(rune) == size_of(c.int))
RAYLIB_SHARED :: #config(RAYLIB_SHARED, false)
when ODIN_OS == .Windows {
@(extra_linker_flags="/NODEFAULTLIB:libcmt")
foreign import lib {
"windows/raylib.lib",
"system:Winmm.lib",
"system:Gdi32.lib",
"system:User32.lib",
"system:Shell32.lib",
when RAYLIB_SHARED {
@(extra_linker_flags="/NODEFAULTLIB:libcmt")
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",
}
}
} else when ODIN_OS == .Linux {
foreign import lib {
"linux/libraylib.a",
"system:dl",
"system:pthread",
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.450",
"system:dl",
"system:pthread",
}
} else {
foreign import lib {
"linux/libraylib.a",
"system:dl",
"system:pthread",
}
}
} else when ODIN_OS == .Darwin {
when ODIN_ARCH == .arm64 {
foreign import lib {
"macos-arm64/libraylib.a",
"system:Cocoa.framework",
"system:OpenGL.framework",
"system:IOKit.framework",
when RAYLIB_SHARED {
foreign import lib {
"macos-arm64/libraylib.450.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 {
foreign import lib {
"macos/libraylib.a",
"system:Cocoa.framework",
"system:OpenGL.framework",
"system:IOKit.framework",
when RAYLIB_SHARED {
foreign import lib {
"macos/libraylib.450.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",
}
}
}
} else {