2023-09-05 10:56:07 +00:00
|
|
|
|
extern crate cc;
|
|
|
|
|
|
2024-01-09 22:39:29 +00:00
|
|
|
|
use std::env;
|
|
|
|
|
|
2023-09-05 10:56:07 +00:00
|
|
|
|
use cc::Build;
|
|
|
|
|
|
|
|
|
|
fn main() {
|
2024-01-09 22:39:29 +00:00
|
|
|
|
let mut cfg = Build::new();
|
|
|
|
|
cfg.include("c")
|
2023-09-05 10:56:07 +00:00
|
|
|
|
.file("c/aesb.c")
|
|
|
|
|
.file("c/blake256.c")
|
|
|
|
|
.file("c/groestl.c")
|
|
|
|
|
.file("c/hash-extra-blake.c")
|
|
|
|
|
.file("c/hash-extra-groestl.c")
|
|
|
|
|
.file("c/hash-extra-jh.c")
|
|
|
|
|
.file("c/hash-extra-skein.c")
|
|
|
|
|
.file("c/hash.c")
|
|
|
|
|
.file("c/jh.c")
|
|
|
|
|
.file("c/keccak.c")
|
|
|
|
|
.file("c/oaes_lib.c")
|
|
|
|
|
.file("c/skein.c")
|
2024-02-12 13:39:15 +00:00
|
|
|
|
.file("c/memwipe.c")
|
2023-09-05 10:56:07 +00:00
|
|
|
|
.file("c/slow-hash.c")
|
|
|
|
|
.file("c/CryptonightR_JIT.c")
|
2024-02-12 13:39:15 +00:00
|
|
|
|
.flag_if_supported("-fexceptions")
|
2024-02-04 22:00:37 +00:00
|
|
|
|
// c/oaes_lib.c: In function ‘oaes_get_seed’:
|
|
|
|
|
// c/oaes_lib.c:515:9: warning: ‘ftime’ is deprecated: Use gettimeofday or clock_gettime instead [-Wdeprecated-declarations]
|
|
|
|
|
// 515 | ftime (&timer);
|
|
|
|
|
// | ^~~~~
|
|
|
|
|
// In file included from c/oaes_lib.c:45:
|
|
|
|
|
// /usr/include/sys/timeb.h:29:12: note: declared here
|
|
|
|
|
// 29 | extern int ftime (struct timeb *__timebuf)
|
|
|
|
|
// | ^~~~~
|
2024-02-12 13:39:15 +00:00
|
|
|
|
// This flag doesn't work on MSVC and breaks CI.
|
2024-04-26 23:49:55 +00:00
|
|
|
|
.flag_if_supported("-Wno-deprecated-declarations")
|
|
|
|
|
// `#include <boost>` isn't found without this in macOS CI.
|
|
|
|
|
// <https://github.com/Cuprate/cuprate/pull/116>
|
|
|
|
|
.flag_if_supported("-I/opt/homebrew/include");
|
2024-02-12 13:39:15 +00:00
|
|
|
|
|
|
|
|
|
// Optimization flags are automatically added.
|
|
|
|
|
// https://docs.rs/cc/latest/cc/struct.Build.html#method.opt_level
|
2024-01-09 22:39:29 +00:00
|
|
|
|
|
|
|
|
|
let target = env::var("TARGET").unwrap();
|
|
|
|
|
if target.contains("x86_64") {
|
2024-02-12 13:39:15 +00:00
|
|
|
|
// FIXME: what are the equivalent flags for MSVC?
|
2024-01-10 01:49:35 +00:00
|
|
|
|
cfg.file("c/CryptonightR_template.S")
|
2024-02-12 13:39:15 +00:00
|
|
|
|
.flag_if_supported("-maes")
|
|
|
|
|
.flag_if_supported("-msse2");
|
2024-01-09 22:39:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cfg.compile("cryptonight")
|
2023-09-05 10:56:07 +00:00
|
|
|
|
}
|