[QBS] How to use linking dependences of the third-party libraries

Denis Shienkov denis.shienkov at gmail.com
Wed May 28 11:59:59 CEST 2014


Christian,

>So you want a kind of pseudo-product (or module, perhaps?) that acts as
a wrapper around some existing binary?

Yes, exactly.

> In that case, couldn't you just
create a Transformer that does nothing except specifying the artifact?

Does not work, a linker do not receive a name of library (of my wrapper) in
process of linking of application...

== ext_qbs.qbs ==

Project {

    references: [

        "hasp/hasp.qbs",

        "app/app.qbs",

    ]

}


== ext_qbs\app\app.qbs ==

Application {

    name: "app"

    Depends { name: "cpp" }

    Depends { name: "hasp_windows_88149" }

    files: [ "app.cpp" ]

}

== ext_qbs\hasp\hasp.qbs ==


DynamicLibrary {

    name: "hasp_windows_88149"

    files: [ "hasp_api.h" ]

    Transformer {

        Artifact {

            fileName: "hasp_windows_88149.dll"

            fileTags: "dynamiclibrary"

        }

        prepare: {

            var cmd = new JavaScriptCommand();

            cmd.silent = true;

            cmd.source = function() { };

            return cmd;

        }

    }

    Export {

        Depends { name: "cpp" }

        cpp.includePaths: "."

    }

}

where "ext_qbs\hasp\" contains an two binary file:
- hasp_windows_88149.dll
- hasp_windows_88149.lib

I don't understand, why the "hasp_windows_88149" do not exports
implicity of cpp.dynamicLibraries property?

But if I do it explicity:

    Export {        Depends { name: "cpp" }        cpp.includePaths:
"."        cpp.dynamicLibraries: path + "/" + targetName    }

then all linked fine.. But this hardcode is ugly, IMHO..


BR,
Denis





















2014-05-28 12:57 GMT+04:00 Christian Kandeler <christian.kandeler at digia.com>
:

> On 05/27/2014 07:49 PM, Denis Shienkov wrote:
> > Christian,
> >
> >  > Sorry, this is so weird I don't even know where to start.
> >
> > A problem is in that I too don't know where to start. :)
> >
> >  > Perhaps you want cpp.dynamicLibraries?
> >
> > Yes, something like..
> >
> > I want to create a some Product1, which can export a ready (source) of
> > linking (*.lib) and runtime (*.dll) libraries.
> > And at "build" stage, the *.lib file should be copied into my output
> > "/Project/Lib" directory, and the *.dll file should be copied into
> > output "/Project" directory. And nothing anymore.
>
> So you want a kind of pseudo-product (or module, perhaps?) that acts as
> a wrapper around some existing binary? In that case, couldn't you just
> create a Transformer that does nothing except specifying the artifact?
>
> DynamicLibrary {
>      name: "libsoandso"
>      Transformer {
>         Artifact {
>             fileName: <file path to existing lib>
>             fileTags: "dynamiclibrary"
>         }
>         prepare: {
>             var cmd = new JavaScriptCommand();
>             cmd.silent = true;
>             cmd.source = function() { };
>             return cmd;
>         }
> }
>
>
> Not sure why you want to copy files around, though.
>
>
> Christian
>
>
> >
> > Then in the Product2 or Product3 I should be able to specify an
> > dependence from Product1, like:
> >
> > Product1 {
> > name: "foo"
> >
> > // do something Rules/Transformer (yes??) to copy an *.lib and *.dll
> > files into desired directories
> >
> > // do something to export the cpp.dynamicLibraries ???
> > }
> >
> > Product2 {
> > name: "myapp1"
> >
> > Depends { name: "foo" }
> >
> > }
> >
> > Product3 {
> > name: "myapp2"
> >
> > Depends { name: "foo" }
> >
> > }
> >
> > then in this case my "myapp1" and "myapp2" should be linked with the
> > ".lib", which provided from the "foo" Product1.
> >
> > But I don't know how to implement the Product1 (or something else
> > entity??) for my purpose. Maybe is a more elegant solution? I don't
> know..
> >
> > Maybe I should to use:
> >
> >       Export {
> >           Depends { name: "cpp" }
> >           cpp.dynamicLibraries: [<path to *.lib library>]
> >       }
> >
> > in my Product1? But I do not understand how I can specify a full path
> > (yes??) or name to my "/Project/Lib/foo.lib" which is copied to output
> > "/Project/Lib/". And then where I should to specify my "*.lib/*.dll"
> > libraries in my Product1?
> >
> > BR,
> >
> > Denis
> >
> > 27.05.2014 17:04, Christian Kandeler пишет:
> >> On 05/27/2014 12:03 PM, Denis Shienkov wrote:
> >>> Guys, can someone help me, please? :)
> >> Sorry, this is so weird I don't even know where to start. The fact that
> >> you add DLLs as source files takes me right out, for instance. Perhaps
> >> you want cpp.dynamicLibraries? I can only guess.
> >>
> >>
> >> Christian
> >> _______________________________________________
> >> QBS mailing list
> >> QBS at qt-project.org
> >> http://lists.qt-project.org/mailman/listinfo/qbs
> >
>
> _______________________________________________
> QBS mailing list
> QBS at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20140528/0268bf2d/attachment.html>


More information about the Qbs mailing list