Skip to content

Commit

Permalink
refactored project structure to support dylib feature
Browse files Browse the repository at this point in the history
- this makes engine usage as `dylib` easier
- also fixes dependency bug, that caused the engine to be rebuilt/relinked when building different packages from the same workspace (i.e. editor and executor)
  • Loading branch information
mrDIMAS committed Mar 16, 2024
1 parent 2ec4dde commit 98379e5
Show file tree
Hide file tree
Showing 207 changed files with 283 additions and 219 deletions.
3 changes: 3 additions & 0 deletions .idea/rg3d-core.iml

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

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ This section will help you to migrate to new physics.
Rigid body and colliders now can be created like so:

```rust
use fyrox::{
use fyrox_impl::{
core::{algebra::Vector3, pool::Handle},
scene::{
base::BaseBuilder,
Expand Down
65 changes: 4 additions & 61 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
[package]
name = "fyrox"
version = "0.33.1"
authors = ["Dmitry Stepanov <d1maxa@yandex.ru>", "Fyrox Engine Contributors"]
edition = "2021"
license = "MIT"
description = "Feature-rich, easy-to-use, 2D/3D game engine with a scene editor. Like Godot, but in Rust."
keywords = ["sound", "game", "engine", "3d", "gui"]
categories = ["game-engines", "graphics", "gui", "rendering", "wasm"]
include = ["/src/**/*", "/Cargo.toml", "/LICENSE", "/README.md"]
homepage = "https://fyrox.rs"
documentation = "https://docs.rs/fyrox"
repository = "https://github.com/FyroxEngine/Fyrox"
readme = "README.md"
resolver = "2"
rust-version = "1.72"

[workspace]
members = [
"fyrox-core-derive",
Expand All @@ -29,8 +12,11 @@ members = [
"template",
"fyrox-graph",
"fyrox-math",
"fyrox-dylib"
"fyrox-dylib",
"fyrox",
"fyrox-impl"
]
resolver = "2"

[profile.dev]
opt-level = 0
Expand All @@ -39,49 +25,6 @@ opt-level = 0
opt-level = 3
debug = true

[dependencies]
fyrox-core-derive = { path = "fyrox-core-derive", version = "0.22.0" }
fyrox-core = { path = "fyrox-core", version = "0.27.0", features = ["serde"] }
fyrox-sound = { path = "fyrox-sound", version = "0.34.0" }
fyrox-ui = { path = "fyrox-ui", version = "0.24.0" }
fyrox-resource = { path = "fyrox-resource", version = "0.11.0" }
fyrox-animation = { path = "fyrox-animation", version = "0.1.0" }
fyrox-graph = { path = "fyrox-graph", version = "0.1.0" }
rapier2d = { version = "0.18", features = ["debug-render"] }
rapier3d = { version = "0.18", features = ["debug-render"] }
image = { version = "0.24.3", default-features = false, features = ["gif", "jpeg", "png", "tga", "tiff", "bmp"] }
inflate = "0.4.5"
serde = { version = "1", features = ["derive"] }
lazy_static = "1.4.0"
ddsfile = "0.5.0"
rayon = "1.5.1"
tbc = "0.3.0"
bitflags = "2.2.1"
glow = "0.13.1"
walkdir = "2.3.2"
ron = "0.8.0"
fxhash = "0.2.1"
strum = "0.26.1"
strum_macros = "0.26.1"
clap = { version = "4", features = ["derive"] }
winit = { version = "0.29.2", features = ["serde"] }
half = "2.2.1"
fast_image_resize = "3.0.4"
base64 = "0.21.0"
uvgen = "0.1.0"
lightmap = "0.1.1"

[features]
enable_profiler = ["fyrox-core/enable_profiler"]

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
glutin = "0.31"
glutin-winit = "0.4.2"
raw-window-handle = "0.5.0"

[target.'cfg(target_os = "android")'.dependencies]
winit = { version = "0.29.2", features = ["android-native-activity"] }

[profile.github-ci]
inherits = "dev"
strip = "symbols"
Expand Down
4 changes: 2 additions & 2 deletions editor-standalone/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ readme = "README.md"
include = ["/src/**/*", "/Cargo.toml", "/LICENSE", "/README.md"]

[dependencies]
fyrox = { version = "0.33.0", path = "../" }
fyrox = { version = "0.33.1", path = "../fyrox" }
fyroxed_base = { version = "0.20.0", path = "../editor" }
clap = { version = "4", features = ["derive"] }
clap = { version = "4", features = ["derive"] }
10 changes: 4 additions & 6 deletions editor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ readme = "README.md"
include = ["/src/**/*", "/Cargo.toml", "/LICENSE", "/README.md", "/resources/**/*"]

[dependencies]
fyrox = { version = "0.33.0", path = "..", optional = true }
fyrox-dylib = { version = "0.1.0", path = "../fyrox-dylib", optional = true }
fyrox = { version = "0.33.1", path = "../fyrox", default-features = false }
lazy_static = "1.4.0"
ron = "0.8.0"
serde = "^1.0.0"
toml = "0.8.10"
toml = { version = "0.8.10", default-features = false, features = ["parse"] }
strum = "0.26.1"
strum_macros = "0.26.1"
open = "5"
Expand All @@ -27,6 +26,5 @@ cargo_metadata = "0.18.1"
serde_json = "1.0.113"

[features]
default = ["fyrox"]
dylib_engine = ["fyrox-dylib"]
enable_profiler = ["fyrox/enable_profiler"]
default = ["fyrox/default"]
dylib_engine = ["fyrox/dylib"]
4 changes: 0 additions & 4 deletions editor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ pub mod ui_scene;
pub mod utils;
pub mod world;

#[cfg(dylib_engine)]
pub use fyrox_dylib as fyrox;

#[cfg(not(dylib_engine))]
pub use fyrox;

use crate::fyrox::{
Expand Down
2 changes: 1 addition & 1 deletion examples/2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//!
//! This example shows simple 2D scene with light sources.

use fyrox::{
use fyrox_impl::{
asset::manager::ResourceManager,
core::{
algebra::{UnitQuaternion, Vector3},
Expand Down
4 changes: 2 additions & 2 deletions examples/navmesh.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use fyrox::{
use fyrox_graph::SceneGraph;
use fyrox_impl::{
asset::manager::ResourceManager,
core::{
algebra::{Matrix4, Point3, UnitQuaternion, Vector2, Vector3},
Expand Down Expand Up @@ -30,7 +31,6 @@ use fyrox::{
},
utils::navmesh::NavmeshAgent,
};
use fyrox_graph::SceneGraph;
use winit::keyboard::PhysicalKey;

struct GameScene {
Expand Down
1 change: 0 additions & 1 deletion fyrox-animation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ homepage = "https://fyrox.rs"
documentation = "https://docs.rs/fyrox-animation"
repository = "https://github.com/FyroxEngine/Fyrox"
readme = "README.md"
resolver = "2"
rust-version = "1.72"

[dependencies]
Expand Down
1 change: 0 additions & 1 deletion fyrox-core-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ description = "Proc-macro for the Visit trait"
repository = "https://github.com/FyroxEngine/Fyrox"
include = ["/src/**/*", "/Cargo.toml", "/README.md"]
readme = "README.md"
resolver = "2"
rust-version = "1.72"

[lib]
Expand Down
1 change: 0 additions & 1 deletion fyrox-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ homepage = "https://fyrox.rs"
documentation = "https://docs.rs/fyrox-core"
repository = "https://github.com/FyroxEngine/Fyrox"
readme = "README.md"
resolver = "2"
rust-version = "1.72"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion fyrox-dylib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ edition = "2021"
crate-type = ["dylib"]

[dependencies]
fyrox = { path = "../", version = "0.33.1" }
fyrox-impl = { path = "../fyrox-impl", version = "0.33.1" }
2 changes: 1 addition & 1 deletion fyrox-dylib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
//! ```

