Skip to content

Commit

Permalink
fix build.rs bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
yshekel committed Aug 21, 2024
1 parent 989192f commit 3dfd16a
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 23 deletions.
4 changes: 2 additions & 2 deletions examples/rust/polynomials/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ ICICLE_CUDA_SOURCE_DIR="${ICILE_DIR}/backend/cuda"
# Build Icicle and the example app that links to it
if [ "$DEVICE_TYPE" == "CUDA" ] && [ ! -d "${ICICLE_BACKEND_INSTALL_DIR}" ] && [ -d "${ICICLE_CUDA_SOURCE_DIR}" ]; then
echo "Building icicle with CUDA backend"
cargo build --release --no-default-features --features=cuda
cargo build --release --features=cuda
export ICICLE_BACKEND_INSTALL_DIR=$(realpath "./target/release/deps/icicle/lib/backend")
cargo run --release --no-default-features --features=cuda -- --device-type "${DEVICE_TYPE}"
cargo run --release --features=cuda -- --device-type "${DEVICE_TYPE}"
else
echo "Building icicle without CUDA backend, ICICLE_BACKEND_INSTALL_DIR=${ICICLE_BACKEND_INSTALL_DIR}"
export ICICLE_BACKEND_INSTALL_DIR="$ICICLE_BACKEND_INSTALL_DIR";
Expand Down
8 changes: 4 additions & 4 deletions wrappers/rust_v3/icicle-curves/icicle-bls12-377/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ fn main() {
// build (or pull and build) cuda backend if feature enabled.
// Note: this requires access to the repo
if cfg!(feature = "cuda_backend") {
config.define("CUDA_BACKEND", "local");
config_bw.define("CUDA_BACKEND", "local");
} else if cfg!(feature = "pull_cuda_backend") {
config.define("CUDA_BACKEND", "main");
config_bw.define("CUDA_BACKEND", "main");
}

// Optional Features that are default ON (so that default matches any backend)
if cfg!(feature = "no_g2") {
config.define("G2", "OFF");
config_bw.define("G2", "OFF");
}
if cfg!(feature = "no_ecntt") {
config.define("ECNTT", "OFF");
config_bw.define("ECNTT", "OFF");
}

// Build
Expand Down
3 changes: 2 additions & 1 deletion wrappers/rust_v3/icicle-curves/icicle-bls12-381/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ fn main() {
};
config
.define("CURVE", "bls12_381")
.define("FIELD", "bls12_381")
.define("CMAKE_BUILD_TYPE", "Release")
.define("CMAKE_INSTALL_PREFIX", &icicle_install_dir);

// build (or pull and build) cuda backend if feature enabled.
// Note: this requires access to the repo
if cfg!(feature = "cuda_backend") {
config.define("CUDA_BACKEND", "local");
} else if cfg!(feature = "pull_cuda_backend")
} else if cfg!(feature = "pull_cuda_backend") {
config.define("CUDA_BACKEND", "main");
}
// Optional Features that are default ON (so that default matches any backend)
Expand Down
2 changes: 1 addition & 1 deletion wrappers/rust_v3/icicle-curves/icicle-bn254/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn main() {
};
config
.define("CURVE", "bn254")
.define("CMAKE_BUILD_TYPE", "Debug")
.define("CMAKE_BUILD_TYPE", "Release")
.define("CMAKE_INSTALL_PREFIX", &icicle_install_dir);

// build (or pull and build) cuda backend if feature enabled.
Expand Down
12 changes: 7 additions & 5 deletions wrappers/rust_v3/icicle-curves/icicle-grumpkin/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ fn main() {
.define("CMAKE_BUILD_TYPE", "Release")
.define("CMAKE_INSTALL_PREFIX", &icicle_install_dir);

#[cfg(feature = "cuda_backend")]
config.define("CUDA_BACKEND", "local");

#[cfg(feature = "pull_cuda_backend")]
config.define("CUDA_BACKEND", "main");
// build (or pull and build) cuda backend if feature enabled.
// Note: this requires access to the repo
if cfg!(feature = "cuda_backend") {
config.define("CUDA_BACKEND", "local");
} else if cfg!(feature = "pull_cuda_backend") {
config.define("CUDA_BACKEND", "main");
}

// Build
let _ = config
Expand Down
12 changes: 7 additions & 5 deletions wrappers/rust_v3/icicle-fields/icicle-babybear/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ fn main() {
.define("CMAKE_BUILD_TYPE", "Release")
.define("CMAKE_INSTALL_PREFIX", &icicle_install_dir);

#[cfg(feature = "cuda_backend")]
config.define("CUDA_BACKEND", "local");

#[cfg(feature = "pull_cuda_backend")]
config.define("CUDA_BACKEND", "main");
// build (or pull and build) cuda backend if feature enabled.
// Note: this requires access to the repo
if cfg!(feature = "cuda_backend") {
config.define("CUDA_BACKEND", "local");
} else if cfg!(feature = "pull_cuda_backend") {
config.define("CUDA_BACKEND", "main");
}

// Build
let _ = config
Expand Down
12 changes: 7 additions & 5 deletions wrappers/rust_v3/icicle-runtime/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ fn main() {
.define("CMAKE_BUILD_TYPE", "Release")
.define("CMAKE_INSTALL_PREFIX", &icicle_install_dir);

#[cfg(feature = "cuda_backend")]
config.define("CUDA_BACKEND", "local");

#[cfg(feature = "pull_cuda_backend")]
config.define("CUDA_BACKEND", "main");
// build (or pull and build) cuda backend if feature enabled.
// Note: this requires access to the repo
if cfg!(feature = "cuda_backend") {
config.define("CUDA_BACKEND", "local");
} else if cfg!(feature = "pull_cuda_backend") {
config.define("CUDA_BACKEND", "main");
}

// Build
let _ = config
Expand Down

0 comments on commit 3dfd16a

Please sign in to comment.