Skip to content

Commit

Permalink
vendor:raylib: add options to link with raylib/raygui from system
Browse files Browse the repository at this point in the history
  • Loading branch information
spitulax committed Dec 24, 2024
1 parent ad99d20 commit 2608cd2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion vendor/raylib/raygui.odin
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ package raylib
import "core:c"

RAYGUI_SHARED :: #config(RAYGUI_SHARED, false)
RAYGUI_SYSTEM :: #config(RAYGUI_SYSTEM, false)

when ODIN_OS == .Windows {
when RAYGUI_SYSTEM {
foreign import lib "system:raygui"
} else when ODIN_OS == .Windows {
foreign import lib {
"windows/rayguidll.lib" when RAYGUI_SHARED else "windows/raygui.lib",
}
Expand Down
5 changes: 4 additions & 1 deletion vendor/raylib/raylib.odin
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,11 @@ 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)
RAYLIB_SYSTEM :: #config(RAYLIB_SYSTEM, false)

when ODIN_OS == .Windows {
when RAYLIB_SYSTEM {
foreign import lib "system:raylib"
} else when ODIN_OS == .Windows {
@(extra_linker_flags="/NODEFAULTLIB:" + ("msvcrt" when RAYLIB_SHARED else "libcmt"))
foreign import lib {
"windows/raylibdll.lib" when RAYLIB_SHARED else "windows/raylib.lib" ,
Expand Down
5 changes: 4 additions & 1 deletion vendor/raylib/rlgl/rlgl.odin
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,16 @@ import rl "../."
VERSION :: "5.0"

RAYLIB_SHARED :: #config(RAYLIB_SHARED, false)
RAYLIB_SYSTEM :: #config(RAYLIB_SYSTEM, false)

// Note: We pull in the full raylib library. If you want a truly stand-alone rlgl, then:
// - Compile a separate rlgl library and use that in the foreign import blocks below.
// - Remove the `import rl "../."` line
// - Copy the code from raylib.odin for any types we alias from that package (see PixelFormat etc)

when ODIN_OS == .Windows {
when RAYLIB_SYSTEM {
foreign import lib "system:raylib"
} else when ODIN_OS == .Windows {
@(extra_linker_flags="/NODEFAULTLIB:" + ("msvcrt" when RAYLIB_SHARED else "libcmt"))
foreign import lib {
"../windows/raylibdll.lib" when RAYLIB_SHARED else "../windows/raylib.lib" ,
Expand Down

0 comments on commit 2608cd2

Please sign in to comment.