Skip to content
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

It should be possible to tell cargo when to rerun the build script #1769

Closed
crumblingstatue opened this issue Jun 29, 2015 · 7 comments
Closed

Comments

@crumblingstatue
Copy link

I have a static C library I am building with make.
I'd like to work on that library and my crate that depends on it simultaneously.
However, if I only change the C library, and not touch the Rust source code, the build script is never rerun, even if the C library's source code was modified.

There should be a way to run a custom script that checks whenever the build script should be re-run.

Perhaps there could be a pre-build script that would output whether the build script should be rerun or not.

@crumblingstatue
Copy link
Author

Possibly related to #1162.
Maybe the pre-build script solution could be used for solving both issues.

@alexcrichton
Copy link
Member

Could you elaborate a little more on the directory structure and layout? With a build script Cargo will automatically re-run it and rebuild the library if any file in the directory tree changes, but if you have the C library hosted outside the directory of the Rust library then Cargo will not see the changes.

@crumblingstatue
Copy link
Author

Yes, the C library is hosted outside of the project directory, as it is a separate project.
What I want to do is work on the C library, and test it with the Rust project without having to separately build the C library and copy it over whenever I want to test a change.

@alexcrichton
Copy link
Member

Does the build script build the library from source? Or is the build script just printing out information of how to link to the library?

Now that I've done some digging I'm also going to close this as a duplicate of #1162 which is a way for the build script to print out what its dependencies are.

@crumblingstatue
Copy link
Author

It's building the library from source.

@alexcrichton
Copy link
Member

If it's building the library from source then you'll want to move the source into the directory for cargo package to succeed, otherwise it won't package up the source to be shipped to crates.io

@crumblingstatue
Copy link
Author

This isn't a project that's intended to be published to crates.io.

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

No branches or pull requests

2 participants