geometry-central icon indicating copy to clipboard operation
geometry-central copied to clipboard

Add Bazel support for geometry-central

Open phaedon opened this issue 1 year ago • 5 comments
trafficstars

This PR adds support for Bazel, as an alternative to CMake (https://bazel.build/about/why)

To build: bazel build ...

To run all unit tests: bazel test ...

Next steps (after this is merged):

  1. Please cut a new release on https://github.com/nmwsharp/geometry-central/releases
  2. Then I can add this repo to https://registry.bazel.build/
  3. I will add documentation to this repo's building.md to document the one-liner required to pull this into any other Bazel-based project (which will look something like bazel_dep(name = "geometry_central", version = "0.2.0"))

phaedon avatar Feb 16 '24 17:02 phaedon

Verified that this builds and runs successfully on at least Ubuntu (x86_64) and Mac OS (ARM).

phaedon avatar Feb 21 '24 22:02 phaedon

Thanks for submitting this! I'm totally unfamiliar with Bazel, but it seems to be fairly widely used so it'd be nice to support.

One question: what is the maintenance requirement going forward to ensure this library continues to build well on Bazel? I'm quite wary of leaving behind stale/broken versions of the library on the long tail of various package repositories / build systems. Does it just mean updating the BUILD.bazel as files are added? Would it make sense to also add a bazel build to geometry-central's CI matrix?

nmwsharp avatar Mar 03 '24 02:03 nmwsharp

Also what is the .bazelrc doing? Do we need to add an additional file to the project root?

nmwsharp avatar Mar 03 '24 02:03 nmwsharp

Great suggestion, I added a bazel.yml file to run the build and test stages on each PR.

The .bazelrc specifies a couple of basic but important settings for build:

  • C++20 version
  • "bzlmod" which reads the external dependencies (eigen and googletest) from the MODULE.bazel file as well as test output only on errors. I tried to add documentation to that file.

phaedon avatar Mar 14 '24 16:03 phaedon

Just a reminder that this is ready to go in.

phaedon avatar Jun 12 '24 09:06 phaedon