Skip to content

Add build.rs to messages to automatically find the message libraries #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 10, 2022

Conversation

nnmm
Copy link
Contributor

@nnmm nnmm commented Apr 30, 2022

I think the relative path will be always correct, but even if not, this is only an additional search dir.

The impact is that you can build packages depending on message packages much more easily with cargo.

@nnmm nnmm requested review from esteve and jhdcs April 30, 2022 13:22
@esteve
Copy link
Collaborator

esteve commented May 2, 2022

@nnmm can you elaborate a bit more what issue this PR fixes? Thanks.

@nnmm
Copy link
Contributor Author

nnmm commented May 2, 2022

@esteve Even if you have a .cargo/config.toml so that dependencies can be found, you cannot currently build packages depending on messages with cargo. You also need to source the install beforehand, because otherwise you'll get a linker error about not finding librclrs_example_messages_typesupport.so or somesuch.

This build script fixes that, so that building with pure cargo becomes easier.

@esteve
Copy link
Collaborator

esteve commented May 2, 2022

@nnmm thanks for the explanation, makes sense.

@nnmm nnmm force-pushed the message_lib_dir_build_script branch from d4dec0a to 24e7dc4 Compare May 2, 2022 11:25
use std::path::Path;

fn main() {
let lib_dir = Path::new("../../../lib")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this expecting a specific directory structure? What would happen with a merge install? i.e. everything installed into the install directory, no separate packages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, the relative path is still the same. I tested it.

@nnmm nnmm merged commit 694dc85 into master May 10, 2022
@nnmm nnmm deleted the message_lib_dir_build_script branch May 10, 2022 15:04
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