Skip to content

Commit 2608cd2

Browse files
committed
vendor:raylib: add options to link with raylib/raygui from system
1 parent ad99d20 commit 2608cd2

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

vendor/raylib/raygui.odin

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ package raylib
33
import "core:c"
44

55
RAYGUI_SHARED :: #config(RAYGUI_SHARED, false)
6+
RAYGUI_SYSTEM :: #config(RAYGUI_SYSTEM, false)
67

7-
when ODIN_OS == .Windows {
8+
when RAYGUI_SYSTEM {
9+
foreign import lib "system:raygui"
10+
} else when ODIN_OS == .Windows {
811
foreign import lib {
912
"windows/rayguidll.lib" when RAYGUI_SHARED else "windows/raygui.lib",
1013
}

vendor/raylib/raylib.odin

+4-1
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,11 @@ MAX_TEXT_BUFFER_LENGTH :: #config(RAYLIB_MAX_TEXT_BUFFER_LENGTH, 1024)
100100
#assert(size_of(rune) == size_of(c.int))
101101

102102
RAYLIB_SHARED :: #config(RAYLIB_SHARED, false)
103+
RAYLIB_SYSTEM :: #config(RAYLIB_SYSTEM, false)
103104

104-
when ODIN_OS == .Windows {
105+
when RAYLIB_SYSTEM {
106+
foreign import lib "system:raylib"
107+
} else when ODIN_OS == .Windows {
105108
@(extra_linker_flags="/NODEFAULTLIB:" + ("msvcrt" when RAYLIB_SHARED else "libcmt"))
106109
foreign import lib {
107110
"windows/raylibdll.lib" when RAYLIB_SHARED else "windows/raylib.lib" ,

vendor/raylib/rlgl/rlgl.odin

+4-1
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,16 @@ import rl "../."
113113
VERSION :: "5.0"
114114

115115
RAYLIB_SHARED :: #config(RAYLIB_SHARED, false)
116+
RAYLIB_SYSTEM :: #config(RAYLIB_SYSTEM, false)
116117

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

122-
when ODIN_OS == .Windows {
123+
when RAYLIB_SYSTEM {
124+
foreign import lib "system:raylib"
125+
} else when ODIN_OS == .Windows {
123126
@(extra_linker_flags="/NODEFAULTLIB:" + ("msvcrt" when RAYLIB_SHARED else "libcmt"))
124127
foreign import lib {
125128
"../windows/raylibdll.lib" when RAYLIB_SHARED else "../windows/raylib.lib" ,

0 commit comments

Comments
 (0)