refactored project structure to support dylib feature

- 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)
This commit is contained in:
Dmitry Stepanov
2024-03-16 10:19:18 +03:00
parent 2ec4ddef6f
commit 98379e58fb
207 changed files with 283 additions and 219 deletions
+3
View File
@@ -37,6 +37,9 @@
<sourceFolder url="file://$MODULE_DIR$/fyrox-math/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/editor-dylib/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/fyrox-dylib/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/fyrox-bridge/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/fyrox-impl/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/fyrox/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
<excludeFolder url="file://$MODULE_DIR$/examples/wasm/target" />
</content>
+1 -1
View File
@@ -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,
+4 -61
View File
@@ -1,20 +1,3 @@
[package]
name = "fyrox"
version = "0.33.1"
authors = ["Dmitry Stepanov <[email protected]>", "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",
@@ -29,8 +12,11 @@ members = [
"template",
"fyrox-graph",
"fyrox-math",
"fyrox-dylib"
"fyrox-dylib",
"fyrox",
"fyrox-impl"
]
resolver = "2"
[profile.dev]
opt-level = 0
@@ -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"
+2 -2
View File
@@ -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"] }
+4 -6
View File
@@ -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"
@@ -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
View File
@@ -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::{
+1 -1
View File
@@ -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},
+2 -2
View File
@@ -1,4 +1,5 @@
use fyrox::{
use fyrox_graph::SceneGraph;
use fyrox_impl::{
asset::manager::ResourceManager,
core::{
algebra::{Matrix4, Point3, UnitQuaternion, Vector2, Vector3},
@@ -30,7 +31,6 @@ use fyrox::{
},
utils::navmesh::NavmeshAgent,
};
use fyrox_graph::SceneGraph;
use winit::keyboard::PhysicalKey;
struct GameScene {
-1
View File
@@ -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]
-1
View File
@@ -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]
-1
View File
@@ -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]
+1 -1
View File
@@ -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" }
+1 -1
View File
@@ -21,4 +21,4 @@
//! ```
// Just re-export everything.
pub use fyrox::*;
pub use fyrox_impl::*;
-1
View File
@@ -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]
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

+61
View File
@@ -0,0 +1,61 @@
[package]
name = "fyrox-impl"
version = "0.33.1"
authors = ["Dmitry Stepanov <[email protected]>", "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"] }
@@ -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,
@@ -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();
@@ -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;
@@ -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},
@@ -335,13 +335,13 @@ impl Default for PropertyValue {
/// method to create a material with standard shader:
///
/// ```no_run
/// use fyrox::{
/// material::shader::{ShaderResource, SamplerFallback},
/// asset::manager::ResourceManager,
/// material::{Material, PropertyValue},
/// core::sstorage::ImmutableString,
/// };
/// use fyrox::resource::texture::Texture;
/// # use fyrox_impl::{
/// # material::shader::{ShaderResource, SamplerFallback},
/// # asset::manager::ResourceManager,
/// # material::{Material, PropertyValue},
/// # core::sstorage::ImmutableString,
/// # };
/// # use fyrox_impl::resource::texture::Texture;
///
/// fn create_brick_material(resource_manager: ResourceManager) -> Material {
/// let mut material = Material::standard();
@@ -369,12 +369,12 @@ impl Default for PropertyValue {
/// and then create the material and populate it with a set of property values.
///
/// ```no_run
/// use fyrox::{
/// asset::manager::ResourceManager,
/// material::{Material, PropertyValue},
/// core::{sstorage::ImmutableString, algebra::Vector3}
/// };
/// use fyrox::material::shader::Shader;
/// # use fyrox_impl::{
/// # asset::manager::ResourceManager,
/// # material::{Material, PropertyValue},
/// # core::{sstorage::ImmutableString, algebra::Vector3}
/// # };
/// # use fyrox_impl::material::shader::Shader;
///
/// async fn create_grass_material(resource_manager: ResourceManager) -> Material {
/// let shader = resource_manager.request::<Shader>("my_grass_shader.ron").await.unwrap();
@@ -577,13 +577,13 @@ impl Material {
/// # Example
///
/// ```no_run
/// use fyrox::{
/// material::shader::{ShaderResource, SamplerFallback},
/// asset::manager::ResourceManager,
/// material::{Material, PropertyValue},
/// core::sstorage::ImmutableString
/// };
/// use fyrox::resource::texture::Texture;
/// # use fyrox_impl::{
/// # material::shader::{ShaderResource, SamplerFallback},
/// # asset::manager::ResourceManager,
/// # material::{Material, PropertyValue},
/// # core::sstorage::ImmutableString
/// # };
/// # use fyrox_impl::resource::texture::Texture;
///
/// fn create_brick_material(resource_manager: ResourceManager) -> Material {
/// let mut material = Material::standard();
@@ -639,12 +639,12 @@ impl Material {
/// # Example
///
/// ```no_run
/// use fyrox::{
/// asset::manager::ResourceManager,
/// material::{Material, PropertyValue},
/// core::{sstorage::ImmutableString, algebra::Vector3}
/// };
/// use fyrox::material::shader::Shader;
/// # use fyrox_impl::{
/// # asset::manager::ResourceManager,
/// # material::{Material, PropertyValue},
/// # core::{sstorage::ImmutableString, algebra::Vector3}
/// # };
/// # use fyrox_impl::material::shader::Shader;
///
/// async fn create_grass_material(resource_manager: ResourceManager) -> Material {
/// let shader = resource_manager.request::<Shader>("my_grass_shader.ron").await.unwrap();
@@ -710,8 +710,8 @@ impl Material {
/// # Examples
///
/// ```no_run
/// # use fyrox::core::sstorage::ImmutableString;
/// use fyrox::material::Material;
/// # use fyrox_impl::core::sstorage::ImmutableString;
/// # use fyrox_impl::material::Material;
///
/// let mut material = Material::standard();
///
@@ -733,9 +733,9 @@ impl Material {
/// # Example
///
/// ```no_run
/// # use fyrox::material::{Material, PropertyValue};
/// # use fyrox::core::color::Color;
/// # use fyrox::core::sstorage::ImmutableString;
/// # use fyrox_impl::material::{Material, PropertyValue};
/// # use fyrox_impl::core::color::Color;
/// # use fyrox_impl::core::sstorage::ImmutableString;
///
/// let mut material = Material::standard();
///
@@ -220,7 +220,7 @@
//! flexible. To get standard shader instance, use [`ShaderResource::standard`]
//!
//! ```no_run
//! # use fyrox::material::shader::{ShaderResource, ShaderResourceExtension};
//! # use fyrox_impl::material::shader::{ShaderResource, ShaderResourceExtension};
//!
//! let standard_shader = ShaderResource::standard();
//! ```
@@ -161,13 +161,13 @@ impl dyn Plugin {
/// # Example
///
/// ```rust
/// use fyrox::{
/// core::{pool::Handle},
/// plugin::{Plugin, PluginContext, PluginRegistrationContext},
/// scene::Scene,
/// event::Event
/// };
/// use std::str::FromStr;
/// # use fyrox_impl::{
/// # core::{pool::Handle},
/// # plugin::{Plugin, PluginContext, PluginRegistrationContext},
/// # scene::Scene,
/// # event::Event
/// # };
/// # use std::str::FromStr;
///
/// #[derive(Default)]
/// struct MyPlugin {}

Some files were not shown because too many files have changed in this diff Show More