diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c7977f5..395e02f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -114,12 +114,12 @@ jobs: # Check simd for compat builds - name: Check 2d simd compat build run: | - if ! wasm-objdump -d rapier-compat/builds/2d-simd/pkg/rapier_wasm2d_bg.wasm | grep :\\sfd ; then + if ! wasm-objdump -d rapier-compat/builds/rapier2d-simd/pkg/rapier_wasm2d_bg.wasm | grep :\\sfd ; then >&2 echo "ERROR: 2d simd compat build does not include simd opcode prefix." && exit 1; fi - name: Check 3d simd compat build run: | - if ! wasm-objdump -d rapier-compat/builds/3d-simd/pkg/rapier_wasm3d_bg.wasm | grep :\\sfd ; then + if ! wasm-objdump -d rapier-compat/builds/rapier3d-simd/pkg/rapier_wasm3d_bg.wasm | grep :\\sfd ; then >&2 echo "ERROR: 3d simd compat build does not include simd opcode prefix." && exit 1; fi # Upload diff --git a/.github/workflows/minimal.yml b/.github/workflows/minimal.yml new file mode 100644 index 0000000..0799a6f --- /dev/null +++ b/.github/workflows/minimal.yml @@ -0,0 +1,47 @@ +name: minimal + +on: + push: + branches: [master] + pull_request: + branches: [master] + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + env: + RUSTFLAGS: -D warnings + steps: + - uses: actions/checkout@v4 + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - run: npm ci + - name: Prepare minimal 2d build + working-directory: ./builds/prepare_builds/ + run: | + cargo run -- -c assets/example_dim2_minimal.json + - name: install rapier-compat dependencies + working-directory: ./rapier-compat + run: npm ci; + - name: Build minimal 2d project + working-directory: ./builds/rapier2d-minimal + run: | + npm run build + - name: Build minimal 2d project compat + working-directory: ./rapier-compat + run: | + npm run build-conf -- example_dim2_minimal diff --git a/Cargo.lock b/Cargo.lock index 72692f5..65d96c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -369,7 +369,7 @@ dependencies = [ [[package]] name = "dimforge_rapier2d" -version = "0.17.0" +version = "0.17.3" dependencies = [ "bincode", "js-sys", @@ -383,7 +383,21 @@ dependencies = [ [[package]] name = "dimforge_rapier2d-deterministic" -version = "0.17.0" +version = "0.17.3" +dependencies = [ + "bincode", + "js-sys", + "nalgebra", + "palette", + "rapier2d", + "ref-cast", + "serde", + "wasm-bindgen", +] + +[[package]] +name = "dimforge_rapier2d-minimal" +version = "0.17.3" dependencies = [ "bincode", "js-sys", @@ -397,7 +411,7 @@ dependencies = [ [[package]] name = "dimforge_rapier2d-simd" -version = "0.17.0" +version = "0.17.3" dependencies = [ "bincode", "js-sys", @@ -411,7 +425,7 @@ dependencies = [ [[package]] name = "dimforge_rapier3d" -version = "0.17.0" +version = "0.17.3" dependencies = [ "bincode", "js-sys", @@ -425,7 +439,7 @@ dependencies = [ [[package]] name = "dimforge_rapier3d-deterministic" -version = "0.17.0" +version = "0.17.3" dependencies = [ "bincode", "js-sys", @@ -439,7 +453,7 @@ dependencies = [ [[package]] name = "dimforge_rapier3d-simd" -version = "0.17.0" +version = "0.17.3" dependencies = [ "bincode", "js-sys", @@ -680,9 +694,9 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "matrixmultiply" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9380b911e3e96d10c1f415da0876389aaf1b56759054eeb0de7df940c456ba1a" +checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08" dependencies = [ "autocfg", "rawpointer", @@ -1008,6 +1022,8 @@ version = "0.1.0" dependencies = [ "clap", "clap_derive", + "serde", + "serde_json", "tera", ] @@ -1187,9 +1203,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "robust" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf4a6aa5f6d6888f39e980649f3ad6b666acdce1d78e95b8a2cb076e687ae30" +checksum = "4e27ee8bb91ca0adcf0ecb116293afa12d393f9c2b9b9cd54d33e8078fe19839" [[package]] name = "rstar" diff --git a/README.md b/README.md index d04cc4b..53f19b2 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Note that `prepare_all_projects.sh` only needs to be run once. It needs to be re The built packages will be in `builds/rapier2d/pkg`, `builds/rapier3d/pkg`, etc. To build the `-compat` variant of the packages, run `npm run build` in the `rapier-compat` directory. Note that this will only work if you already ran -`prepare_all_projects.sh`. The compat packages are then generated in, e.g., `rapier-compat/builds/3d/pkg`. +`prepare_all_projects.sh`. The compat packages are then generated in, e.g., `rapier-compat/builds/rapier3d/pkg`. ## Feature selection diff --git a/builds/prepare_builds/Cargo.toml b/builds/prepare_builds/Cargo.toml index 905de28..b0fa890 100644 --- a/builds/prepare_builds/Cargo.toml +++ b/builds/prepare_builds/Cargo.toml @@ -7,3 +7,5 @@ edition = "2021" clap = { version = "4.5" } clap_derive = { version = "4.5" } tera = "1.20" +serde_json = "1" +serde = { version = "1", features = ["derive"] } diff --git a/builds/prepare_builds/README.md b/builds/prepare_builds/README.md index 4d05a2f..2b408e8 100644 --- a/builds/prepare_builds/README.md +++ b/builds/prepare_builds/README.md @@ -6,7 +6,8 @@ It uses clap so you can pass `-h` to get more info about its parameters. ## usage -At workspace root: `cargo run -p prepare_builds -- -d dim2 -f simd`. +In this directory: `cargo run -- -c assets/dim2.json`. +The configuration file contains relative links which are not made canonical so the call location is important. Or use provided scripts: `./builds/prepare_builds/prepare_all_projects.sh && ./builds/prepare_builds/build_all_projects.sh` diff --git a/builds/prepare_builds/assets/dim2.json b/builds/prepare_builds/assets/dim2.json new file mode 100644 index 0000000..52b11ca --- /dev/null +++ b/builds/prepare_builds/assets/dim2.json @@ -0,0 +1,10 @@ +{ + "dim": "2", + "additional_features": ["serde-serialize", "debug-render"], + "target_dir": "../rapier2d/", + "template_dir": "./templates/", + "additional_rust_flags": "", + "additional_wasm_opt_flags": [], + "js_package_name": "rapier2d", + "conditional_compilation_to_remove": ["DIM3"] +} diff --git a/builds/prepare_builds/assets/dim2_deterministic.json b/builds/prepare_builds/assets/dim2_deterministic.json new file mode 100644 index 0000000..83d2bce --- /dev/null +++ b/builds/prepare_builds/assets/dim2_deterministic.json @@ -0,0 +1,14 @@ +{ + "dim": "2", + "additional_features": [ + "serde-serialize", + "debug-render", + "enhanced-determinism" + ], + "target_dir": "../rapier2d-deterministic", + "template_dir": "./templates/", + "additional_rust_flags": "", + "additional_wasm_opt_flags": [], + "js_package_name": "rapier2d-deterministic", + "conditional_compilation_to_remove": ["DIM3"] +} diff --git a/builds/prepare_builds/assets/dim2_simd.json b/builds/prepare_builds/assets/dim2_simd.json new file mode 100644 index 0000000..34156ca --- /dev/null +++ b/builds/prepare_builds/assets/dim2_simd.json @@ -0,0 +1,10 @@ +{ + "dim": "2", + "additional_features": ["serde-serialize", "debug-render", "simd-stable"], + "target_dir": "../rapier2d-simd", + "template_dir": "./templates/", + "additional_rust_flags": "-C target-feature=+simd128", + "additional_wasm_opt_flags": ["--enable-simd"], + "js_package_name": "rapier2d-simd", + "conditional_compilation_to_remove": ["DIM3"] +} diff --git a/builds/prepare_builds/assets/dim3.json b/builds/prepare_builds/assets/dim3.json new file mode 100644 index 0000000..9c68a10 --- /dev/null +++ b/builds/prepare_builds/assets/dim3.json @@ -0,0 +1,10 @@ +{ + "dim": "3", + "additional_features": ["serde-serialize", "debug-render"], + "target_dir": "../rapier3d/", + "template_dir": "./templates/", + "additional_rust_flags": "", + "additional_wasm_opt_flags": [], + "js_package_name": "rapier3d", + "conditional_compilation_to_remove": ["DIM2"] +} diff --git a/builds/prepare_builds/assets/dim3_deterministic.json b/builds/prepare_builds/assets/dim3_deterministic.json new file mode 100644 index 0000000..1d96049 --- /dev/null +++ b/builds/prepare_builds/assets/dim3_deterministic.json @@ -0,0 +1,14 @@ +{ + "dim": "3", + "additional_features": [ + "serde-serialize", + "debug-render", + "enhanced-determinism" + ], + "target_dir": "../rapier3d-deterministic", + "template_dir": "./templates/", + "additional_rust_flags": "", + "additional_wasm_opt_flags": [], + "js_package_name": "rapier3d-deterministic", + "conditional_compilation_to_remove": ["DIM2"] +} diff --git a/builds/prepare_builds/assets/dim3_simd.json b/builds/prepare_builds/assets/dim3_simd.json new file mode 100644 index 0000000..b5bb89d --- /dev/null +++ b/builds/prepare_builds/assets/dim3_simd.json @@ -0,0 +1,10 @@ +{ + "dim": "3", + "additional_features": ["serde-serialize", "debug-render", "simd-stable"], + "target_dir": "../rapier3d-simd", + "template_dir": "./templates/", + "additional_rust_flags": "-C target-feature=+simd128", + "additional_wasm_opt_flags": ["--enable-simd"], + "js_package_name": "rapier3d-simd", + "conditional_compilation_to_remove": ["DIM2"] +} diff --git a/builds/prepare_builds/assets/example_dim2_minimal.json b/builds/prepare_builds/assets/example_dim2_minimal.json new file mode 100644 index 0000000..1ae8dd5 --- /dev/null +++ b/builds/prepare_builds/assets/example_dim2_minimal.json @@ -0,0 +1,14 @@ +{ + "dim": "2", + "additional_features": [], + "target_dir": "../rapier2d-minimal/", + "template_dir": "./templates/", + "additional_rust_flags": "", + "additional_wasm_opt_flags": [], + "js_package_name": "rapier2d-minimal", + "conditional_compilation_to_remove": [ + "DIM3", + "SERDE_SERIALIZE", + "DEBUG_RENDER" + ] +} diff --git a/builds/prepare_builds/assets/example_dim3_minimal.json b/builds/prepare_builds/assets/example_dim3_minimal.json new file mode 100644 index 0000000..14e052d --- /dev/null +++ b/builds/prepare_builds/assets/example_dim3_minimal.json @@ -0,0 +1,14 @@ +{ + "dim": "3", + "additional_features": [], + "target_dir": "../rapier3d-minimal/", + "template_dir": "./templates/", + "additional_rust_flags": "", + "additional_wasm_opt_flags": [], + "js_package_name": "rapier3d-minimal", + "conditional_compilation_to_remove": [ + "DIM2", + "SERDE_SERIALIZE", + "DEBUG_RENDER" + ] +} diff --git a/builds/prepare_builds/build_all_projects.sh b/builds/prepare_builds/build_all_projects.sh index a8ed784..0f799a0 100755 --- a/builds/prepare_builds/build_all_projects.sh +++ b/builds/prepare_builds/build_all_projects.sh @@ -12,7 +12,7 @@ do # FIXME: ideally we'd use `npm ci` # but we'd need to have generated the `package-lock` beforehand and committed them in the repository. # I'm not sure yet how to store those `package-lock`s yet though. - # They should proably be similar to all packages, but I'm not sure. + # They should probably be similar to all packages, but I'm not sure. npm i; npm run build; ) diff --git a/builds/prepare_builds/prepare_all_projects.sh b/builds/prepare_builds/prepare_all_projects.sh index bed9c14..8cf35cb 100755 --- a/builds/prepare_builds/prepare_all_projects.sh +++ b/builds/prepare_builds/prepare_all_projects.sh @@ -1,11 +1,10 @@ #!/bin/bash -features=(non-deterministic deterministic simd) -dims=(dim2 dim3) +cd "$(dirname "$0")" -for feature in ${features[@]}; do - for dim in ${dims[@]}; do - echo "preparing dimension $dim with feature $feature" - cargo run -p prepare_builds -- -d ${dim} -f ${feature} - done +config_files=(dim2_deterministic dim2_simd dim2 dim3_deterministic dim3_simd dim3) + +for config_path in ${config_files[@]}; do + echo "preparing dimension $dim with feature $feature" + cargo run -- -c assets/${config_path}.json done diff --git a/builds/prepare_builds/src/main.rs b/builds/prepare_builds/src/main.rs index 56675e8..58a7f47 100644 --- a/builds/prepare_builds/src/main.rs +++ b/builds/prepare_builds/src/main.rs @@ -6,93 +6,65 @@ use std::{ }; use clap::Parser; -use clap_derive::{Parser, ValueEnum}; +use clap_derive::Parser; +use serde::{Deserialize, Serialize}; use tera::{Context, Tera}; /// Simple program to greet a person #[derive(Parser, Debug)] #[command(version, about, long_about = None)] pub struct Args { - /// Dimension to use - #[arg(short, long)] - dim: Dimension, - - /// Features to enable - #[arg(short, long)] - feature_set: FeatureSet, -} - -#[derive(ValueEnum, Debug, Clone, Copy)] -pub enum Dimension { - Dim2, - Dim3, -} - -#[derive(ValueEnum, Default, Debug, Clone, Copy)] -pub enum FeatureSet { - #[default] - NonDeterministic, - Deterministic, - Simd, + #[arg(short, long, value_name = "FILE")] + config_path: PathBuf, } +#[derive(Deserialize, Serialize)] /// Values to use when creating the new build folder. pub struct BuildValues { - /// Only the number of dimensions, as sometimes it will be prefixed by "dim" and sometimes post-fixed by "d". + /// Only the number of dimensions (1 or 2), as sometimes it will be prefixed by "dim" and sometimes post-fixed by "d". pub dim: String, - /// real name of the additional features to enable in the project - pub feature_set: Vec, + /// Rust name of the additional features to enable in the project, they should correspond to features from Cargo.toml(.tera). + pub additional_features: Vec, pub target_dir: PathBuf, pub template_dir: PathBuf, pub additional_rust_flags: String, pub additional_wasm_opt_flags: Vec, pub js_package_name: String, + /// To remove text blocks present in non-rust files bounded by `#if CONDITION ... #endif` + pub conditional_compilation_to_remove: Vec, } impl BuildValues { pub fn new(args: Args) -> Self { - let dim = match args.dim { - Dimension::Dim2 => "2", - Dimension::Dim3 => "3", - }; - let feature_set = match args.feature_set { - FeatureSet::NonDeterministic => vec![], - FeatureSet::Deterministic => vec!["enhanced-determinism"], - FeatureSet::Simd => vec!["simd-stable"], - }; - let js_package_name = match args.feature_set { - FeatureSet::NonDeterministic => format!("rapier{dim}d"), - FeatureSet::Deterministic => format!("rapier{dim}d-deterministic"), - FeatureSet::Simd => format!("rapier{dim}d-simd"), + let f = File::open(args.config_path).expect("Failed opening file"); + let config: Self = match serde_json::from_reader(f) { + Ok(x) => x, + Err(e) => { + println!("Failed to load config: {}", e); + + std::process::exit(1); + } }; - - let root: PathBuf = env!("CARGO_MANIFEST_DIR").into(); - - Self { - dim: dim.to_string(), - feature_set: feature_set.iter().map(|f| f.to_string()).collect(), - template_dir: root.join("templates/").clone(), - target_dir: root.parent().unwrap().join(&js_package_name).into(), - additional_rust_flags: match args.feature_set { - FeatureSet::Simd => "RUSTFLAGS='-C target-feature=+simd128'".to_string(), - _ => "".to_string(), - }, - additional_wasm_opt_flags: match args.feature_set { - FeatureSet::Simd => vec!["--enable-simd".to_string()], - _ => vec![], - }, - js_package_name, - } + config } } fn main() { let args = Args::parse(); - dbg!(&args); + //dbg!(&args); let build_values = BuildValues::new(args); + println!( + "RON:\n{}\n", + serde_json::to_string_pretty(&build_values).unwrap() + ); copy_top_level_files_in_directory(&build_values.template_dir, &build_values.target_dir) - .expect("Failed to copy directory"); + .unwrap_or_else(|_| { + eprintln!( + "Failed to copy {:?} into {:?}", + &build_values.template_dir, &build_values.target_dir + ); + }); process_templates(&build_values).expect("Failed to process templates"); } @@ -128,13 +100,17 @@ fn process_templates(build_values: &BuildValues) -> std::io::Result<()> { let mut context = Context::new(); context.insert("dimension", &build_values.dim); - context.insert("additional_features", &build_values.feature_set); + context.insert("additional_features", &build_values.additional_features); context.insert("additional_rust_flags", &build_values.additional_rust_flags); context.insert( "additional_wasm_opt_flags", &build_values.additional_wasm_opt_flags, ); context.insert("js_package_name", &build_values.js_package_name); + context.insert( + "conditional_compilation_to_remove", + &build_values.conditional_compilation_to_remove, + ); let tera = match Tera::new(target_dir.join("**/*.tera").to_str().unwrap()) { Ok(t) => t, @@ -144,8 +120,7 @@ fn process_templates(build_values: &BuildValues) -> std::io::Result<()> { } }; dbg!(tera.templates.keys(), &context); - - for entry in fs::read_dir(target_dir)? { + for entry in fs::read_dir(dbg!(target_dir))? { let entry = entry?; let path = entry.path(); // For tera templates, remove extension. @@ -162,7 +137,7 @@ fn process_templates(build_values: &BuildValues) -> std::io::Result<()> { Ok(s) => { let old_path = path.clone(); let new_path = path.with_extension(""); - let mut file = File::create(path.join(new_path))?; + let mut file = File::create(path.parent().unwrap().join(new_path))?; file.write_all(s.as_bytes())?; std::fs::remove_file(old_path)?; } diff --git a/builds/prepare_builds/templates/Cargo.toml.tera b/builds/prepare_builds/templates/Cargo.toml.tera index 208addd..fe0ef93 100644 --- a/builds/prepare_builds/templates/Cargo.toml.tera +++ b/builds/prepare_builds/templates/Cargo.toml.tera @@ -12,14 +12,25 @@ license = "Apache-2.0" edition = "2018" [features] -default = ["dim{{ dimension }}"] +default = ["dim{{ dimension }}", + {%- for feature in additional_features %} + "{{ feature }}", + {%- endfor %}] dim{{ dimension }} = [] +debug-render = ["rapier{{ dimension }}d/debug-render", "dep:palette"] +serde-serialize = ["rapier{{ dimension }}d/serde-serialize", "dep:serde", "dep:bincode"] +enhanced-determinism = ["rapier{{ dimension }}d/enhanced-determinism"] +simd-stable = ["rapier{{ dimension }}d/simd-stable"] [lib] name = "rapier_wasm{{ dimension }}d" path = "../../src/lib.rs" crate-type = ["cdylib", "rlib"] -required-features = ["dim{{ dimension }}"] +required-features = ["dim{{ dimension }}", + {%- for feature in additional_features %} + "{{ feature }}", + {%- endfor %} +] [lints] rust.unexpected_cfgs = { level = "warn", check-cfg = [ @@ -27,20 +38,14 @@ rust.unexpected_cfgs = { level = "warn", check-cfg = [ ] } [dependencies] -rapier{{ dimension }}d = { version = "0.26.1", features = [ - "serde-serialize", - "debug-render", - {%- for feature in additional_features %} - "{{ feature }}", - {%- endfor %} -] } +rapier{{ dimension }}d = { version = "0.26.1" } ref-cast = "1" wasm-bindgen = "0.2.100" js-sys = "0.3" nalgebra = "0.33" -serde = { version = "1", features = ["derive", "rc"] } -bincode = "1" -palette = "0.7" +serde = { version = "1", features = ["derive", "rc"], optional = true } +bincode = { version = "1", optional = true } +palette = { version = "0.7", optional = true } [package.metadata.wasm-pack.profile.release] # add -g to keep debug symbols diff --git a/builds/prepare_builds/templates/build_rust.sh.tera b/builds/prepare_builds/templates/build_rust.sh.tera index 6fd6ae8..73d450d 100755 --- a/builds/prepare_builds/templates/build_rust.sh.tera +++ b/builds/prepare_builds/templates/build_rust.sh.tera @@ -2,8 +2,10 @@ # Cleaning rust because changing rust flags may lead to different build results. cargo clean +{% if additional_rust_flags -%} +RUSTFLAGS='{{ additional_rust_flags }}' {% else -%} +{%- endif -%} npx wasm-pack build -{{ additional_rust_flags }} npx wasm-pack build sed -i.bak 's#dimforge_rapier#@dimforge/rapier#g' pkg/package.json sed -i.bak 's/"rapier_wasm{{ dimension }}d_bg.wasm"/"*"/g' pkg/package.json ( diff --git a/builds/prepare_builds/templates/build_typescript.sh.tera b/builds/prepare_builds/templates/build_typescript.sh.tera index 8fcce98..b710339 100755 --- a/builds/prepare_builds/templates/build_typescript.sh.tera +++ b/builds/prepare_builds/templates/build_typescript.sh.tera @@ -5,7 +5,9 @@ cp -r ../../src.ts/* pkg/src/. rm -f ./pkg/raw.ts echo 'export * from "./rapier_wasm{{ dimension }}d"' > pkg/src/raw.ts # See https://serverfault.com/a/137848 -find pkg/ -type f -print0 | LC_ALL=C xargs -0 sed -i.bak '\:#if DIM{% if dimension == "2" %}3{% else %}2{% endif %}:,\:#endif:d' +{% for condition_to_remove in conditional_compilation_to_remove %} +find pkg/ -type f -print0 | LC_ALL=C xargs -0 sed -i.bak '\:#if {{condition_to_remove}}:,\:#endif:d' +{% endfor %} npx tsc # NOTE: we keep the typescripts files into the NPM package for source mapping: see #3 sed -i.bak 's/"module": "rapier_wasm{{ dimension }}d.js"/"module": "rapier.js"/g' pkg/package.json diff --git a/rapier-compat/build-rust.sh b/rapier-compat/build-rust.sh deleted file mode 100755 index 2acd18f..0000000 --- a/rapier-compat/build-rust.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - - -help() -{ - printf "Usage: %s: [-d 2|3] [-f deterministim|non-deterministic|simd]\n" $0 -} - -while getopts :d:f: name -do - case $name in - d) - dimension="$OPTARG";; - f) - feature="$OPTARG";; - ?) help ; exit 1;; - esac -done - -if [[ -z "$dimension" ]]; then - help; exit 2; -fi -if [[ -z "$feature" ]]; then - help; exit 3; -fi - -if [[ $feature == "non-deterministic" ]]; then - feature_postfix="" -else - feature_postfix="-${feature}" -fi - -rust_source_directory="../builds/rapier${dimension}d${feature_postfix}" - -if [ ! -d "$rust_source_directory" ]; then - echo "Directory $rust_source_directory does not exist"; - echo "You may want to generate rust projects first."; - help - exit 4; -fi - -# Working dir in wasm-pack is the project root so we need that "../../" - -if [[ $feature == "simd" ]]; then - export additional_rustflags='-C target-feature=+simd128' -else - export additional_rustflags='' -fi - -RUSTFLAGS="${additional_rustflags}" wasm-pack --verbose build --target web --out-dir "../../rapier-compat/builds/${dimension}d${feature_postfix}/wasm-build" "$rust_source_directory" diff --git a/rapier-compat/build_conf.sh b/rapier-compat/build_conf.sh new file mode 100755 index 0000000..b3cb662 --- /dev/null +++ b/rapier-compat/build_conf.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e + +help() +{ + printf "Usage: %s: CONFIG_FILE_NAME ...\n" $0 +} + +if [[ -z "$@" ]]; then + help; exit 2; +fi + +for config_file_name in "$@" +do + + ./build_rust.sh $config_file_name + ./gen_src.sh $config_file_name + npm run rollup -- --config rollup.config.js --bundleConfigAsCjs --environment BUILD_CONFIG_NAME:${config_file_name} + +done diff --git a/rapier-compat/build_rust.sh b/rapier-compat/build_rust.sh new file mode 100755 index 0000000..dd21cad --- /dev/null +++ b/rapier-compat/build_rust.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -e + +help() +{ + printf "Usage: %s: CONFIG_NAME\n" $0 +} + +config_file_name="$1" + +if [[ -z "$config_file_name" ]]; then + help; exit 2; +fi + +config_file_path="../builds/prepare_builds/assets/$config_file_name.json" + +rust_source_directory_name=`node -pe 'JSON.parse(process.argv[1]).js_package_name' "$(cat ${config_file_path})"` + +echo "building rust wasm for ${rust_source_directory_name} package." + +rust_source_directory="../builds/${rust_source_directory_name}" + +if [ ! -d "$rust_source_directory" ]; then + echo "Directory $rust_source_directory does not exist"; + echo "You may want to generate rust projects first (see builds/prepare_builds folder)."; + echo "For example:"; + echo "> cd ../builds/prepare_builds && cargo run -- -c assets/$config_file_name.json && cd -" + help + exit 4; +fi + +echo "source folder is: ${rust_source_directory}" + +set -x + +additional_rust_flags=`node -pe 'JSON.parse(process.argv[1]).additional_rust_flags' "$(cat ${config_file_path})"` + + +# Working dir in wasm-pack is the project root so we need that "../../" + +if [[ $additional_rust_flags == "undefined" ]]; then + additional_rust_flags='' +fi + +RUSTFLAGS="${additional_rust_flags}" wasm-pack --verbose build --target web --out-dir "../../rapier-compat/builds/${rust_source_directory_name}/wasm-build" "$rust_source_directory" diff --git a/rapier-compat/fix_raw_file.sh b/rapier-compat/fix_raw_file.sh deleted file mode 100644 index 66f8bfa..0000000 --- a/rapier-compat/fix_raw_file.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -for feature in \ -2d 2d-deterministic 2d-simd \ -3d 3d-deterministic 3d-simd -do - -echo 'export * from "'"./rapier_wasm$feature"'"' > builds/${feature}/pkg/raw.d.ts -echo 'export * from "'"./rapier_wasm$feature"'"' > builds/${feature}/pkg/raw.d.ts - -done; \ No newline at end of file diff --git a/rapier-compat/gen_src.sh b/rapier-compat/gen_src.sh index 24ccc44..330dce0 100755 --- a/rapier-compat/gen_src.sh +++ b/rapier-compat/gen_src.sh @@ -1,58 +1,59 @@ +#!/bin/sh + # Copy source and remove #if sections - similar to script in ../rapierXd set -e -gen_js() { - DIM=$1 - GENOUT="./gen${DIM}" +help() +{ + printf "Usage: %s: CONFIG_FILE_NAME\n" $0 +} - # Make output directories - mkdir -p ${GENOUT} +config_file_name=$1 - # Copy common sources - cp -r ../src.ts/* $GENOUT +if [ -z "$config_file_name" ]; then + help; exit 2; +fi - # Copy compat mode override sources - rm -f "${GENOUT}/raw.ts" "${GENOUT}/init.ts" - cp -r ./src${DIM}/* $GENOUT -} +config_file_path="../builds/prepare_builds/assets/$config_file_name.json" -gen_js "2d" -gen_js "3d" +js_package_name=`node -pe 'JSON.parse(process.argv[1]).js_package_name' "$(cat ${config_file_path})"` +dimension=`node -pe 'JSON.parse(process.argv[1]).dim' "$(cat ${config_file_path})"` +conditional_compilation_to_remove=`node -pe 'JSON.parse(process.argv[1]).conditional_compilation_to_remove.join(" ")' "$(cat ${config_file_path})"` -# See https://serverfault.com/a/137848 -find gen2d/ -type f -print0 | LC_ALL=C xargs -0 sed -i.bak '\:#if DIM3:,\:#endif:d' -find gen3d/ -type f -print0 | LC_ALL=C xargs -0 sed -i.bak '\:#if DIM2:,\:#endif:d' +DIM="${dimension}d" +GENOUT="./builds/${js_package_name}/gen${DIM}" -# Clean up backup files. -find gen2d/ -type f -name '*.bak' | xargs rm -find gen3d/ -type f -name '*.bak' | xargs rm +# Make output directories +rm -rf ${GENOUT} +mkdir -p ${GENOUT} -for features_set in \ -"2" "2 deterministic" "2 simd" \ -"3" "3 deterministic" "3 simd" -do +# Copy common sources +cp -r ../src.ts/* $GENOUT - set -- $features_set # Convert the "tuple" into the param args $1 $2... - dimension=$1 - if [ -z "$2" ]; then - feature="${1}d"; - else - feature="${1}d-${2}"; - fi +# Copy compat mode override sources +rm -f "${GENOUT}/raw.ts" "${GENOUT}/init.ts" +cp -r ./src${DIM}/* $GENOUT - mkdir -p ./builds/${feature}/pkg/ +for condition_to_remove in ${conditional_compilation_to_remove} ; do + # See https://serverfault.com/a/137848 + echo "find ${GENOUT} -type f -print0 | LC_ALL=C xargs -0 sed -i.bak \"\\:#if ${condition_to_remove}:,\\:#endif:d\"" + find ${GENOUT} -type f -print0 | LC_ALL=C xargs -0 sed -i.bak "\\:#if ${condition_to_remove}:,\\:#endif:d" +done - cp ./builds/${feature}/wasm-build/rapier_wasm* ./builds/${feature}/pkg/ - cp -r ./gen${dimension}d ./builds/${feature}/ +rm -rf ./builds/${js_package_name}/pkg/ +mkdir -p ./builds/${js_package_name}/pkg/ - # copy tsconfig, as they contain paths - cp ./tsconfig.common.json ./tsconfig.json ./builds/${feature}/ - cp ./tsconfig.pkg${dimension}d.json ./builds/${feature}/tsconfig.pkg.json +cp ./builds/${js_package_name}/wasm-build/rapier_wasm* ./builds/${js_package_name}/pkg/ - # "import.meta" causes Babel to choke, but the code path is never taken so just remove it. - sed -i.bak 's/import.meta.url/""/g' ./builds/${feature}/pkg/rapier_wasm${dimension}d.js +# fix raw file +echo 'export * from "'"./rapier_wasm$DIM"'"' > builds/${js_package_name}/pkg/raw.d.ts - # Clean up backup files. - find ./builds/${feature}/pkg/ -type f -name '*.bak' | xargs rm +# copy tsconfig, as they contain paths +cp ./tsconfig.common.json ./tsconfig.json ./builds/${js_package_name}/ +cp ./tsconfig.pkg${dimension}d.json ./builds/${js_package_name}/tsconfig.pkg.json -done +# "import.meta" causes Babel to choke, but the code path is never taken so just remove it. +sed -i.bak 's/import.meta.url/""/g' ./builds/${js_package_name}/pkg/rapier_wasm${dimension}d.js + +# Clean up backup files. +find ./builds/${js_package_name}/ -type f -name '*.bak' | xargs rm \ No newline at end of file diff --git a/rapier-compat/package-lock.json b/rapier-compat/package-lock.json index 22b6f02..d279a40 100644 --- a/rapier-compat/package-lock.json +++ b/rapier-compat/package-lock.json @@ -16,7 +16,7 @@ "@types/jest": "^29.2.1", "jest": "^29.2.2", "rimraf": "^3.0.2", - "rollup": "^3.2.5", + "rollup": "^3.29.5", "rollup-plugin-base64": "^1.0.1", "rollup-plugin-copy": "^3.4.0", "rollup-plugin-filesize": "^9.1.2", @@ -5096,10 +5096,11 @@ } }, "node_modules/rollup": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.2.5.tgz", - "integrity": "sha512-/Ha7HhVVofduy+RKWOQJrxe4Qb3xyZo+chcpYiD8SoQa4AG7llhupUtyfKSSrdBM2mWJjhM8wZwmbY23NmlIYw==", + "version": "3.29.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.5.tgz", + "integrity": "sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w==", "dev": true, + "license": "MIT", "bin": { "rollup": "dist/bin/rollup" }, @@ -9867,9 +9868,9 @@ } }, "rollup": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.2.5.tgz", - "integrity": "sha512-/Ha7HhVVofduy+RKWOQJrxe4Qb3xyZo+chcpYiD8SoQa4AG7llhupUtyfKSSrdBM2mWJjhM8wZwmbY23NmlIYw==", + "version": "3.29.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.5.tgz", + "integrity": "sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w==", "dev": true, "requires": { "fsevents": "~2.3.2" diff --git a/rapier-compat/package.json b/rapier-compat/package.json index f97e9cf..4a70b8b 100644 --- a/rapier-compat/package.json +++ b/rapier-compat/package.json @@ -3,22 +3,16 @@ "description": "Build scripts for compatibility package with inlined webassembly as base64.", "private": true, "scripts": { - "build-rust-2d-non-deterministic": "./build-rust.sh -f non-deterministic -d 2", - "build-rust-2d-deterministic": "./build-rust.sh -f deterministic -d 2", - "build-rust-2d-simd": "./build-rust.sh -f simd -d 2", - "build-rust-2d-all": "npm run build-rust-2d-non-deterministic && npm run build-rust-2d-deterministic && npm run build-rust-2d-simd", - "build-rust-3d-non-deterministic": "./build-rust.sh -f non-deterministic -d 3", - "build-rust-3d-deterministic": "./build-rust.sh -f deterministic -d 3", - "build-rust-3d-simd": "./build-rust.sh -f simd -d 3", - "build-rust-3d-all": "npm run build-rust-3d-non-deterministic && npm run build-rust-3d-deterministic && npm run build-rust-3d-simd", - "build-rust-all": "npm run build-rust-2d-all && npm run build-rust-3d-all", - "build-genjs": "sh ./gen_src.sh", - "build-js": "rollup --config rollup.config.js --bundleConfigAsCjs", + "prepare-all-projects": "../builds/prepare_builds/prepare_all_projects.sh", + "build-2d-all": "./build_conf.sh dim2 dim2_deterministic dim2_simd", + "build-3d-all": "./build_conf.sh dim3 dim3_deterministic dim3_simd", + "build-all": "./build_conf.sh dim2 dim3 dim2_deterministic dim3_deterministic dim2_simd dim3_simd", + "build-conf": "./build_conf.sh", "fix-raw-file": "sh ./fix_raw_file.sh", - "build": "npm run clean && npm run build-rust-all && npm run build-genjs && npm run build-js && npm run fix-raw-file", - "clean": "rimraf gen2d gen3d builds", + "build": "npm run clean && npm run build-all", + "clean": "cargo clean && rimraf builds", "test": "jest --detectOpenHandles", - "all": "npm run build" + "rollup": "rollup" }, "dependencies": { "base64-js": "^1.5.1" @@ -26,12 +20,12 @@ "devDependencies": { "@rollup/plugin-commonjs": "^23.0.2", "@rollup/plugin-node-resolve": "^15.0.1", - "@rollup/plugin-typescript": "^9.0.2", "@rollup/plugin-terser": "0.1.0", + "@rollup/plugin-typescript": "^9.0.2", "@types/jest": "^29.2.1", "jest": "^29.2.2", "rimraf": "^3.0.2", - "rollup": "^3.2.5", + "rollup": "^3.29.5", "rollup-plugin-base64": "^1.0.1", "rollup-plugin-copy": "^3.4.0", "rollup-plugin-filesize": "^9.1.2", diff --git a/rapier-compat/rollup.config.js b/rapier-compat/rollup.config.js index 7246dd1..d85c471 100644 --- a/rapier-compat/rollup.config.js +++ b/rapier-compat/rollup.config.js @@ -6,18 +6,19 @@ import path from "path"; import {base64} from "rollup-plugin-base64"; import copy from "rollup-plugin-copy"; import filesize from "rollup-plugin-filesize"; +import * as fs from "fs"; -const config = (dim, features_postfix) => ({ - input: `builds/${features_postfix}/gen${dim}/rapier.ts`, +const config = (dim, js_package_name) => ({ + input: `builds/${js_package_name}/gen${dim}/rapier.ts`, output: [ { - file: `builds/${features_postfix}/pkg/rapier.es.js`, + file: `builds/${js_package_name}/pkg/rapier.es.js`, format: "es", sourcemap: true, exports: "named", }, { - file: `builds/${features_postfix}/pkg/rapier.cjs.js`, + file: `builds/${js_package_name}/pkg/rapier.cjs.js`, format: "cjs", sourcemap: true, exports: "named", @@ -27,11 +28,11 @@ const config = (dim, features_postfix) => ({ copy({ targets: [ { - src: `builds/${features_postfix}/wasm-build/package.json`, - dest: `builds/${features_postfix}/pkg/`, + src: `builds/${js_package_name}/wasm-build/package.json`, + dest: `builds/${js_package_name}/pkg/`, transform(content) { let config = JSON.parse(content.toString()); - config.name = `@dimforge/rapier${features_postfix}-compat`; + config.name = `@dimforge/${js_package_name}`; config.description += " Compatibility package with inlined webassembly as base64."; config.types = "rapier.d.ts"; @@ -43,12 +44,12 @@ const config = (dim, features_postfix) => ({ }, }, { - src: `../rapier${features_postfix}/LICENSE`, - dest: `builds/${features_postfix}/pkg`, + src: `../${js_package_name}/LICENSE`, + dest: `builds/${js_package_name}/pkg`, }, { - src: `../rapier${features_postfix}/README.md`, - dest: `builds/${features_postfix}/pkg`, + src: `../${js_package_name}/README.md`, + dest: `builds/${js_package_name}/pkg`, }, ], }), @@ -59,7 +60,7 @@ const config = (dim, features_postfix) => ({ typescript({ tsconfig: path.resolve( __dirname, - `builds/${features_postfix}/tsconfig.pkg.json`, + `builds/${js_package_name}/tsconfig.pkg.json`, ), sourceMap: true, inlineSources: true, @@ -68,11 +69,12 @@ const config = (dim, features_postfix) => ({ ], }); -export default [ - config("2d", "2d"), - config("2d", "2d-deterministic"), - config("2d", "2d-simd"), - config("3d", "3d"), - config("3d", "3d-deterministic"), - config("3d", "3d-simd"), -]; +const conf = JSON.parse( + fs.readFileSync( + "../builds/prepare_builds/assets/" + + process.env.BUILD_CONFIG_NAME + + ".json", + ), +); + +export default [config("" + conf.dim + "d", conf.js_package_name)]; diff --git a/rapier-compat/tests/World2d.test.ts b/rapier-compat/tests/World2d.test.ts index 45a3bb7..ac6623b 100644 --- a/rapier-compat/tests/World2d.test.ts +++ b/rapier-compat/tests/World2d.test.ts @@ -1,4 +1,4 @@ -import {init, Vector2, World} from "../builds/2d-deterministic/pkg"; +import {init, Vector2, World} from "../builds/rapier2d-deterministic/pkg"; describe("2d/World", () => { let world: World; diff --git a/rapier-compat/tests/World3d.test.ts b/rapier-compat/tests/World3d.test.ts index e0ddd54..adc1375 100644 --- a/rapier-compat/tests/World3d.test.ts +++ b/rapier-compat/tests/World3d.test.ts @@ -1,4 +1,4 @@ -import {init, Vector3, World} from "../builds/3d-deterministic/pkg"; +import {init, Vector3, World} from "../builds/rapier3d-deterministic/pkg"; describe("3d/World", () => { let world: World; diff --git a/rapier-compat/tests/math2d.test.ts b/rapier-compat/tests/math2d.test.ts index a756056..de1175f 100644 --- a/rapier-compat/tests/math2d.test.ts +++ b/rapier-compat/tests/math2d.test.ts @@ -1,4 +1,4 @@ -import {Vector2, VectorOps} from "../builds/2d-deterministic/pkg"; +import {Vector2, VectorOps} from "../builds/rapier2d-deterministic/pkg"; describe("2d/math", () => { test("Vector2", () => { diff --git a/rapier-compat/tests/math3d.test.ts b/rapier-compat/tests/math3d.test.ts index 2ff194c..0320cd6 100644 --- a/rapier-compat/tests/math3d.test.ts +++ b/rapier-compat/tests/math3d.test.ts @@ -1,4 +1,4 @@ -import {Vector3, VectorOps} from "../builds/3d-deterministic/pkg"; +import {Vector3, VectorOps} from "../builds/rapier3d-deterministic/pkg"; describe("3d/math", () => { test("Vector3", () => { diff --git a/rapier-compat/tsconfig.pkg3d.json b/rapier-compat/tsconfig.pkg3d.json index 3d7323e..79b6b38 100644 --- a/rapier-compat/tsconfig.pkg3d.json +++ b/rapier-compat/tsconfig.pkg3d.json @@ -2,7 +2,7 @@ "extends": "./tsconfig.common.json", "compilerOptions": { "rootDir": "./gen3d", - "outDir": "." + "outDir": "./3d" }, "files": ["./gen3d/rapier.ts"] } diff --git a/src.ts/pipeline/index.ts b/src.ts/pipeline/index.ts index 092c1a5..e4eacaa 100644 --- a/src.ts/pipeline/index.ts +++ b/src.ts/pipeline/index.ts @@ -1,7 +1,11 @@ export * from "./world"; export * from "./physics_pipeline"; +// #if SERDE_SERIALIZE export * from "./serialization_pipeline"; +// #endif export * from "./event_queue"; export * from "./physics_hooks"; +// #if DEBUG_RENDER export * from "./debug_render_pipeline"; +// #endif export * from "./query_pipeline"; diff --git a/src.ts/pipeline/world.ts b/src.ts/pipeline/world.ts index 1a7a437..825a465 100644 --- a/src.ts/pipeline/world.ts +++ b/src.ts/pipeline/world.ts @@ -2,7 +2,9 @@ import { RawBroadPhase, RawCCDSolver, RawColliderSet, + // #if SERDE_SERIALIZE RawDeserializedWorld, + // #endif RawIntegrationParameters, RawIslandManager, RawImpulseJointSet, @@ -11,8 +13,12 @@ import { RawPhysicsPipeline, RawQueryPipeline, RawRigidBodySet, + // #if SERDE_SERIALIZE RawSerializationPipeline, + // #endif + // #if DEBUG_RENDER RawDebugRenderPipeline, + // #endif } from "../raw"; import { @@ -50,10 +56,14 @@ import { import {Rotation, Vector, VectorOps} from "../math"; import {PhysicsPipeline} from "./physics_pipeline"; import {QueryFilterFlags, QueryPipeline} from "./query_pipeline"; +// #if SERDE_SERIALIZE import {SerializationPipeline} from "./serialization_pipeline"; +// #endif import {EventQueue} from "./event_queue"; import {PhysicsHooks} from "./physics_hooks"; +// #if DEBUG_RENDER import {DebugRenderBuffers, DebugRenderPipeline} from "./debug_render_pipeline"; +// #endif import { KinematicCharacterController, PidAxesMask, @@ -63,7 +73,6 @@ import {Coarena} from "../coarena"; // #if DIM3 import {DynamicRayCastVehicleController} from "../control"; - // #endif /** @@ -85,8 +94,12 @@ export class World { ccdSolver: CCDSolver; queryPipeline: QueryPipeline; physicsPipeline: PhysicsPipeline; + // #if SERDE_SERIALIZE serializationPipeline: SerializationPipeline; + // #endif + // #if DEBUG_RENDER debugRenderPipeline: DebugRenderPipeline; + // #endif characterControllers: Set; pidControllers: Set; @@ -113,8 +126,12 @@ export class World { this.ccdSolver.free(); this.queryPipeline.free(); this.physicsPipeline.free(); + // #if SERDE_SERIALIZE this.serializationPipeline.free(); + // #endif + // #if DEBUG_RENDER this.debugRenderPipeline.free(); + // #endif this.characterControllers.forEach((controller) => controller.free()); this.pidControllers.forEach((controller) => controller.free()); @@ -133,8 +150,12 @@ export class World { this.multibodyJoints = undefined; this.queryPipeline = undefined; this.physicsPipeline = undefined; + // #if SERDE_SERIALIZE this.serializationPipeline = undefined; + // #endif + // #if DEBUG_RENDER this.debugRenderPipeline = undefined; + // #endif this.characterControllers = undefined; this.pidControllers = undefined; @@ -156,8 +177,12 @@ export class World { rawCCDSolver?: RawCCDSolver, rawQueryPipeline?: RawQueryPipeline, rawPhysicsPipeline?: RawPhysicsPipeline, + // #if SERDE_SERIALIZE rawSerializationPipeline?: RawSerializationPipeline, + // #endif + // #if DEBUG_RENDER rawDebugRenderPipeline?: RawDebugRenderPipeline, + // #endif ) { this.gravity = gravity; this.integrationParameters = new IntegrationParameters( @@ -173,12 +198,16 @@ export class World { this.ccdSolver = new CCDSolver(rawCCDSolver); this.queryPipeline = new QueryPipeline(rawQueryPipeline); this.physicsPipeline = new PhysicsPipeline(rawPhysicsPipeline); + // #if SERDE_SERIALIZE this.serializationPipeline = new SerializationPipeline( rawSerializationPipeline, ); + // #endif + // #if DEBUG_RENDER this.debugRenderPipeline = new DebugRenderPipeline( rawDebugRenderPipeline, ); + // #endif this.characterControllers = new Set(); this.pidControllers = new Set(); @@ -186,11 +215,14 @@ export class World { this.vehicleControllers = new Set(); // #endif + // #if SERDE_SERIALIZE this.impulseJoints.finalizeDeserialization(this.bodies); this.bodies.finalizeDeserialization(this.colliders); this.colliders.finalizeDeserialization(this.bodies); + // #endif } + // #if SERDE_SERIALIZE public static fromRaw(raw: RawDeserializedWorld): World { if (!raw) return null; @@ -236,7 +268,10 @@ export class World { let deser = new SerializationPipeline(); return deser.deserializeAll(data); } + // End serialization block + // #endif + // #if DEBUG_RENDER /** * Computes all the lines (and their colors) needed to render the scene. * @@ -262,6 +297,7 @@ export class World { this.debugRenderPipeline.colors, ); } + // #endif /** * Advance the simulation by one time step. diff --git a/src/lib.rs b/src/lib.rs index 132809d..9269097 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,6 +9,8 @@ extern crate nalgebra as na; extern crate rapier2d as rapier; #[cfg(feature = "dim3")] extern crate rapier3d as rapier; + +#[cfg(feature = "serde-serialize")] #[macro_use] extern crate serde; diff --git a/src/pipeline/mod.rs b/src/pipeline/mod.rs index eabd9cc..a127c96 100644 --- a/src/pipeline/mod.rs +++ b/src/pipeline/mod.rs @@ -1,13 +1,17 @@ +#[cfg(feature = "debug-render")] pub use self::debug_render_pipeline::*; pub use self::event_queue::*; pub use self::physics_hooks::*; pub use self::physics_pipeline::*; pub use self::query_pipeline::*; +#[cfg(feature = "serde-serialize")] pub use self::serialization_pipeline::*; +#[cfg(feature = "debug-render")] mod debug_render_pipeline; mod event_queue; mod physics_hooks; mod physics_pipeline; mod query_pipeline; +#[cfg(feature = "serde-serialize")] mod serialization_pipeline;