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

Denis Shienkov denis.shienkov at gmail.com
Wed May 28 12:46:00 CEST 2014


Christian, many thanks for your help. :)

This code works:

DynamicLibrary {

     name: "hasp_windows_88149"


     Transformer {

        Artifact {

            fileName: product.targetName + ".dll"

            fileTags: "dynamiclibrary"

        }

        Artifact {

            fileName: product.targetName + ".lib"

            fileTags: "dynamiclibrary_import"

        }

        prepare: {

            var commands = []

            for (var tag in outputs) {

                for (var index in outputs[tag]) {

                    var artifact = outputs[tag][index];

                    var cmd = new JavaScriptCommand();

                    cmd.sourceFile = product.sourceDirectory + "/" +
FileInfo.fileName(artifact.filePath);

                    cmd.description = "copying " +
FileInfo.fileName(cmd.sourceFile);

                    cmd.highlight = "codegen";

                    cmd.targetFilePath = artifact.filePath;

                    cmd.sourceCode = function() {
File.copy(sourceFile, targetFilePath); }

                    commands.push(cmd);

                }

            }

            return commands;

        }

     }

}



BR,
Denis




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

> On 05/28/2014 11:59 AM, Denis Shienkov wrote:
> > 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"
> >
> >          }
>
> I think you also need to add the .lib file here with the file tag
> "dynamiclibrary_import".
>
>
> Christian
>
>
> >
> >          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..
>
> _______________________________________________
> 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/9d5d10d0/attachment.html>


More information about the Qbs mailing list