On Sun, 7 Oct 2018 15:17:17 +0300
Павел Лысенко via Qbs <[email protected]> wrote:

> >> I have a project with some cpp products.
> >> Also the project includes a non-cpp product.
> >> Non-cpp product depends on my custom module that creates a custom 
> >> deployment package.
> >> Module can process both cpp and non-cpp products (so it have application 
> >> input artifact). Also module use path to qt binaries from Qt.core module 
> >> (so it have dependency on Qt.core module)
> >> 
> >> If I configure the project by QtCreator to use MinGW, all works fine, but 
> >> if I use MSVC2017 (64 bit), it tries to link non-cpp product and fails 
> >> with unresolved symbol mainCRTStartup.
> >> Here is the short snippet that fails to build:
> >> 
> >> Project {
> >> Product{
> >> Depends{name:"Qt.core"}
> >> files:"main.txt"
> >> type:"test_output"
> >> Rule{
> >> inputs:["some_input_tag","application"]
> >> Artifact{
> >> filePath:"main.txt.output"
> >> fileTags:["test_output"]
> >> }
> >> prepare:{
> >> var cmd=new JavaScriptCommand();
> >> return [cmd];
> >> }
> >> }
> >> }
> >> }
> >> 
> >> It looks like Qt.core have a dependency on cpp module, it tries to create 
> >> an application artifact from 0 source files and fails on that. Is that a 
> >> known issue?  
> 
> >That's because the module has the Qt5Core.lib file as a target artifact, and 
> >the linker rule takes such files as inputs even if no source files are 
> >present. 
> >Use a redirection to prevent the cpp module from getting pulled in:  
> 
> >Project {
> >    Product {
> >        name: "QtPathProvider"
> >        Depends { name:"Qt.core" }
> >        Export {
> >            property string qtBinPath: product.Qt.core.binPath
> >            // ...
> >        }
> >    }
> >    Product {
> >        Depends { name: "QtPathProvider" }
> >        // Use QtPathProvider.qtBinPath below
> >        // ...
> >    }
> >}  
> Unfortunately, that is not working from a module.

In that case, you need to make the application input tag conditional, for 
instance via a property of the module. 
Or whatever else fits your concrete requirements. The main point is that if an 
application tag is present in the tag chain to the product type, then qbs will 
attempt to build one.


Christian
_______________________________________________
Qbs mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qbs

Reply via email to