#![deny(non_upper_case_globals)]
#![deny(non_camel_case_types)]
#![deny(non_snake_case)]
#![deny(unused_mut)]
#![warn(missing_docs)]
extern crate cc;
use std::env;
fn main() {
let mut base_config = cc::Build::new();
base_config.include("depend/secp256k1/")
.include("depend/secp256k1/include")
.include("depend/secp256k1/src")
.flag_if_supported("-Wno-unused-function") .flag_if_supported("-Wno-unused-parameter") .define("SECP256K1_API", Some(""))
.define("ENABLE_MODULE_ECDH", Some("1"))
.define("ENABLE_MODULE_SCHNORRSIG", Some("1"))
.define("ENABLE_MODULE_EXTRAKEYS", Some("1"))
.define("ENABLE_MODULE_ELLSWIFT", Some("1"))
.define("printf(...)", Some(""));
if cfg!(feature = "lowmemory") {
base_config.define("ECMULT_WINDOW_SIZE", Some("4")); base_config.define("ECMULT_GEN_PREC_BITS", Some("2"));
} else {
base_config.define("ECMULT_GEN_PREC_BITS", Some("4"));
base_config.define("ECMULT_WINDOW_SIZE", Some("15")); }
base_config.define("USE_EXTERNAL_DEFAULT_CALLBACKS", Some("1"));
#[cfg(feature = "recovery")]
base_config.define("ENABLE_MODULE_RECOVERY", Some("1"));
if env::var("CARGO_CFG_TARGET_ARCH").unwrap() == "wasm32" {
base_config.include("wasm/wasm-sysroot")
.file("wasm/wasm.c");
}
base_config.file("depend/secp256k1/contrib/lax_der_parsing.c")
.file("depend/secp256k1/src/precomputed_ecmult_gen.c")
.file("depend/secp256k1/src/precomputed_ecmult.c")
.file("depend/secp256k1/src/secp256k1.c");
if base_config.try_compile("libsecp256k1.a").is_err() {
base_config.include("wasm/wasm-sysroot");
base_config.compile("libsecp256k1.a");
}
}