Skip to content
This repository has been archived by the owner on Feb 25, 2021. It is now read-only.

Commit

Permalink
Fix cargo warning output and wrong pointer width (BlockstreamResearch#88
Browse files Browse the repository at this point in the history
)

Fix cargo warning output and wrong pointer width

Co-Authored-By: tomaka <[email protected]>
  • Loading branch information
tomaka authored and real-or-random committed Jan 9, 2019
1 parent 4f44a0f commit fba7dfb
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,22 @@

extern crate cc;

use std::io::{self, Write};
use std::env;

fn main() {
// Check whether we can use 64-bit compilation
#[cfg(target_pointer_width = "64")]
let use_64bit_compilation = {
let use_64bit_compilation = if env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "64" {
let check = cc::Build::new().file("depend/check_uint128_t.c")
.cargo_metadata(false)
.try_compile("check_uint128_t")
.is_ok();
if !check {
writeln!(
&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")
println!("cargo:warning=Compiling in 32-bit mode on a 64-bit architecture due to lack of uint128_t support.");
}
check
} else {
false
};
#[cfg(not(target_pointer_width = "64"))]
let use_64bit_compilation = false;


// Actual build
let mut base_config = cc::Build::new();
Expand All @@ -61,7 +56,7 @@ fn main() {
.define("ENABLE_MODULE_ECDH", 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" {
base_config.define("WORDS_BIGENDIAN", Some("1"));
}
Expand Down

0 comments on commit fba7dfb

Please sign in to comment.