1 | initial version |
This is a possible solution using Android.bp (the Soong replacement for the Andoird make based built system). It works for the example found in the Android tree at (android-8.1.0_r52)
development/ndk/tests/prebuilt-library/jni
Now when typing "mm" i.e.
android-8.1.0_r52/development/ndk/tests/prebuilt-library/jni$ mm
The prebuilt shared libraries are linked and their export includes are found. Here are the steps (I'm in the process of trying this with my opencv project):
The steps above result in a native executable in a foo-user_exe in bullhead/system/bin/
Although this means I have to rewrite my existing Android.mk into a Android.bp, there are tools that can do this for you. i.e. "androidmk Android.mk > Android.bp"
Android.bp-top
subname = "Android.bp"
build = [
"build/blueprint/Blueprints",
]
subdirs = [
"build/soong",
]
optional_subdirs = [
"art",
"bionic",
"bootable/recovery",
"build/kati",
"build/tools/*",
"dalvik",
"development/*",
"development/ndk/tests/prebuilt-library/jni",
"device/*/*",
"external/*",
"frameworks/*",
"frameworks/compile/*",
"frameworks/hardware/interfaces",
"frameworks/opt/net/wifi",
"hardware/*",
"libcore",
"libnativehelper",
"packages/apps/*",
"prebuilts/clang/host/linux-x86",
"prebuilts/ndk",
"prebuilts/sdk",
"system/*",
"system/hardware/interfaces",
"system/tools/*",
"test/vts",
"test/vts-testcase/*",
"vendor/*/*",
]
And the Android.bp
cc_prebuilt_library_shared {
name: "libfoo",
vendor: true,
compile_multilib: "both",
export_include_dirs: ["foo"],
target: {
android_arm: {
srcs: ["lib/libfoo.so"],
},
android_arm64: {
srcs: ["lib64/libfoo.so"],
},
},
strip: {
none:true,
},
}
cc_library_shared {
name: "foo-user",
srcs: ["foo-user.c"],
shared_libs: ["libfoo"],
}
cc_binary {
name: "foo-user_exe",
srcs: ["foo-user.c"],
shared_libs: ["libfoo"],
stl: "none",
}