Hi all,
I have a makefile
to run in order to build a library before to call cargo. Is there any way to do this ?
I tried build.rs
but no success. Is build.rs
the right way?
Thanks a lot.
Hi all,
I have a makefile
to run in order to build a library before to call cargo. Is there any way to do this ?
I tried build.rs
but no success. Is build.rs
the right way?
Thanks a lot.
What did you try in build.rs?
To run make but I don't know from where the commands started form build.rs
are run.
Yes, build.rs right way. You can try use https://crates.io/crates/make-cmd crate to simpify things. If you see errors, post them here.
Another solution may be to do it in the opposite order: call cargo build
from the makefile.
Actually, I solved it using an env variable which is passed to the makefile, and allow conditional compilation:
// compile luacall library: OS dependant
if cfg!(target_os = "linux") {
// makefile is using a special env variable
Command::new("make")
.env("LUA_DIR", lua_dir)
.args(&["-f", "src/lua/luacall_linux.mak"])
.status()
.expect("failed to make!");
}
and it works pretty well (at least for Linux !)