Fix cargo warning output and wrong pointer width (#88)
Fix cargo warning output and wrong pointer width Co-Authored-By: tomaka <pierre.krieger1708@gmail.com>
This commit is contained in:
parent
4f44a0f3bc
commit
fba7dfbda2
17
build.rs
17
build.rs
|
@ -23,27 +23,22 @@
|
||||||
|
|
||||||
extern crate cc;
|
extern crate cc;
|
||||||
|
|
||||||
use std::io::{self, Write};
|
use std::env;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Check whether we can use 64-bit compilation
|
// Check whether we can use 64-bit compilation
|
||||||
#[cfg(target_pointer_width = "64")]
|
let use_64bit_compilation = if env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "64" {
|
||||||
let use_64bit_compilation = {
|
|
||||||
let check = cc::Build::new().file("depend/check_uint128_t.c")
|
let check = cc::Build::new().file("depend/check_uint128_t.c")
|
||||||
.cargo_metadata(false)
|
.cargo_metadata(false)
|
||||||
.try_compile("check_uint128_t")
|
.try_compile("check_uint128_t")
|
||||||
.is_ok();
|
.is_ok();
|
||||||
if !check {
|
if !check {
|
||||||
writeln!(
|
println!("cargo:warning=Compiling in 32-bit mode on a 64-bit architecture due to lack of uint128_t support.");
|
||||||
&mut io::stderr(),
|
|
||||||
"Warning: Compiling in 32-bit mode on a 64-bit architecture due to lack of uint128_t support."
|
|
||||||
).expect("print to stderr")
|
|
||||||
}
|
}
|
||||||
check
|
check
|
||||||
|
} else {
|
||||||
|
false
|
||||||
};
|
};
|
||||||
#[cfg(not(target_pointer_width = "64"))]
|
|
||||||
let use_64bit_compilation = false;
|
|
||||||
|
|
||||||
|
|
||||||
// Actual build
|
// Actual build
|
||||||
let mut base_config = cc::Build::new();
|
let mut base_config = cc::Build::new();
|
||||||
|
@ -61,7 +56,7 @@ fn main() {
|
||||||
.define("ENABLE_MODULE_ECDH", Some("1"))
|
.define("ENABLE_MODULE_ECDH", Some("1"))
|
||||||
.define("ENABLE_MODULE_RECOVERY", Some("1"));
|
.define("ENABLE_MODULE_RECOVERY", Some("1"));
|
||||||
|
|
||||||
if let Ok(target_endian) = std::env::var("CARGO_CFG_TARGET_ENDIAN") {
|
if let Ok(target_endian) = env::var("CARGO_CFG_TARGET_ENDIAN") {
|
||||||
if target_endian == "big" {
|
if target_endian == "big" {
|
||||||
base_config.define("WORDS_BIGENDIAN", Some("1"));
|
base_config.define("WORDS_BIGENDIAN", Some("1"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue