From 57590401686ace13140ade8b0c32c31f9d8a6da1 Mon Sep 17 00:00:00 2001 From: Bintang Adiputra Pratama Date: Tue, 24 Dec 2024 13:01:53 +0700 Subject: [PATCH] vendor:raylib: add options to link with raylib/raygui from system --- vendor/raylib/raygui.odin | 5 ++++- vendor/raylib/raylib.odin | 5 ++++- vendor/raylib/rlgl/rlgl.odin | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/vendor/raylib/raygui.odin b/vendor/raylib/raygui.odin index 559437a60e2..5cdfcce22a0 100644 --- a/vendor/raylib/raygui.odin +++ b/vendor/raylib/raygui.odin @@ -4,8 +4,11 @@ import "core:c" RAYGUI_SHARED :: #config(RAYGUI_SHARED, false) RAYGUI_WASM_LIB :: #config(RAYGUI_WASM_LIB, "wasm/libraygui.a") +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", } diff --git a/vendor/raylib/raylib.odin b/vendor/raylib/raylib.odin index bb51f105fb9..29fd6d10a91 100644 --- a/vendor/raylib/raylib.odin +++ b/vendor/raylib/raylib.odin @@ -101,8 +101,11 @@ MAX_TEXT_BUFFER_LENGTH :: #config(RAYLIB_MAX_TEXT_BUFFER_LENGTH, 1024) RAYLIB_SHARED :: #config(RAYLIB_SHARED, false) RAYLIB_WASM_LIB :: #config(RAYLIB_WASM_LIB, "wasm/libraylib.a") +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" , diff --git a/vendor/raylib/rlgl/rlgl.odin b/vendor/raylib/rlgl/rlgl.odin index 340a983de78..34a53b59537 100644 --- a/vendor/raylib/rlgl/rlgl.odin +++ b/vendor/raylib/rlgl/rlgl.odin @@ -114,13 +114,16 @@ VERSION :: "5.0" RAYLIB_SHARED :: #config(RAYLIB_SHARED, false) RAYLIB_WASM_LIB :: #config(RAYLIB_WASM_LIB, "../wasm/libraylib.a") +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" ,