1

I want to have a module which will export all needed dependencies like include path, library path and will install needed runtime libraries.

Module {
    Depends { name: "cpp" }
    property path libLocation: ""
    cpp.dynamicLibraries: [
        "mylib"
    ]
    cpp.staticLibraries: [
        "mylib"
    ]
    cpp.includePaths: [
        libLocation + "include/",
    ]
    cpp.libraryPaths: [
        libLocation + "lib/",
    ]
    Group {
        name: "runtime libraries"
        qbs.install: true
        prefix: 'lib_location/'
        files: ["*.dll"]
    }
}

Everything works, but files are not installed. Is it possible to do that?

Update 1:

Files are correctly installed:

  • if full or relative paths are specified directly(as literals)
  • by using Project's properties.

Working solution:

Module {
    ...
    Group {
        name: "runtime libraries"
        prefix: "D:/Projects/MyProject/Dependencies/SDL2pp/mingw/bin/" // works!
        //prefix: project.dependenciesPath + "SDL2pp/mingw/bin/" // also works!

        files: "*.dll"
        qbs.install: true
    }
}

But when I'm trying to use Module's property it says: "Reference Error: Can't find variable: ..."

Module {
    ...
    property bool installDlls: true
    property string libPath:  ""
    Group {
        name: "runtime libraries"
        prefix: libPath // Can't find variable
        files: "*.dll"
        qbs.install: installDlls // Can't find variable
    }
}

Also, It is not work if FileInfo module is used for building a path. Outside the Group path was corectly resolved.

import qbs
import qbs.FileInfo

Module {
    ...
    Group {
        name: "runtime libraries"
        prefix: FileInfo.joinPaths(project.dependenciesPaths, './SDL2pp/mingw/bin/') // silently not works
        files: "*.dll"
        qbs.install: true
    }
}

Conclusion
I've found 2 solutuins of it:

  • hadrcoded path as a literal. Unportable solution
  • using Project's property. Portable, but depends on Project item.

I don't know why Module's properties can't be used inside a Group. Are there some limitations or it's a bug?

Zak
  • 464
  • 3
  • 13
  • We've changed the location which Group paths are relative to, when located in modules. What version of Qbs are you using and are you sure "lib_location/" is being resolved to the correct absolute path? – Jake Petroules Apr 06 '17 at 15:07
  • @JakePetroules Qbs version: 1.7.1. I was wrong by saying that it's not installed at all. I've updated my question with details about it. – Zak Apr 11 '17 at 09:32

1 Answers1

1

Late but found this post trying to do the same, maybe it helps other people. Found out that using a Module's property inside a Group can be done by giving the Module an id and referencing the property using the id like this

Module { id: mymodule ... property bool installDlls: true property string libPath: "" Group { name: "runtime libraries" prefix: mymodule.libPath files: "*.dll" qbs.install: mymodule.installDlls } }

I'm using Qbs 1.12.1

An Ky
  • 113
  • 11