universal-binaryqbs

How to install universal binary artifacts in qbs?


There is my qbs project:

Project {
    StaticLibrary {
        name: "targetLib"
        files: "main.cpp"

        bundle.isBundle: false

        multiplexByQbsProperties: "architectures"
        aggregate: true

        Group {
            fileTagsFilter: "bundle.content"
            qbs.install: true
            qbs.installSourceBase: buildDirectory
        }

        Depends { name: "nawesome" }
        Depends { name: "cpp" }
    }
}

On build I pass profile with set property cpp.architectures: ["arm64", "x86_64"].

As I understand multiplexing works in this way: one builds per every architecture and another one for aggregate to build universal binary. Aggregate set to its artifact tag "bundle.content" but it doesn't install.

I don't need non-universal binaries installed, so I need some way to eliminate them. Right now the only way I've found is:

        Group {
            condition: type.contains("bundle.content")
            fileTagsFilter: "staticlibrary"
            qbs.install: true
            qbs.installSourceBase: buildDirectory
        }

But I don't think this is good one.


Solution

  • From qbs 1.19 on, this should work transparently by just setting "install: true" on the StaticLibrary item (as it already does for non-multiplexed products). See https://codereview.qt-project.org/c/qbs/qbs/+/339928 for how multiplexing is handled there. But if your workaround does the trick, you could just as well keep using it until then.