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

BogDan bog_dan_ro at yahoo.com
Sat Feb 18 16:17:06 CET 2012


QBS seems to be the only build-system which may be used to easily, build native android apps, of course, except Android 's one.

Android NDK is a little bit complicated than the usual NDKs, I will try to explain who it worksto you in a few lines:
 - it may contains multiple toolchain versions (e.g. 4.4.3 toolchain which is based on gcc-4.4.3, 4.6.2 based on gcc-4.6.2, etc.)
 - every version has two toolchain types: 
  * arm-linux-androideabi which is used to build arm bins, this toolchain is used generate code for two types of ABIs : armeabi and  armeabi-v7a.
  * and x86 which is used to build bins for x86 ABI.
 - the NDK comes with headers and libs for a few API levels (3,4,5,8,9) and the user must specify the minimum API which the application will be build.

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.

II. Application specific settings (set via .qbs file or command line) :
 - desire ABIs (armeabi, armeabi-v7a, x86), meaning that every single source file needs to be build three times using three different CXXFLAGS. In the end there should be three different libs which must go into its own folder in the package (armeabi lib to libs/armeabi, armeabi-v7a lib to libs/armeabi-v7a and x86 libs to libs/x86).
 - minimum android API level.

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).
 - a way to specify extra libs for some qt modules (e.g. EGL and GLES libs for QtOpenGL module).
 - probably other things which I forgot.  


[1] https://qt.gitorious.org/~taipan/qt-labs/android-qbs/commit/f8d7374ce1876007763482dee949ae4c9c690c9c

P.S. I'm travelling to another country, so, a few days I can't reply to your mails.

>>  First and foremost I want to congratulate you for this great tool !
> Many thanks! I would love to see qbs used for Android apps! :)
>>  I'm trying to add android support for qbs, but I'm stuck with a 
> small problem, android needs to add libgcc.a library to link, untill now I used 
> gcc to find where is this library (e.g.  gcc -mthumb-interwork 
> -print-libgcc-file-name  -- will output the path where libgcc is). It is 
> possible to run a command and get the output ?
> There's ATM no way to execute a program and read its output. The only place 
> for that would be the JavaScriptCommand that is executed on build time. We 
> should add support for it.
> But for your use case I think the location of libgcc.a should be in the platform 
> configuration. The "qbs platforms probe" call created a config file in 
> ~/.config/Nokia/qbs/platforms/ and there you should create new platform 
> configurations. One for each android target, I'd say.
> In there you write the location of libgcc to a property, which is then used in 
> android projects. The reasoning is to have the machine-specific settings in one 
> place (the platform config) and machine-independent settings in the .qbs files.
> Of course this should be done by some tool that calls 'gcc -mthumb-interwork 
> -print-libgcc-file-name' - like the Necessitas SDK installer.
> Jörg
> > 

More information about the Qbs mailing list