Skip to content

Commit

Permalink
Fix OHOS_ARCH mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Jan 8, 2025
1 parent 7ec6073 commit 5a46a71
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions aws-lc-sys/builder/cmake_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ fn find_cmake_command() -> Option<OsString> {
}
}

fn map_to_ohos_arch(arch: &str) -> String {
match arch {
"aarch64" => "arm64-v8a".to_string(),
"arm" | "armv7" => "armeabi-v7a".to_string(),
_ => arch.to_string(),
}
}

impl CmakeBuilder {
pub(crate) fn new(
manifest_dir: PathBuf,
Expand Down Expand Up @@ -176,8 +184,8 @@ impl CmakeBuilder {
"CMAKE_TOOLCHAIN_FILE environment variable set: {toolchain}"
));
if target_env() == "ohos" {
// The Open Harmony toolchain requires the following tweaks
cmake_cfg.define("OHOS_ARCH", target_arch());
// The Open Harmony toolchain requires the following tweaks
cmake_cfg.define("OHOS_ARCH", map_to_ohos_arch(&target_arch()));
cflags.push(" -Wno-unused-command-line-argument");
}
emit_warning(&format!("Setting CFLAGS: {cflags:?}"));
Expand Down

0 comments on commit 5a46a71

Please sign in to comment.