Skip to content

Commit

Permalink
feat: added dynamic linking directly to the engine
Browse files Browse the repository at this point in the history
  • Loading branch information
ElhamAryanpur committed Dec 30, 2024
1 parent 489a872 commit 2f4fdea
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 10 deletions.
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 19 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,31 @@ exclude = ["/examples", "/resources"]
name = "blue_engine"

[features]
default = ["debug", "u16"]
default = ["debug", "u16", "dep:blue_engine_core"]
# Use the default engine
dynamic_linking = []
dynamic_link = ["dep:blue_engine_dynamic"]

debug = ["blue_engine_core/debug"]
android = ["blue_engine_core/android"]
android_native_activity = ["blue_engine_core/android_native_activity"]
android_game_activity = ["blue_engine_core/android_game_activity"]
debug = ["blue_engine_core?/debug", "blue_engine_dynamic?/debug"]
android = ["blue_engine_core?/android", "blue_engine_dynamic?/android"]
android_native_activity = [
"blue_engine_core?/android_native_activity",
"blue_engine_dynamic?/android_native_activity",
]
android_game_activity = [
"blue_engine_core?/android_game_activity",
"blue_engine_dynamic?/android_game_activity",
]
# using u16 for indices and others
u16 = ["blue_engine_core/u16"]
u16 = ["blue_engine_core?/u16", "blue_engine_dynamic?/u16"]
# using u32 for indices and others
u32 = ["blue_engine_core/u32"]
u32 = ["blue_engine_core?/u32", "blue_engine_dynamic?/u32"]

[dependencies]
blue_engine_core = { path = "crates/blue_engine_core" }
blue_engine_core = { path = "crates/blue_engine_core", optional = true }

# Wasm does not support dynamic linking.
[target.'cfg(not(target_family = "wasm"))'.dependencies]
blue_engine_dynamic = { path = "crates/blue_engine_dynamic", optional = true }

# ========== EXAMPLES ========== #

Expand Down
25 changes: 25 additions & 0 deletions crates/blue_engine_dynamic/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "blue_engine_dynamic"
version = "0.6.0"
authors = ["Elham Aryanpur <elhamaryanpur5@gmail.com>"]
edition = "2021"
description = "General-Purpose, Easy-to-use, Fast, and Portable graphics engine"
license = "Apache-2.0"

[lib]
name = "blue_engine_dynamic"
crate-type = ["dylib"]

[features]
default = ["debug", "u16"]
debug = ["blue_engine_core/debug"]
android = ["blue_engine_core/android"]
android_native_activity = ["blue_engine_core/android_native_activity"]
android_game_activity = ["blue_engine_core/android_game_activity"]
# using u16 for indices and others
u16 = ["blue_engine_core/u16"]
# using u32 for indices and others
u32 = ["blue_engine_core/u32"]

[dependencies]
blue_engine_core = { path = "../blue_engine_core" }
1 change: 1 addition & 0 deletions crates/blue_engine_dynamic/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub use blue_engine_core::*;
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
#[cfg(not(feature = "dynamic_linking"))]
#[cfg(not(feature = "dynamic_link"))]
pub use blue_engine_core::*;

#[cfg(all(feature = "dynamic_link", not(target_family = "wasm")))]
pub use blue_engine_dynamic::*;

0 comments on commit 2f4fdea

Please sign in to comment.