From c6e5f03b8489b5bc88604206fa5850ab1e2e79e9 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 30 May 2023 13:56:45 +0200 Subject: [PATCH 1/4] Add missing crate to `default-members` --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 7c7f27545..251a8d439 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ default-members = [ "crates/fj-interop", "crates/fj-math", "crates/fj-viewer", + "crates/fj-window", ] From 712d7cde1f3789dacfa279576b414a66cbab1067 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 30 May 2023 14:02:44 +0200 Subject: [PATCH 2/4] Add new `fj` crate --- Cargo.lock | 12 ++++++++++++ Cargo.toml | 6 ++++++ crates/fj/Cargo.toml | 19 +++++++++++++++++++ crates/fj/src/lib.rs | 19 +++++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 crates/fj/Cargo.toml create mode 100644 crates/fj/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 1c7ccad10..1a8607abe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -779,6 +779,18 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "fj" +version = "0.46.0" +dependencies = [ + "fj-core", + "fj-export", + "fj-interop", + "fj-math", + "fj-viewer", + "fj-window", +] + [[package]] name = "fj-core" version = "0.46.0" diff --git a/Cargo.toml b/Cargo.toml index 251a8d439..09bfa3286 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [workspace] resolver = "2" members = [ + "crates/fj", "crates/fj-core", "crates/fj-export", "crates/fj-interop", @@ -17,6 +18,7 @@ members = [ "tools/release-operator", ] default-members = [ + "crates/fj", "crates/fj-core", "crates/fj-export", "crates/fj-interop", @@ -74,3 +76,7 @@ path = "crates/fj-proc" [workspace.dependencies.fj-viewer] version = "0.46.0" path = "crates/fj-viewer" + +[workspace.dependencies.fj-window] +version = "0.46.0" +path = "crates/fj-window" diff --git a/crates/fj/Cargo.toml b/crates/fj/Cargo.toml new file mode 100644 index 000000000..4d007ffdf --- /dev/null +++ b/crates/fj/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "fj" +version.workspace = true +edition.workspace = true +description.workspace = true +readme.workspace = true +homepage.workspace = true +repository.workspace = true +license.workspace = true +keywords.workspace = true +categories.workspace = true + +[dependencies] +fj-core.workspace = true +fj-export.workspace = true +fj-interop.workspace = true +fj-math.workspace = true +fj-viewer.workspace = true +fj-window.workspace = true diff --git a/crates/fj/src/lib.rs b/crates/fj/src/lib.rs new file mode 100644 index 000000000..1df53c170 --- /dev/null +++ b/crates/fj/src/lib.rs @@ -0,0 +1,19 @@ +//! # Fornjot +//! +//! [Fornjot] is an early-stage b-rep CAD kernel written in Rust. The kernel is +//! split into multiple libraries that can be used semi-independently, and this +//! is one of those. +//! +//! This crate serves as a convenient entryway to Fornjot, re-exporting all +//! crates that make up Fornjot. +//! +//! [Fornjot]: https://www.fornjot.app/ + +#![warn(missing_docs)] + +pub use fj_core as core; +pub use fj_export as export; +pub use fj_interop as interop; +pub use fj_math as math; +pub use fj_viewer as viewer; +pub use fj_window as window; From f47f4f7cf511fcd1d2036edde0da70a55b7ca657 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 30 May 2023 14:04:33 +0200 Subject: [PATCH 3/4] Make use of `fj` in `cuboid` model --- Cargo.lock | 5 +---- models/cuboid/Cargo.toml | 13 ++----------- models/cuboid/src/lib.rs | 4 ++-- models/cuboid/src/main.rs | 6 +++--- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1a8607abe..fb5abc2c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -630,10 +630,7 @@ version = "0.1.0" dependencies = [ "anyhow", "clap", - "fj-core", - "fj-export", - "fj-math", - "fj-window", + "fj", "itertools", ] diff --git a/models/cuboid/Cargo.toml b/models/cuboid/Cargo.toml index 19c66e241..c542eb437 100644 --- a/models/cuboid/Cargo.toml +++ b/models/cuboid/Cargo.toml @@ -12,14 +12,5 @@ itertools = "0.10.5" version = "4.3.0" features = ["derive"] -[dependencies.fj-core] -path = "../../crates/fj-core" - -[dependencies.fj-export] -path = "../../crates/fj-export" - -[dependencies.fj-math] -path = "../../crates/fj-math" - -[dependencies.fj-window] -path = "../../crates/fj-window" +[dependencies.fj] +path = "../../crates/fj" diff --git a/models/cuboid/src/lib.rs b/models/cuboid/src/lib.rs index 2a2318d47..02aff9fc3 100644 --- a/models/cuboid/src/lib.rs +++ b/models/cuboid/src/lib.rs @@ -1,11 +1,11 @@ -use fj_core::{ +use fj::core::{ algorithms::sweep::Sweep, objects::{Sketch, Solid}, operations::{BuildSketch, Insert}, services::Services, storage::Handle, }; -use fj_math::Vector; +use fj::math::Vector; pub fn cuboid(x: f64, y: f64, z: f64) -> Handle { let mut services = Services::new(); diff --git a/models/cuboid/src/main.rs b/models/cuboid/src/main.rs index 7324199cb..51a03f31f 100644 --- a/models/cuboid/src/main.rs +++ b/models/cuboid/src/main.rs @@ -1,6 +1,6 @@ use std::{ops::Deref, path::PathBuf}; -use fj_core::algorithms::{approx::Tolerance, triangulate::Triangulate}; +use fj::core::algorithms::{approx::Tolerance, triangulate::Triangulate}; fn main() -> anyhow::Result<()> { let args = Args::parse(); @@ -14,9 +14,9 @@ fn main() -> anyhow::Result<()> { let mesh = (cuboid.deref(), tolerance).triangulate(); if let Some(path) = args.export { - fj_export::export(&mesh, &path)?; + fj::export::export(&mesh, &path)?; } else { - fj_window::run(mesh, false)?; + fj::window::run(mesh, false)?; } Ok(()) From 2be9a8874612b6f6048f7de6595cfeb78206b7e2 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 30 May 2023 14:05:02 +0200 Subject: [PATCH 4/4] Merge imports --- models/cuboid/src/lib.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/models/cuboid/src/lib.rs b/models/cuboid/src/lib.rs index 02aff9fc3..049c22244 100644 --- a/models/cuboid/src/lib.rs +++ b/models/cuboid/src/lib.rs @@ -1,11 +1,13 @@ -use fj::core::{ - algorithms::sweep::Sweep, - objects::{Sketch, Solid}, - operations::{BuildSketch, Insert}, - services::Services, - storage::Handle, +use fj::{ + core::{ + algorithms::sweep::Sweep, + objects::{Sketch, Solid}, + operations::{BuildSketch, Insert}, + services::Services, + storage::Handle, + }, + math::Vector, }; -use fj::math::Vector; pub fn cuboid(x: f64, y: f64, z: f64) -> Handle { let mut services = Services::new();