QbsDeps¶
The QbsDeps
generator produces the necessary files for each dependency to be able to use the
qbs Depends
item to locate the dependencies. It can be used like:
from conan import ConanFile
class App(ConanFile):
settings = "os", "arch", "compiler", "build_type"
requires = "hello/0.1"
generators = "QbsDeps"
It is also possible to use QbsDeps
manually in the generate()
method:
from conan import ConanFile
from conan.tools.qbs import QbsDeps
class App(ConanFile):
settings = "os", "arch", "compiler", "build_type"
requires = "hello/0.1"
def generate(self):
deps = QbsDeps(self)
deps.generate()
The dependency to the application can be added using the Depends
item:
CppApplication {
Depends { name: "hello"; version: "0.1" }
files: "main.c"
qbs.installPrefix: ""
install: true
qbsModuleProviders: "conan"
moduleProviders.conan.installDirectory: "build"
}
Note that we are setting the qbsModuleProviders
property to "conan"
in order to tell
Qbs that dependencies are generated by Conan. We also set the installDirectory
property
of the conan
module provider to "build"
to tell the provider to look for generated files
in the build
directory within the source directory. It is also possible to set this value from
command line.
We install dependencies using the conan install
command.
$ conan install . --output-folder=build --build missing
Finally, we can build the project by simply calling Qbs:
$ qbs
Note, that Qbs helper will automatically set the conan.installDirectory
property when QbsDeps
generator is used.
See also
Check the Qbs helper for details.
Reference¶
- class QbsDeps(conanfile)¶
This class will generate a JSON file for each dependency inside the “conan-qbs-deps” folder. Each JSON file contains information necesary for Qbs
"conan" module provider
to be able to generate Qbs module files.- Parameters:
conanfile – The current recipe object. Always use
self
.
- property content¶
Returns all dependency information as a Python dict object where key is the dependency name and value is a dict with dependency properties.
- generate()¶
This method will save the generated files to the “conan-qbs-deps” directory inside the
conanfile.generators_folder
directory. Generates a single JSON file per dependency or component.