// Just re-export everything.
pub use fyrox::*;
pub use fyrox_impl::*;
1 change: 0 additions & 1 deletion fyrox-graph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ include = ["/src/**/*", "/Cargo.toml", "/LICENSE"]
homepage = "https://fyrox.rs"
documentation = "https://docs.rs/fyrox-graph"
repository = "https://github.com/FyroxEngine/Fyrox"
resolver = "2"
rust-version = "1.72"

[dependencies]
Expand Down
Binary file added fyrox-impl/0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions fyrox-impl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[package]
name = "fyrox-impl"
version = "0.33.1"
authors = ["Dmitry Stepanov <d1maxa@yandex.ru>", "Fyrox Engine Contributors"]
edition = "2021"
license = "MIT"
description = "Feature-rich, easy-to-use, 2D/3D game engine with a scene editor. Like Godot, but in Rust."
keywords = ["sound", "game", "engine", "3d", "gui"]
categories = ["game-engines", "graphics", "gui", "rendering", "wasm"]
include = ["/src/**/*", "/Cargo.toml", "/LICENSE", "/README.md"]
homepage = "https://fyrox.rs"
documentation = "https://docs.rs/fyrox"
repository = "https://github.com/FyroxEngine/Fyrox"
readme = "README.md"
rust-version = "1.72"

