Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix OHOS_ARCH mapping
Browse files Browse the repository at this point in the history
justsmth committed Jan 8, 2025
1 parent 7ec6073 commit f0e3898
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions aws-lc-sys/builder/cmake_builder.rs
Original file line number Diff line number Diff line change
@@ -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,
@@ -176,21 +184,20 @@ 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:?}"));
env::set_var("CFLAGS", cflags);
return cmake_cfg;
} else {
// We only consider compiler CFLAGS when no cmake toolchain is set
let compiler_cflags = self.collect_compiler_cflags();
cflags.push(" ");
cflags.push(&compiler_cflags);
emit_warning(&format!("Setting CFLAGS: {cflags:?}"));
env::set_var("CFLAGS", cflags);
}
// We only consider compiler CFLAGS when no cmake toolchain is set
let compiler_cflags = self.collect_compiler_cflags();
cflags.push(" ");
cflags.push(&compiler_cflags);
emit_warning(&format!("Setting CFLAGS: {cflags:?}"));
env::set_var("CFLAGS", cflags);

// See issue: https://github.com/aws/aws-lc-rs/issues/453
if target_os() == "windows" {

0 comments on commit f0e3898

Please sign in to comment.