From e3daf66f657068c658c58ad9fee1fff3967be701 Mon Sep 17 00:00:00 2001 From: InvalidString Date: Mon, 16 Oct 2023 16:13:45 +0200 Subject: [PATCH] Added a "dylib" feature flag, that enables linking with raylib dynamically instead of statically --- Cargo.toml | 3 ++- build/bind.rs | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5d3f1dd..189b8c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,4 +27,5 @@ regex = "1" [features] default = ["macros"] -macros = [] \ No newline at end of file +macros = [] +dylib = [] diff --git a/build/bind.rs b/build/bind.rs index ea41907..96f1691 100644 --- a/build/bind.rs +++ b/build/bind.rs @@ -68,7 +68,12 @@ pub fn link_libs() { } // Link raylib itself - println!("cargo:rustc-link-lib=static=raylib"); + if cfg!(feature = "dylib") { + println!("cargo:rustc-link-lib=dylib=raylib"); + } + else { + println!("cargo:rustc-link-lib=static=raylib"); + } } /// Generates `bindings.rs` file