Skip to content

Commit

Permalink
Set CFLAGS; Emit warning
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Aug 22, 2024
1 parent 0d7ff14 commit 8139f90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 8 additions & 6 deletions aws-lc-sys/builder/cc_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ mod x86_64_unknown_linux_gnu;
mod x86_64_unknown_linux_musl;

use crate::{
cargo_env, env_var_to_bool, execute_command, get_cflags, out_dir, target, target_arch,
target_os, target_vendor, OutputLibType,
cargo_env, emit_warning, env_var_to_bool, execute_command, get_cflags, out_dir, target,
target_arch, target_os, target_vendor, OutputLibType,
};
use std::path::PathBuf;

Expand All @@ -26,7 +26,7 @@ pub(crate) struct CcBuilder {
output_lib_type: OutputLibType,
}

use std::fs;
use std::{env, fs};

pub(crate) struct Library {
name: &'static str,
Expand Down Expand Up @@ -126,9 +126,11 @@ impl CcBuilder {
}

if !get_cflags().is_empty() {
get_cflags().split(' ').for_each(|flag| {
cc_build.flag_if_supported(flag);
});
let cflags = get_cflags();
emit_warning(&format!(
"AWS_LC_SYS_CFLAGS found. Setting CFLAGS: '{cflags}'"
));
env::set_var("CFLAGS", cflags);
}

self.add_includes(&mut cc_build);
Expand Down
6 changes: 5 additions & 1 deletion aws-lc-sys/builder/cmake_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ impl CmakeBuilder {
}

if !get_cflags().is_empty() {
cmake_cfg.cflag(get_cflags());
let cflags = get_cflags();
emit_warning(&format!(
"AWS_LC_SYS_CFLAGS found. Setting CFLAGS: '{cflags}'"
));
env::set_var("CFLAGS", cflags);
}

// Allow environment to specify CMake toolchain.
Expand Down

0 comments on commit 8139f90

Please sign in to comment.