0

I'm building custom C++ binary to add to AOSP build and I need to use new Soong build (.bp) files (which is Bazel-based, I learned). By default, "name" of the module will become binary name, but i need to change it. Is there any way to do it?

So in the example below I would like the generated binary be "myzip"

cc_binary {
    name: "gzip",
    srcs: ["src/test/minigzip.c"],
    shared_libs: ["libz"],
    stl: "none",
}
Jin
  • 12,748
  • 3
  • 36
  • 41
Andy Victors
  • 335
  • 2
  • 9

1 Answers1

0

Use the stem property for this, for example:

cc_binary {
    name: "gzip",
    srcs: ["src/test/minigzip.c"],
    shared_libs: ["libz"],
    stl: "none",
    multilib: {
        lib32: {
            stem: "gzip",
        },
        lib64: {
            stem: "gzip64",
        },
    },
}
Mykola Khyliuk
  • 1,234
  • 1
  • 9
  • 16
  • Is that an official feature? Just failed to find official docs. Can I use stem on the same level as name and other properties? I do not need variants, just hard-coded custom name. – Andy Victors Nov 18 '20 at 17:00
  • Of course official, you can find it here https://ci.android.com/builds/submitted/6186764/linux/latest/view/soong_build.html for ```cc_binary```. Yes, use it on the same level like ```name``` property. – Mykola Khyliuk Nov 18 '20 at 17:17
  • Thanks this works generally (sadly it does not in my case 'cause I need to use it in combination with overrides: so both stem and override cause compilation error :/) – Andy Victors Nov 19 '20 at 07:17