-
Notifications
You must be signed in to change notification settings - Fork 40
/
build.rs
41 lines (36 loc) · 1.18 KB
/
build.rs
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
36
37
38
39
40
41
#[rustfmt::skip]
fn main() {
#[cfg(not(feature = "wasm"))]
{
#[cfg(feature = "avx2")]
{
const FILES: [&str; 5] = ["basemul", "fq", "invntt", "ntt", "shuffle"];
#[cfg(feature = "nasm")]
{
const ROOT: &str = "src/avx2/nasm/";
let paths = FILES.iter().map(|file| format!("{}{}.asm", ROOT, file));
let mut nasm = nasm_rs::Build::new();
let mut linker = cc::Build::new();
nasm.files(paths);
nasm.include(ROOT);
for o in nasm.compile_objects().expect("
Compiling NASM files:
Ensure it is installed and in your path
https://www.nasm.us/",
) {
linker.object(o);
}
linker.compile("pqc_kyber");
}
#[cfg(not(feature = "nasm"))]
{
const ROOT: &str = "src/avx2/";
let paths = FILES.iter().map(|file| format!("{}{}.S", ROOT, file));
cc::Build::new()
.include(ROOT)
.files(paths)
.compile("pqc_kyber");
}
}
}
}