[QBS] How qbs searchs for modules?

Tom Sutcliffe devtomsci at me.com
Wed Apr 11 15:44:16 CEST 2012


That'll be the id:"compiler" line in your ocaml qbs. I'm not an expert on writing rules, but I know that ids don't have quotes. So it should be:

id: compiler

or somesuch.

Regards,

Tom

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

> Hmm, now module is found but another error is raised: `ERROR: id: must be followed by identifier`. Qbs shows neither filename, neither line number. After commenting line `Depends { name: "ocaml" }` this error is gone.
>
>  
> https://gist.github.com/2359311
> -- 
> Best wishes,
> Kakadu
>  
>  P.S. btw, I've missed in html help how to add directories for searching includes, for example QDeclarativeContext. Is adding `Depends { name: "Qt.declarative" }` a right solution?
>  
> 11.04.2012, 17:17, "Tom Sutcliffe" <devtomsci at me.com>:
>> 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/3ff1f92c/attachment.html>


More information about the Qbs mailing list