summaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
authorkyren <kerriganw@gmail.com>2017-06-17 16:56:36 -0400
committerkyren <kerriganw@gmail.com>2017-06-17 16:56:36 -0400
commit7b00ff02f2fab060f48f0a42381cddfdc2c99092 (patch)
tree884decbdc5ae1b545591e907c740ef67130649d5 /build.rs
parent75b7024a935ce12c2be8a37bb3500803ba206089 (diff)
downloadmlua-7b00ff02f2fab060f48f0a42381cddfdc2c99092.zip
enable more lua platform defines in build.rs
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs20
1 files changed, 16 insertions, 4 deletions
diff --git a/build.rs b/build.rs
index fd4f1d2..fe47a9d 100644
--- a/build.rs
+++ b/build.rs
@@ -5,13 +5,25 @@ use std::env;
fn main() {
let mut config = gcc::Config::new();
- if env::var("CARGO_CFG_TARGET_OS") == Ok("linux".to_string()) {
- // Among other things, this enables `io.popen` support.
- // Despite the name, we could enable this on more platforms.
+ let target_os = env::var("CARGO_CFG_TARGET_OS");
+ let target_family = env::var("CARGO_CFG_TARGET_FAMILY");
+
+ if target_os == Ok("linux".to_string()) {
config.define("LUA_USE_LINUX", None);
+ } else if target_os == Ok("macos".to_string()) {
+ config.define("LUA_USE_MACOSX", None);
+ } else if target_family == Ok("unix".to_string()) {
+ config.define("LUA_USE_POSIX", None);
+ } else if target_family == Ok("windows".to_string()) {
+ config.define("LUA_USE_WINDOWS", None);
}
- config.define("LUA_USE_APICHECK", None)
+ // Enables lua api checking, which has a slight performance penalty. We
+ // could allow disabling this via cfg one day when there is much more
+ // confidence in the soundness of the API.
+ config.define("LUA_USE_APICHECK", None);
+
+ config
.include("lua")
.file("lua/lapi.c")
.file("lua/lauxlib.c")