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

Denis Shienkov denis.shienkov at gmail.com
Sun Feb 1 20:22:48 CET 2015


Hi all.

I want to create a wrapper around of existing 3rd DLL on windows as a 
separate product.
This solution works only with the MSVC compiler, as says in here (in 
previous thread):

http://lists.qt-project.org/pipermail/qbs/2014-May/000807.html

My current snippet:

= dllwrap.qbs =

importqbs

import  qbs.FileInfo

import  qbs.File

DynamicLibrary  {

     name:  "mhstcan"

     Transformer  {

         Artifact  {

             filePath:  product.targetName  +  ".dll"  << existing runtime library

             fileTags:  "dynamiclibrary"

         }

         Artifact  {

             filePath:  product.targetName  +  ".lib"  << existing import library

             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;

         }

     }

}

== app.qbs ==

import  qbs


Application  {
     name:  "app"
     Depends  {  name:  "cpp"  }
     Depends  {  name:  "mhstcan"  }


     files:  [
         "app.cpp",
     ]
}


Briefly: I want to wrap the existing shared library mhstcan.dll (with import
mhstcan.lib), which is compiled in MSVC, but to using in MinGW compiler. But all
attempts are fails, because the linker does not called never.

Seems, that "dynamiclibrary_import"  is defined only for the MSVC compiler.
But the MinGW has nothing similar.

I tried to:

* use the "staticlibrary" instead of "dynamiclibrary_import"
* convert the *.lib import file to the *.a import file and to pass to Artifact with
   the "*.a" suffix

but nothing successfully - no linker called.

So, my question: is any trick for it?

PS: I use QBS from the QtCreator 3.3.0 + Qt 4.8.6

BR,
Denis


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20150201/72f413df/attachment.html>


More information about the Qbs mailing list