[QBS] How to run a command and get the output

Joerg Bornemann joerg.bornemann at nokia.com
Tue Feb 21 11:07:16 CET 2012


On 18/02/12 16:17, ext BogDan wrote:

> So, an android native application needs a few settings to be build,I split them into two categories:
>   I. Global settings (set via qbs config --global):
>    - the NDK root path
>    - the toolcahin version.

I recommend putting this into the platform config (the one that's 
created my 'qbs platforms probe'). But having it in the global config is 
ok for now.

> I pushed a proof of concept android cpp module for qbs[1]. In order to finish it I need some support from you:
>   - a way to specify extra application/library linker flags.
>   - a way to turn off some linker flags (e.g. "soname" flag).

For this I will add properties to GenericGcc.qbs that can be overridden 
by more specific cpp modules, like linux-gcc or the android one.

Actually we could directly use the rule ids for this. Something like
     dynamicLibraryLinker.flags: ['foo', 'bar']
in a rule file and
     cpp.dynamicLibraryLinker.flags: ['foo', 'bar']
in a project file. That's what the transformproperties item in rules is 
for. Unfortunately overriding doesn't work as I'd expect it. For a fast 
solution I will add standard properties to the cpp module.

>   - a way to specify extra libs for some qt modules (e.g. EGL and GLES libs for QtOpenGL module).

If I understand you correctly you want to add some extra libs, every 
time a project does a Depends {name: "Qt.opengl" }, only if the user 
wants to build for Android.

It's not easily possible to change properties of a "potentially used 
module" at the moment.

Ideally, the Qt module files would reside in Qt's build directory / be 
generated by Qt's configure, containing the right settings and having 
only those Qt modules present that have been built and adding the right 
platform dependent libraries.

Not having the ideal situation we could do two things:
1) put platform information into the Qt modules. That is for your case 
adding
     cpp.dynamicLibraries: {
         if (qbs.targetOS == 'android')
             return ['egl', 'gles']
     }
to the the Qt OpenGL module. Very ugly.

2) Have a set of own Qt modules files, tailored to your needs, that come 
with the Qt for Android SDK and adjust the module search path.
The configuration value paths/cubes is the search paths for modules 
(separators are : or ;).


BR,

Jörg



More information about the Qbs mailing list