Skip to content

Conversation

@IvarWithoutBones
Copy link
Contributor

Describe your changes

This passes dependencies from CMake to Cargo in a more reliable fashion. See the commit descriptions for more details.

Issue ticket number and link

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • I read the contribution documentation and made sure that my changes meet its requirements

Modules written in Rust need to link against some C++ libraries (like
everest-framework) that are compiled with CMake, which requires us to
pass the paths to said dependencies to Cargo to set some linker flags.

Before this commit this was done in one of two ways:

- By passing a path to the installation directory containing the object
  files. This has the downside of needing to run `make install` once
  before you can build any Rust modules.
- By guessing the path to `everest-framework`s build directory, then
  relying on CMake's internal directory structure to find the libraries
  automatically. This doesn't support multi-config builds, and only works
  when building from the everest-framework repo.

This commit makes CMake generate a `everestrs-link-dependencies.txt` file
directly containing the paths to the required objects, which fixes the
aforementioned issues the existing methods have. It looks like there were
plans to do this exact thing before, the file was already being generated
by CMake but never used.

Signed-off-by: Ivar Scholten <[email protected]>
Apparently Cargo performs semver patch updates when generating a new
lockfile, unless the version is preceded with an equals sign.

Since CMake generates its own Cargo workspace it always creates a
lockfile on clean builds, breaking the FFI bindings since we need a
specific version of the `cxx` library.

Signed-off-by: Ivar Scholten <[email protected]>
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.

2 participants