-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI 2.0 - unified CI for C++, Go and RUST - PHASE1 #680
Changes from 55 commits
1306a84
620fcf6
94e4bb9
78d8ab7
481805e
fdf1389
f40e1a8
babe767
8e15d34
ec7717a
b8fdf11
666399d
b8ea011
20906e3
cbc7234
d8d543f
01cb8ce
cca941b
dcbeb2a
1490ba1
2f6633d
0d40632
4faa7e7
5467ee0
0d2e643
ad3f9df
9ba5067
50dc6c5
b418ffb
316109b
ad9ca09
1fd0614
72623f1
be1aaca
412da03
24b0dcb
76d0bda
729ff6f
a856cc8
4e4ce1a
83d2832
8bd2e55
4513004
9b75d0c
3ccd0e4
077b296
f46b554
b1962ba
b2a5ed7
ae3d55b
52cbf38
4320d59
3aefa1f
dae9ad1
86f88c6
eaac996
9f17364
5dba50b
8201c7d
bbe910f
87372b2
55198df
d1ecf6b
0ef87c5
a49d46a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,91 @@ | ||
use std::env; | ||
use std::path::PathBuf; | ||
// use std::env; | ||
// use std::path::PathBuf; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please remove commented code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
||
fn main() { | ||
// Retrieve environment variables | ||
let out_dir = env::var("OUT_DIR").expect("OUT_DIR is not set"); | ||
// fn main() { | ||
// // Retrieve environment variables | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about the rest of the curves/fields? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 761 was the only curve using a build that relies on another curve bls12-377 (probably due to legacy code). so only 761 needs that update. new build script was tested and is running on the new CI |
||
// let out_dir = env::var("OUT_DIR").expect("OUT_DIR is not set"); | ||
|
||
// Construct the path to the build directory | ||
let build_dir = PathBuf::from(format!("{}/../../../", &out_dir)); | ||
// // Construct the path to the build directory | ||
// let build_dir = PathBuf::from(format!("{}/../../../", &out_dir)); | ||
|
||
// // Construct the path to the deps directory | ||
// let deps_dir = build_dir.join("deps"); | ||
|
||
// println!("cargo:rustc-link-arg=-Wl,-rpath,{}/icicle/lib", deps_dir.display()); // Add RPATH linker arguments | ||
|
||
// // default backends dir | ||
// if cfg!(feature = "cuda_backend") || cfg!(feature = "pull_cuda_backend") { | ||
// println!( | ||
// "cargo:rustc-env=ICICLE_BACKEND_INSTALL_DIR={}/icicle/lib/backend", | ||
// deps_dir.display() | ||
// ); | ||
// } | ||
// } | ||
|
||
use cmake::Config; | ||
use std::{env, path::PathBuf}; | ||
|
||
fn main() { | ||
// Construct the path to the deps directory | ||
let out_dir = env::var("OUT_DIR").expect("OUT_DIR is not set"); | ||
let build_dir = PathBuf::from(format!("{}/../../../", &out_dir)); | ||
let deps_dir = build_dir.join("deps"); | ||
|
||
println!("cargo:rustc-link-arg=-Wl,-rpath,{}/icicle/lib", deps_dir.display()); // Add RPATH linker arguments | ||
// Construct the path to icicle source directory | ||
let main_dir = env::current_dir().expect("Failed to get current directory"); | ||
let icicle_src_dir = PathBuf::from(format!("{}/../../../../icicle", main_dir.display())); | ||
|
||
println!("cargo:rerun-if-env-changed=CXXFLAGS"); | ||
println!("cargo:rerun-if-changed={}", icicle_src_dir.display()); | ||
|
||
// Base config | ||
let mut config = Config::new(format!("{}", icicle_src_dir.display())); | ||
// Check if ICICLE_INSTALL_DIR is defined | ||
let icicle_install_dir = if let Ok(dir) = env::var("ICICLE_INSTALL_DIR") { | ||
PathBuf::from(dir) | ||
} else { | ||
// Define the default install directory to be under the build directory | ||
PathBuf::from(format!("{}/icicle/", deps_dir.display())) | ||
}; | ||
config | ||
.define("CURVE", "bw6_761") | ||
.define("HASH", "OFF") | ||
.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") { | ||
config.define("CUDA_BACKEND", "main"); | ||
} | ||
if cfg!(feature = "metal_backend") { | ||
config.define("METAL_BACKEND", "local"); | ||
} else if cfg!(feature = "pull_metal_backend") { | ||
config.define("METAL_BACKEND", "main"); | ||
} | ||
|
||
// Build | ||
let _ = config | ||
.build_target("install") | ||
.build(); | ||
|
||
println!("cargo:rustc-link-search={}/lib", icicle_install_dir.display()); | ||
println!("cargo:rustc-link-lib=icicle_field_bw6_761"); | ||
println!("cargo:rustc-link-lib=icicle_curve_bw6_761"); | ||
println!("cargo:rustc-link-lib=icicle_hash"); | ||
println!("cargo:rustc-link-arg=-Wl,-rpath,{}/lib", icicle_install_dir.display()); // Add RPATH linker arguments | ||
|
||
// default backends dir | ||
// default backends dir | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove line |
||
if cfg!(feature = "cuda_backend") || cfg!(feature = "pull_cuda_backend") { | ||
if cfg!(feature = "cuda_backend") | ||
|| cfg!(feature = "pull_cuda_backend") | ||
|| cfg!(feature = "metal_backend") | ||
|| cfg!(feature = "pull_metal_backend") | ||
{ | ||
println!( | ||
"cargo:rustc-env=ICICLE_BACKEND_INSTALL_DIR={}/icicle/lib/backend", | ||
deps_dir.display() | ||
"cargo:rustc-env=ICICLE_BACKEND_INSTALL_DIR={}/lib/backend", | ||
icicle_install_dir.display() | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is that commented out?
We still support 761
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
761 got a standalone build.rs and no longer relies on bls12-377. I will remove the comments