find system lua with pkg-config

This commit is contained in:
Tony Crisci 2018-05-14 08:51:51 -04:00
parent 31fa9173ae
commit 66e49518d3
3 changed files with 9 additions and 2 deletions

View File

@ -31,6 +31,7 @@ compiletest_rs = { version = "0.3", optional = true }
[build-dependencies]
cc = { version = "1.0", optional = true }
pkg-config = "0.3.11"
[dev-dependencies]
rustyline = "1.0.0"
@ -38,4 +39,4 @@ criterion = "0.2.0"
[[bench]]
name = "benchmark"
harness = false
harness = false

View File

@ -1,6 +1,9 @@
#[cfg(feature = "builtin-lua")]
extern crate cc;
#[cfg(not(feature = "builtin-lua"))]
extern crate pkg_config;
fn main() {
#[cfg(feature = "builtin-lua")]
{
@ -62,4 +65,8 @@ fn main() {
.file("lua/lzio.c")
.compile("liblua5.3.a");
}
#[cfg(not(feature = "builtin-lua"))]
{
pkg_config::Config::new().atleast_version("5.3").probe("lua").unwrap();
}
}

View File

@ -78,7 +78,6 @@ pub const LUA_GCSETPAUSE: c_int = 6;
pub const LUA_GCSETSTEPMUL: c_int = 7;
pub const LUA_GCISRUNNING: c_int = 9;
#[link(name = "lua5.3")]
extern "C" {
pub fn lua_newstate(alloc: lua_Alloc, ud: *mut c_void) -> *mut lua_State;
pub fn lua_close(state: *mut lua_State);