Skip to content

Commit

Permalink
chore: update build.rs to support arm target
Browse files Browse the repository at this point in the history
  • Loading branch information
kejianchi committed Apr 15, 2024
1 parent f84089d commit 3342536
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions build.rs
Expand Up @@ -177,24 +177,27 @@ fn build_v8() {
gn_args.push(arg.to_string());
}
}
// cross-compilation setup
if target_arch == "aarch64" {
gn_args.push(r#"target_cpu="arm64""#.to_string());
gn_args.push("use_sysroot=true".to_string());
maybe_install_sysroot("arm64");
maybe_install_sysroot("amd64");
}
if target_arch == "arm"{
gn_args.push(r#"target_cpu="arm""#.to_string());
gn_args.push(r#"v8_target_cpu="arm""#.to_string());
gn_args.push("use_sysroot=true".to_string());
maybe_install_sysroot("i386");
maybe_install_sysroot("arm");
}

let target_triple = env::var("TARGET").unwrap();
// check if the target triple describes a non-native environment
if target_triple != env::var("HOST").unwrap() {
// cross-compilation setup
if target_triple == "aarch64-unknown-linux-gnu"
|| target_triple == "aarch64-linux-android"
{
gn_args.push(r#"target_cpu="arm64""#.to_string());
gn_args.push("use_sysroot=true".to_string());
maybe_install_sysroot("arm64");
maybe_install_sysroot("amd64");
};

if target_triple == "aarch64-linux-android" {
gn_args.push(r#"v8_target_cpu="arm64""#.to_string());
gn_args.push(r#"target_os="android""#.to_string());

gn_args.push("treat_warnings_as_errors=false".to_string());

// NDK 23 and above removes libgcc entirely.
Expand Down

0 comments on commit 3342536

Please sign in to comment.