[QBS] How qbs searchs for modules?

Tom Sutcliffe devtomsci at me.com
Wed Apr 11 15:17:24 CEST 2012


Hi Kakadu,

The default module search path is to look in $QBS_SOURCE_DIR/share/qbs/modules for a *directory* matching the module name, and to use the first .qbs file in that directory (well, the first whose condition evaluates to true, I think). I asked Joerg whether that behaviour was strictly necessary (why can't it just look for a file called modulename.qbs?) and I think the answer was that there isn't a hugely strong reason why it can't do both, but that's the way it behaves currently. I didn't get round to raising a bug.

You can override the default search path by including a "moduleSearchPaths" key in your project or product, eg:

Project {
    moduleSearchPaths: "." // search the current directory as well
    Product {
        ...
        Depends { name:"ocaml" }
    }
}

But that will still need the qbs file in a subdirectory:

./myproject.qbp
./ocaml/TheNameOfThisDoesntMatter.qbs

 You don't need the "import OCamlModule" line, that is not used for modules (only for building blocks, or whatever QML calls them). It's worth raising a bug regarding the subdirectory thing, if it bothers you. For simple modules it is a bit overkill and can make directory layout unnecessarily deep.

Cheers,

Tom




On 11 Apr, 2012,at 01:54 PM, Kakadu <KakaduHafanana at yandex.ru> wrote:

> Hello!
>
> I want to implement a build system for OCaml language. And (AFAU) I should write specific module and set some rules.
>
> $ cat OCamlModule.qbs
> import qbs.base 1.0
>
> Module {
> name: "ocaml"
> FileTagger {
> pattern: "*.ml"
> fileTags: ["ml"]
> }
> Rule {
> id: "compile"
> prepare: {
> var cmd = new Command("ocaml -c", input.basename );
> return cmd;
>
> }
> }
> }
> $ cat test2.qbp
> import qbs.base 1.0
> //import OCamlModule 1.0 as OCaml
>
> Application {
> name: "helloworld"
> files: ["main.cpp", "a.ml"]
> Depends { name: "Qt.core" }
> Depends { name: "cpp" }
> Depends { name: "Qt.declarative" }
> // Depends { name: "OCaml" }
> }
>
> I have put OCamlModule.qbs to the same directory where qbp file is located. But qbs can see my module? How to explain qbs where search dependencies? Or Maybe I can put everything in the whole file?
> -- 
> Best wishes,
> Kakadu
> _______________________________________________
> QBS mailing list
> QBS at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs
> Hi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20120411/9b604fb6/attachment.html>


More information about the Qbs mailing list