Make the cflags property configurable

So that you can use select statements on it. The current modivation
is to convert a module from make to bp with minimal soong config
variable boilerplate.

Bug: 342006386
Bug: 346922064
Test: m nothing --no-skip-soong-tests
Change-Id: I48d5a11ad3aa65c24cc199458634a5fdbeab2f64
This commit is contained in:
Cole Faust
2024-06-13 14:51:14 -07:00
parent a551b011d0
commit e96c16a806
5 changed files with 19 additions and 13 deletions

View File

@@ -236,7 +236,8 @@ func (b *bindgenDecorator) GenerateSource(ctx ModuleContext, deps PathDeps) andr
esc := proptools.NinjaAndShellEscapeList
// Filter out invalid cflags
for _, flag := range b.ClangProperties.Cflags {
cflagsProp := b.ClangProperties.Cflags.GetOrDefault(ctx, nil)
for _, flag := range cflagsProp {
if flag == "-x c++" || flag == "-xc++" {
ctx.PropertyErrorf("cflags",
"-x c++ should not be specified in cflags; setting cpp_std specifies this is a C++ header, or change the file extension to '.hpp' or '.hh'")
@@ -248,7 +249,7 @@ func (b *bindgenDecorator) GenerateSource(ctx ModuleContext, deps PathDeps) andr
}
// Module defined clang flags and include paths
cflags = append(cflags, esc(b.ClangProperties.Cflags)...)
cflags = append(cflags, esc(cflagsProp)...)
for _, include := range b.ClangProperties.Local_include_dirs {
cflags = append(cflags, "-I"+android.PathForModuleSrc(ctx, include).String())
implicits = append(implicits, android.PathForModuleSrc(ctx, include))