Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

qmake conditional for RaspberryPi

I'm trying to make a qmake .pro file to compile in RaspberryPi (not for cross compile). Can I use conditionals definitions depending on the platform:

linux-g++-64: {
    message(We are in Linux 64 bits)
}
macx: {
    message(we are in mac osX)
}
win32: ...

But I can't find a way to detect when I'm in a PaspberryPi with raspbian.

I have tried something like linux-arm, arm-linux, linux-arm-gnueabi-g++ but not luck.

Someone know the correct way to make this conditional definitions or how to detect if we are compiling in a RaspberryPi architecture?

like image 477
Mquinteiro Avatar asked Apr 26 '16 17:04

Mquinteiro


2 Answers

This worked for me:

linux {
    contains(QMAKE_HOST.arch, arm.*):{
        raspberry's bla bla bla

    }else{
        ...
    }
}

I hope it works for you.

http://doc.qt.io/qt-5/qmake-variable-reference.html#qmake-host

like image 142
Amanda Shiokawa N Freitas Avatar answered Oct 21 '22 03:10

Amanda Shiokawa N Freitas


current Raspbian OS(32bit) for RPi3 report QMAKE_HOST.arch as armv7l, while older board\OS can report armv6l.

while 64bit builds, like UbuntuMate for RaspberryPi: aarch64

like image 1
Andrey Azazello Yaromenok Avatar answered Oct 21 '22 04:10

Andrey Azazello Yaromenok