Thanks Christian, that's really helpful!

I think I almost got it to work. The problem I have now is that the app seems 
to link against the wrong version of the library:

ld: warning: ignoring file 
/.../lib.eyJwcm9maWxlIjoiaG9zdFByb2ZpbGUifQ--.cd69e9f1/.tmp/lib, building for 
iOS-arm64 but attempting to link with file built for macOS-x86_64

I tried setting the profile for the app to "targetProfile" but it makes no 
difference. Also no bundles are generated for the library. There's only the 
binary in the hidden .tmp folder.

Here's a small test project I set up that has the issue. Note that I have to 
set qbs.targetPlatform to "macos" because qbs.hostPlatform is undefined. The 
docs only say 'Do not use this property'.

Project {
    Profile {
        name: "hostProfile"
        qbs.targetPlatform: "macos"
    }

    Profile {
        name: "targetProfile"
        baseProfile: project.profile
    }

    DynamicLibrary {
        name: "lib"
        files: ["lib.cpp"]
        multiplexByQbsProperties: ["profiles"]

        qbs.profiles: ["hostProfile", "targetProfile"]

        Depends { name: "cpp" }
    }

    CppApplication {
        consoleApplication: true
        name: "gen"
        files: ["gen.cpp"]

        qbs.profile: "hostProfile"

        Depends { name: "lib" }
    }

    CppApplication {
        name: "app"
        files: ["gen.cpp"]

        Depends { name: "lib" }
    }
}



Leon

________________________________
From: Qbs <qbs-boun...@qt-project.org> on behalf of Christian Kandeler 
<christian.kande...@qt.io>
Sent: Friday, March 20, 2020 3:47 PM
To: qbs@qt-project.org <qbs@qt-project.org>
Subject: Re: [Qbs] Building code generator and its dependencies for a different 
architecture than the rest of the products

On Fri, 20 Mar 2020 15:41:21 +0100
Christian Kandeler <christian.kande...@qt.io> wrote:

> Your app and build tool use normal Depends items for pulling in the library; 
> the matching should work automatically.

Addendum: Of course, you also need to set the host profile in your build tool:
    CppApplication {
        // ...
        qbs.profile: "hostProfile"
    }


Christian
_______________________________________________
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs
_______________________________________________
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs

Reply via email to