diff --git a/Cargo.lock b/Cargo.lock index e85add270173d125d2cff5d00b008162ce180547..fde60a11b227b79cbf36ed566d618b6d9a0d9b44 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,16 +1,3 @@ -[root] -name = "cbindgen" -version = "0.3.2" -dependencies = [ - "clap 2.24.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "ansi_term" version = "0.9.0" @@ -31,6 +18,19 @@ name = "bitflags" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "cbindgen" +version = "0.3.2" +dependencies = [ + "clap 2.24.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "clap" version = "2.24.2" diff --git a/src/bindgen/builder.rs b/src/bindgen/builder.rs index b1e444a7022fbdbd9f8c3288b38f2040eca1f121..97bb942d699064ab3537435d5f38619a2179faa4 100644 --- a/src/bindgen/builder.rs +++ b/src/bindgen/builder.rs @@ -133,6 +133,24 @@ impl Builder { self } + #[allow(unused)] + pub fn with_target_os_define(mut self, platform: &str, preprocessor_define: &str) -> Builder { + self.config.defines.insert( + format!("target_os = {}", platform), + preprocessor_define.to_owned(), + ); + self + } + + #[allow(unused)] + pub fn with_define(mut self, key: &str, value: &str, preprocessor_define: &str) -> Builder { + self.config.defines.insert( + format!("{} = {}", key, value), + preprocessor_define.to_owned(), + ); + self + } + #[allow(unused)] pub fn with_config(mut self, config: Config) -> Builder { self.config = config;