Transitive dependencies in soong for CC

283 views
Skip to first unread message

Wesolowski, Krzysztof

unread,
Aug 29, 2020, 2:04:22 PM8/29/20
to Android Building
Hello,

When I build big CMake based project handling numerous static libraries its composed from is quite easy - both include directories and linking is transitive (using PUBLIC keyword)

In soong I end up with binaries listing all dependencies from dependency tree, and on top of that I need to export header files from each static library with export_static_lib_headers so at list intermediate static libraries can avoid listing its own trees.

Am I missing something or is the model of "many small static libs" not supported by design?

BR, 

Krzysztof Wesolowski

Evan Fisher

unread,
Feb 2, 2023, 1:42:16 PM2/2/23
to Android Building
Hello,
I am running into the same issue. Is there a way around this?

Example libfoo that depends on libbar in its implementation (only includes libbar in "foo.cc", not "foo.h"):
cc_library_shared {
   name: "libfoo",
   srcs: "foo.cc",
   shared_libs: ["libbar"],
   export_include_dirs: ["."]
}

Then, if I want to make a binary that uses libfoo, I've found that I must do:
cc_binary {
   name: "mytest",
   srcs: "main.cc",
   shared_libs: ["libfoo", "libbar"]
}

I would expect there is a way to only list "libfoo" and have my executable linked to libbar due to the transitive dependency.

Is there a directive I'm missing to enable this? In CMake, there is PUBLIC vs PRIVATE linkage. I'm wondering if there is an analog in soong.

Thank you,
Evan

Reply all
Reply to author
Forward
0 new messages