Skip to content

Commit

Permalink
build: Enhance cross-platform compatibility for Go build command
Browse files Browse the repository at this point in the history
- Introduced cross-platform support for the Go build command in the gnark-ffi's build.rs script.
- Enhanced detection of the current operating system to set the appropriate GOOS environment variable.
  • Loading branch information
huitseeker committed Sep 18, 2024
1 parent ca26e31 commit 527111d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions recursion/gnark-ffi/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,20 @@ fn main() {
return;
}

// Detect current OS and set GOOS accordingly
let goos = match env::consts::OS {
"macos" => "darwin",
"linux" => "linux",
"windows" => "windows",
_ => panic!("Unsupported OS"),
};


// Run the go build command
let status = Command::new("go")
.current_dir("go")
.env("CGO_ENABLED", "1")
.env("GOOS", goos) // Set GOOS based on the current OS
.args([
"build",
"-o",
Expand Down

0 comments on commit 527111d

Please sign in to comment.