I am writing Android.bp
file for one of the prebuild library. In Android.mk
It was possible to add CFlags for prebuilt library; however same is not working in case of blueprint i.e. Android.bp
. A snippet of what I am doing is below:
cc_prebuilt_library_shared {
name: "samplelib",
vendor_available:true,
cflags: [
"-Wall",
"-Wextra",
"-Werror",
],
tags: [
"optional",
"eng",
"debug",
],
target: {
android_x86:{
srcs: ["bin/x86/samplelib.so"],
compile_multilib: "32",
relative_install_path: "lib",
},
android_x86_64:{
srcs: ["bin/x86_64/samplelib.so"],
compile_multilib: "64",
relative_install_path: "lib64",
},
},
}
However I am getting following error:
/Android.bp:5:11: unrecognized property "cflags"
So if I understand correctly, cflags
can't be used with cc_prebuilt_library_shared
module; if that's the case how can we enable CFlags
for this module then ?
This might not sounding relevant; but the fix was setting LOCAL_STRIP_MODULE
to None and removing cflags
from the Android.bp
file. So working snippet looks like this:
cc_prebuilt_library_shared {
name: "samplelib",
vendor_available:true,
tags: [
"optional",
"eng",
"debug",
],
target: {
android_x86:{
srcs: ["bin/x86/samplelib.so"],
compile_multilib: "32",
relative_install_path: "lib",
},
android_x86_64:{
srcs: ["bin/x86_64/samplelib.so"],
compile_multilib: "64",
relative_install_path: "lib64",
},
},
strip: {
none:true,
},
}
Notice "strip"
attribute which is set to none and cflags
is also removed.
Note: "strip"
attribute is blueprint version of LOCAL_STRIP_MODULE
of makefile.