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

Christian Kandeler christian.kandeler at theqtcompany.com
Mon Feb 2 14:56:13 CET 2015


On 02/01/2015 08:35 PM, Denis Shienkov wrote:
> Ahhh... Seems, it works with "dynamiclibrary_copy" instead of
> "dynamiclibrary_import ",
> but I'm not sure that it is correctly..

Yes, that's what we link against for gcc-like toolchains. It's a bit of 
an implementation detail, though.


Christian

> 01.02.2015 22:22, Denis Shienkov пишет:
>> 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
>>
>




More information about the Qbs mailing list