Skip to content

feat: nix support#238

Open
liamnwhite1 wants to merge 2 commits intonmwsharp:masterfrom
liamnwhite1:feat/nix-support
Open

feat: nix support#238
liamnwhite1 wants to merge 2 commits intonmwsharp:masterfrom
liamnwhite1:feat/nix-support

Conversation

@liamnwhite1
Copy link

Summary

This PR makes the installed geometry-central package self-contained for downstream CMake and Nix consumers.

It removes the need for:

  • custom downstream FindGeometryCentral.cmake / Findgeometry-central.cmake files
  • downstream postInstall copy steps for vendored headers

The changes are intentionally small and split into two logical commits:

  1. install and export a proper CMake package
  2. install bundled headers referenced by public installed headers

What Changed

1. Export an installable CMake package

This PR teaches geometry-central to install a standard CMake config package under:

  • lib/cmake/GeometryCentral/GeometryCentralConfig.cmake
  • lib/cmake/GeometryCentral/GeometryCentralTargets.cmake

That allows downstream projects to use:

find_package(GeometryCentral REQUIRED CONFIG)
target_link_libraries(my-target PRIVATE geometry-central::geometry-central)

without providing a custom FindGeometryCentral.cmake.

To make the export work cleanly, the target interface was adjusted so the installed package does not depend on this repository's local helper targets from deps/, while installed consumers still inherit Eigen3::Eigen transitively.

2. Install bundled public dependency headers

Some installed public headers currently reference vendored headers that were not being installed.

This PR installs the missing public dependency headers:

  • happly.h
  • nanort/nanort.h

so the install tree is usable without downstream postInstall copy steps.

Why

Before this PR, downstream packaging needed extra repository-specific fixes.

In Nix, a working derivation required:

  • injecting custom FindGeometryCentral.cmake / Findgeometry-central.cmake files
  • copying vendored headers into $out/include in postInstall

After this PR, those workarounds are no longer needed.

Verification

The changes were verified with:

  1. A real nix build of the package using:

    • -DGC_ALWAYS_DOWNLOAD_EIGEN=OFF
    • -DGC_EIGEN_LOCATION=.../include/eigen3
    • -DSUITESPARSE=OFF
  2. Inspection of the install tree to confirm it now contains:

    • lib/libgeometry-central.*
    • lib/cmake/GeometryCentral/GeometryCentralConfig.cmake
    • lib/cmake/GeometryCentral/GeometryCentralTargets.cmake
    • include/happly.h
    • include/nanort/nanort.h
  3. A downstream smoke test that successfully configured and built with:

    • find_package(GeometryCentral REQUIRED CONFIG)
    • target_link_libraries(... geometry-central::geometry-central)

Notes

  • This PR does not add broader packaging features like pkg-config files.
  • This PR keeps the scope narrow and focused on making the install tree complete and discoverable.
  • No public geometry-central API was intentionally changed.
  • Once this PR is merged a complete nix derivation can be made for geometry-central.

Install and export the geometry-central target as a CMake package so
downstream projects can use find_package(GeometryCentral CONFIG)
without a custom FindGeometryCentral.cmake module.

Also split the build and install interfaces so the exported target does
not depend on this project's local helper targets, while installed
consumers still inherit Eigen transitively.
Install the vendored headers referenced by public geometry-central headers so the install tree is self-contained.

This removes the need for downstream post-install copy steps for happly.h and nanort/nanort.h.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant