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

Denis Shienkov denis.shienkov at gmail.com
Mon May 26 10:48:36 CEST 2014


Hi guys..

In my project I want linking with an third-party HASP libraries (as
example).

E.g. from the HASP I have an only one linking library (*.lib) and one
runtime library (*.dll).
How I can use those libraries to linking with them?

I tried to create for them a separate product:

import qbs.base 1.0

import qbs.FileInfo

import qbs.File


Product {

    name: "hasp_windows_88149"

    type: [ "hasp_api_lib_out", "hasp_api_dll_out" ]


    Depends { name: "cpp" }


    Group {

        name: "linked"

        files: [ "hasp_windows_88149.lib" ]

        fileTags: [ "hasp_api_lib" ]

    }

        Group {

        name: "shared"

        files: [ "hasp_windows_88149.dll" ]

        fileTags: [ "hasp_api_dll" ]

    }



    Rule {

        id: haspLinkingResource

        inputs: [ "hasp_api_lib" ]


        Artifact {

            fileTags: [ "hasp_api_lib_out" ]

            fileName: "Lib/" + FileInfo.fileName(input.filePath);

        }


        prepare: {

            var cmd = new JavaScriptCommand();

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

            cmd.sourceCode = function() { File.copy(input.filePath,
output.filePath); }

            return cmd;

        }

    }


    Rule {

        id: haspRuntimeResource

        inputs: [ "hasp_api_dll" ]


        Artifact {

            fileTags: [ "hasp_api_dll_out" ]

            fileName: FileInfo.fileName(input.filePath);

        }


        prepare: {

            var cmd = new JavaScriptCommand();

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

            cmd.sourceCode = function() { File.copy(input.filePath,
output.filePath); }

            return cmd;

        }

    }

}


After "building" of this product I see that source (*.lib) and (*.dll)
files are copied to desired output directories.. All fine..

But if I want to use this libraries from another product of my project
(want to linking with them), then I failure.
E.g from another product I want to depend from HASP:

Application {

    name: "MyApp"


    ...

    Depends { name: "hasp_windows_88149" }

    ...


    files: [
...

        "appfoo.cpp",


...

    ]

}


How I can solve this issue?

BR,
Denis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20140526/2f7642be/attachment.html>


More information about the Qbs mailing list