[QBS] Populate includes path to other products
Andrey Anpilogov
anpilog at gmail.com
Wed Jan 7 08:47:04 CET 2015
That was a holy grail!
Thanks, you are awesome.
2015-01-07 15:42 GMT+08:00 Dmitry Volosnykh <dmitry.volosnykh at gmail.com>:
> Do the following in your lib's Product item:
>
> Export {
> cpp.includePaths: "."
> }
>
>
> Besides, consider reading Export item's documentation for more info on
> exporting.
>
> On Wed, Jan 7, 2015 at 10:34 AM, Andrey Anpilogov <anpilog at gmail.com>
> wrote:
>
>> Thanks for advise, Dmitry.
>>
>> I've tried and id doesn't work.
>> Same problem...
>> I simplified test case. So now it's just qbs/examples/app-and-lib with
>> one extra header file.
>>
>> ----------------------------------
>> anpilog at Andriis-MacBook-Pro.local:~/git/cmake/test
>> ➜ qbs profile:gcc
>> Restoring build graph from disk
>> Building for configuration gcc-debug
>> compiling main.cpp
>> ERROR: /usr/bin/g++ -m64 -g -Wall -Wextra -pipe -fvisibility=default
>> -fPIC -c /Users/anpilog/git/cmake/test/app/main.cpp -o
>> /Users/anpilog/git/cmake/test/gcc-debug/app-and-lib-app.gcc/.obj/main.cpp.o
>> /Users/anpilog/git/cmake/test/app/main.cpp:2:10: fatal error: 'lib.h'
>> file not found
>> #include "lib.h"
>> ^
>> 1 error generated.
>> ERROR: Process failed with exit code 1.
>> The following products could not be built for configuration gcc-debug:
>> app-and-lib-app
>> ----------------------------------
>>
>> Include folders from lib/lib.qbs are not passed to app/app.qbs.
>>
>> Besides I would expect some configurable way what headers to share from
>> product...
>>
>> It's still confusing me a lot.
>>
>>
>> 2015-01-07 15:19 GMT+08:00 Dmitry Volosnykh <dmitry.volosnykh at gmail.com>:
>>
>>> Andrey, I would suggest you to extract your "project" to a separate .qbs
>>> file. So that your top-level qbs looks like below:
>>>
>>> import qbs
>>>
>>> Project {
>>> references: [
>>> "app/app.qbs",
>>> "lib/lib.qbs"
>>> ]
>>> }
>>>
>>> Then in the app.qbs do:
>>>
>>> Depends { name: "lib" }
>>>
>>> Such setup works for me.
>>>
>>> PS. Don't know if mixing references with direct Product declarations is
>>> good to go... Documentation says nothing about it.
>>>
>>> On Wed, Jan 7, 2015 at 9:59 AM, Andrey Anpilogov <anpilog at gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm investigating qbs as possible replacement to Makefiles in my
>>>> project.
>>>> And it looks good except one thing: how to add include path from
>>>> product to product?
>>>>
>>>> Let's take an example:
>>>>
>>>> project.qbs
>>>> ---------------------------------------------
>>>> import qbs 1.0
>>>>
>>>> Project {
>>>> references: [
>>>> "lib/build.qbs"
>>>> ]
>>>>
>>>> Product {
>>>> name: "project"
>>>> type: "application"
>>>> files: "main.cpp"
>>>> Depends { name: "lib" }
>>>> Depends { name: "cpp" }
>>>> }
>>>> }
>>>> ---------------------------------------------
>>>>
>>>> lib/build.qbs
>>>> ---------------------------------------------
>>>> import qbs 1.0
>>>>
>>>> Product {
>>>> name: "lib"
>>>> type: "staticlibrary"
>>>>
>>>> files: ["file1.cpp", "file2.cpp"]
>>>> cpp.includePaths: ["api", "ppi", "xdi"]
>>>> cpp.defines: ["xxx", "zzz"]
>>>> cpp.cxxFlags: ["xxx", "zzz"]
>>>> cpp.cFlags: ["xxx", "zzz"]
>>>> cpp.commonCompilerFlags: ["-Os", "-gdwarf-2", "-Wall"]
>>>> cpp.linkerScripts: "xxx"
>>>> Depends { name: "cpp" }
>>>> }
>>>> ---------------------------------------------
>>>>
>>>> It's quite similar to qbs/examples/app-and-lib example.
>>>> The problem is that project/main.cpp can't include headers from 'lib'
>>>> folder due to qbs doesn't add any include path from product:lib.
>>>> I've looked over docs and cpp profile and could not find anything
>>>> better then manually add includes into application product:
>>>>
>>>> ---------------------------------------------
>>>> import qbs 1.0
>>>> Project {
>>>> references: [ "lib/build.qbs" ]
>>>>
>>>> Product {
>>>> name: "project"
>>>> type: "application"
>>>> //...
>>>> cpp.includePaths: "lib"
>>>> }
>>>> }
>>>> ---------------------------------------------
>>>>
>>>> And it looks quite strange to me. If I add reference and make product
>>>> depended from other product I would expect I can pass not only static
>>>> libraries to dependant product but also headers path...
>>>>
>>>> Or there is some other approach?
>>>>
>>>> Regards.
>>>>
>>>> _______________________________________________
>>>> QBS mailing list
>>>> QBS at qt-project.org
>>>> http://lists.qt-project.org/mailman/listinfo/qbs
>>>>
>>>>
>>>
>>
>>
>> --
>> --
>> WBR,
>> Andrii Anpilogov
>> Phone: +86 186-1660-3720
>> Skype: anpilogov.andrey
>> mailto:anpilog at gmail.com, andrii.anpilogov at mesheven.com
>>
>>
>
--
--
WBR,
Andrii Anpilogov
Phone: +86 186-1660-3720
Skype: anpilogov.andrey
mailto:anpilog at gmail.com, andrii.anpilogov at mesheven.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20150107/7599cb2b/attachment.html>
More information about the Qbs
mailing list