cuprate/cryptonight/build.rs
hinto-janai 630faed263
ci: include macos + windows (#52)
* ci: install boost, include macos + windows

* cryptonight: fix `MSVC`

* cryptonight: use `flag_if_supported()`

* fix cryptonight builds

* update randomX

* fix rx builds

* add memwipe

* include memwipe.c in build

* spawn monerod in msys2 for windows

* fix last commit

* install dependencies before spawning monerod

* remove --detach

* try another way of spawning monerod

* add /I

* download and spawn monerod as a part of tests

* add download.rs

* extend time for monerod spawn

* move sleep and show monerod output

* fix clippy

* change stdin to pipped

* #[cfg(unix)] on bytes::Buf

* fix macos capitalisation

* remove tar.bz2 on macos expected dir

* remove zip on windows expected dir

* fix todo

* add docs

* fix a couple typos

---------

Co-authored-by: Boog900 <54e72d8a-345f-4599-bd90-c6b9bc7d0ec5@aleeas.com>
Co-authored-by: Boog900 <boog900@tutanota.com>
2024-02-12 13:39:15 +00:00

49 lines
1.6 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

extern crate cc;
use std::env;
use cc::Build;
fn main() {
let mut cfg = Build::new();
cfg.include("c")
.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")
.file("c/memwipe.c")
.file("c/slow-hash.c")
.file("c/CryptonightR_JIT.c")
.flag_if_supported("-fexceptions")
// 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)
// | ^~~~~
// This flag doesn't work on MSVC and breaks CI.
.flag_if_supported("-Wno-deprecated-declarations");
// Optimization flags are automatically added.
// https://docs.rs/cc/latest/cc/struct.Build.html#method.opt_level
let target = env::var("TARGET").unwrap();
if target.contains("x86_64") {
// FIXME: what are the equivalent flags for MSVC?
cfg.file("c/CryptonightR_template.S")
.flag_if_supported("-maes")
.flag_if_supported("-msse2");
}
cfg.compile("cryptonight")
}