forked from zkcrypto/bellman
-
Notifications
You must be signed in to change notification settings - Fork 128
Expand file tree
/
Copy pathbuild.rs
More file actions
30 lines (25 loc) · 833 Bytes
/
build.rs
File metadata and controls
30 lines (25 loc) · 833 Bytes
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
fn main() {
println!("cargo::rustc-check-cfg=cfg(nightly)");
cfg_if_nightly();
gpu_kernel();
}
#[rustversion::nightly]
fn cfg_if_nightly() {
println!("cargo:rustc-cfg=nightly");
}
#[rustversion::not(nightly)]
fn cfg_if_nightly() {}
/// The build script is used to generate the CUDA kernel and OpenCL source at compile-time, if the
/// `cuda` and/or `opencl` feature is enabled.
#[cfg(any(feature = "cuda", feature = "opencl"))]
fn gpu_kernel() {
use blstrs::{Fp, Fp2, G1Affine, G2Affine, Scalar};
use ec_gpu_gen::SourceBuilder;
let source_builder = SourceBuilder::new()
.add_fft::<Scalar>()
.add_multiexp::<G1Affine, Fp>()
.add_multiexp::<G2Affine, Fp2>();
ec_gpu_gen::generate(&source_builder);
}
#[cfg(not(any(feature = "cuda", feature = "opencl")))]
fn gpu_kernel() {}