Skip to content
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

build(fix): add env pass through for cmake_osx_sysroot #50

Merged
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ fn main() {
},
}
env::set_current_dir(build_dir).unwrap();

let host = env::var("HOST").unwrap();
// println!("host: {}", host);
let target = env::var("TARGET").unwrap();
if target.contains("windows") {
// println!("target: {}", target);
if host.contains("windows") && target.contains("windows-msvc") {
let c = Command::new("cmake")
.arg("-G")
.arg("Visual Studio 16 2019")
Expand Down Expand Up @@ -103,7 +107,7 @@ fn main() {
std::io::stderr().write_all(&m.stderr).unwrap();
assert!(m.status.success());
} else if target.contains("aarch64-apple-darwin") {
let c = Command::new("cmake")
let mut c = Command::new("cmake")
leet4tari marked this conversation as resolved.
Show resolved Hide resolved
.arg("-D")
leet4tari marked this conversation as resolved.
Show resolved Hide resolved
.arg("ARCH=arm64")
.arg("-D")
Expand All @@ -115,7 +119,11 @@ fn main() {
.arg("-D")
.arg("CMAKE_C_FLAGS='-arch arm64'")
.arg("-D")
.arg("CMAKE_CXX_FLAGS='-arch arm64'")
.arg("CMAKE_CXX_FLAGS='-arch arm64'");
if let Ok(env) = env::var("RANDOMX_RS_CMAKE_OSX_SYSROOT") {
c = c.arg("-D").arg("CMAKE_OSX_SYSROOT=".to_owned() + env.as_str())
};
c = c
leet4tari marked this conversation as resolved.
Show resolved Hide resolved
.arg(repo_dir.to_str().unwrap())
.output()
.expect("failed to execute CMake");
Expand Down Expand Up @@ -144,6 +152,7 @@ fn main() {
std::io::stdout().write_all(&c.stdout).unwrap();
std::io::stderr().write_all(&c.stderr).unwrap();
assert!(c.status.success());

let m = Command::new("make").output().expect("failed to execute Make");
println!("status: {}", m.status);
std::io::stdout().write_all(&m.stdout).unwrap();
Expand Down