> 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
> 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" }
>     }
> }

Looking at your project: Lib is multiplexed while app is not. Lib does not
have an aggregator. App does not constraint the dependency on lib.

In that case Qbs resoles the dependency as follows: app depends on all
variants of lib at the same time ("hostProfile" and "targetProfile"). I
think this could explain the error you are seeing and should be case 3b in
both, Qbs 1.15 and 1.16:
https://code.qt.io/cgit/qbs/qbs.git/tree/src/lib/corelib/language/moduleloader.cpp?h=1.15#n1108
https://code.qt.io/cgit/qbs/qbs.git/tree/src/lib/corelib/language/moduleloader.cpp?h=1.16#n1148

(Dependency matching will be a bit relaxed in Qbs 1.16, but it shouldn't
affect your case at all).

I think you should write:

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

    Depends { name: "lib"; profiles: "targetProfile" }
}

to constraint the dependency (and make case 3c.).

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

Reply via email to