forked from DaGenix/rust-crypto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
36 lines (32 loc) · 1.19 KB
/
build.rs
File metadata and controls
36 lines (32 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate gcc;
use std::env;
use std::path::Path;
fn main() {
let target = env::var("TARGET").unwrap();
let host = env::var("HOST").unwrap();
if target.contains("msvc") && host.contains("windows") {
let mut config = gcc::Config::new();
config.file("src/util_helpers.asm");
config.file("src/aesni_helpers.asm");
if target.contains("x86_64") {
config.define("X64", None);
}
config.compile("lib_rust_crypto_helpers.a");
}
else {
let mut cfg = gcc::Config::new();
cfg.file("src/util_helpers.c");
cfg.file("src/aesni_helpers.c");
// gcc can't build this library so, unless the user has explicitly
// specified a different C compiler, use clang.
if env::var_os("CC").is_none() {
cfg.compiler(Path::new("clang"));
}
cfg.compile("lib_rust_crypto_helpers.a");
}
}