[dependencies]
fyrox-core-derive = { path = "../fyrox-core-derive", version = "0.22.0" }
fyrox-core = { path = "../fyrox-core", version = "0.27.0", features = ["serde"] }
fyrox-sound = { path = "../fyrox-sound", version = "0.34.0" }
fyrox-ui = { path = "../fyrox-ui", version = "0.24.0" }
fyrox-resource = { path = "../fyrox-resource", version = "0.11.0" }
fyrox-animation = { path = "../fyrox-animation", version = "0.1.0" }
fyrox-graph = { path = "../fyrox-graph", version = "0.1.0" }
rapier2d = { version = "0.18", features = ["debug-render"] }
rapier3d = { version = "0.18", features = ["debug-render"] }
image = { version = "0.24.3", default-features = false, features = ["gif", "jpeg", "png", "tga", "tiff", "bmp"] }
inflate = "0.4.5"
serde = { version = "1", features = ["derive"] }
lazy_static = "1.4.0"
ddsfile = "0.5.0"
rayon = "1.5.1"
tbc = "0.3.0"
bitflags = "2.2.1"
glow = "0.13.1"
walkdir = "2.3.2"
ron = "0.8.0"
fxhash = "0.2.1"
strum = "0.26.1"
strum_macros = "0.26.1"
clap = { version = "4", features = ["derive"] }
winit = { version = "0.29.2", features = ["serde"] }
half = "2.2.1"
fast_image_resize = "3.0.4"
base64 = "0.21.0"
uvgen = "0.1.0"
lightmap = "0.1.1"
# This dependency isn't actually used by the engine, but it is needed to prevent cargo from rebuilding
# the engine lib on different packages.
hashbrown = { version = "0.14.3", features = ["raw"] }

[features]
enable_profiler = ["fyrox-core/enable_profiler"]

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
glutin = "0.31"
glutin-winit = "0.4.2"
raw-window-handle = "0.5.0"

[target.'cfg(target_os = "android")'.dependencies]
winit = { version = "0.29.2", features = ["android-native-activity"] }
File renamed without changes.
File renamed without changes.
24 changes: 12 additions & 12 deletions src/engine/mod.rs → fyrox-impl/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ struct SceneLoadingOptions {
/// ## Examples
///
/// ```rust
/// use fyrox::{
/// use fyrox_impl::{
/// core::{color::Color, log::Log, pool::Handle},
/// plugin::{Plugin, PluginConstructor, PluginContext},
/// scene::Scene,
Expand Down Expand Up @@ -1226,17 +1226,17 @@ impl Engine {
/// # Examples
///
/// ```no_run
/// use fyrox::{
/// asset::manager::ResourceManager,
/// engine::{
/// Engine, EngineInitParams, GraphicsContextParams,
/// SerializationContext,
/// },
/// event_loop::EventLoop,
/// window::WindowAttributes,
/// };
/// use std::sync::Arc;
/// use fyrox_core::task::TaskPool;
/// # use fyrox_impl::{
/// # asset::manager::ResourceManager,
/// # engine::{
/// # Engine, EngineInitParams, GraphicsContextParams,
/// # SerializationContext,
/// # },
/// # event_loop::EventLoop,
/// # window::WindowAttributes,
/// # };
/// # use std::sync::Arc;
/// # use fyrox_core::task::TaskPool;
///
/// let mut window_attributes = WindowAttributes::default();
/// window_attributes.title = "Some title".to_string();
Expand Down
4 changes: 2 additions & 2 deletions src/engine/task.rs → fyrox-impl/src/engine/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl TaskPoolHandler {
/// ## Example
///
/// ```rust ,no_run
/// # use fyrox::plugin::{Plugin, PluginConstructor, PluginContext};
/// # use fyrox_impl::plugin::{Plugin, PluginConstructor, PluginContext};
/// # use std::{fs::File, io::Read};
/// #
/// struct MyGameConstructor;
Expand Down Expand Up @@ -157,7 +157,7 @@ impl TaskPoolHandler {
/// ## Examples
///
/// ```rust ,no_run
/// # use fyrox::{
/// # use fyrox_impl::{
/// # core::{reflect::prelude::*, uuid::Uuid, visitor::prelude::*, impl_component_provider},
/// # resource::model::{Model, ModelResourceExtension},
/// # script::{ScriptContext, ScriptTrait},
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 98379e5

Please sign in to comment.