jbuckmccready / static_aabb2d_index

Fast static 2D axis aligned bounding box index

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

criterion library required even for production build

mlampert opened this issue · comments

Trying to integrate cavalier_contours in FreeCAD it is currently required to install criterion with all its dependencies for the build. Unfortunately the CI system FreeCAD uses has no online access and the criterion packages are not available for Ubuntu 22.04 and 20.04 - both are build targets for FreeCAD.

It would be really great if static_aabb2d_index could be built without requiring criterion which would never be used in this use case.

commented

criterion is listed under the [dev-dependencies] in the Cargo.toml and shouldn't be built or required when this crate (static_aabb2d_index) is used as a dependency (as it is for cavalier_contours). How are you building cavalier_contours and what error message are you getting indicating it's needing the criterion package? I was never aware of [dev-dependencies] causing this issue so I would like to learn more.

cmd and error:

markus@camille:/tmp/static_aabb2d_index$ cargo build --lib --release
error: no matching package named `criterion` found
location searched: registry `crates-io`
required by package `static_aabb2d_index v2.0.0 (/tmp/static_aabb2d_index)`

I'm working on debian and forced cargo to use the local registry (see https://wiki.debian.org/Rust) I have the crates autocfg and num-traits installed.

when I looked into it I found this thread. I don't fully understand the argument but it seems to be on purpose:
rust-lang/cargo#4988

I did some more testing and found out that if I remove the reference to criterion and bench from the Cargo.toml the library builds just fine - with above command.

commented

Ah, yeah if you build cavalier_contours it wont require criterion (even though it depends on static_aabb2d_index), this is what I thought you were doing, but building this library (static_aabb2d_index) directly will require it by default (as mentioned in that cargo issue you linked).

Hmm, I think I will move the benchmarks into its own git repo to avoid this awkwardness and simplify the library repo, that should also fix the issue you're having. I'll make that change now - should be simple.

I see - so much to learn. I can also patch the Cargo.toml file for the FreeCAD build. I hadn't figured out how to get around the dependency when I filed the issue.

commented

Alright I made the change, commit: f2e5659

Dedicated repo for benchmarks is now here: https://github.com/jbuckmccready/static_aabb2d_index_bench

This should resolve your issue.

perfect - it sure does, thanks a lot!