.pro file setup for wiringPi cross compile on Pi

  • Hi all,

    I have used cross compile and remote debug/ deployment for a while.
    Everything goes well, until I decided to embedded wiringPi to my project. (I used to used it by calling it as Linux cmd )

    My Version : Qt 5.8 on both Ubuntu PC and rasp-Pi

    My purpose :

    • If compile with "Desktop Qt 5.8 GCC" :
      Block all wiring pi function by WIRING_PI flag.
    #ifdef WIRING_PI
    .... digitalRead(pin);
    • If compile with my "raspi" kit :
      Add WIRING_PI flag to DEFINES and
      active the wiringPi function.

    Here is my .pro file :

        INCLUDEPATH += /mnt/rasp-pi-rootfs/usr/include
        LIBS += -L/mnt/rasp-pi-rootfs/usr/lib -lwiringPi

    What condition should I use, to package above .pro code, to meet my purpose??
    I tried ...

    linux {
        contains(QMAKE_TARGET.arch, arm.*):{
            INCLUDEPATH += /mnt/rasp-pi-rootfs/usr/include
            LIBS += -L/mnt/rasp-pi-rootfs/usr/lib -lwiringPi
            DEFINES += WIRING_PI

    but not works. Since it's remote deploy...the arch will always be my x86 Desktop.

    It seems that I can judge the compiler?? Because they are different,
    but I have no idea which macro relate to it.

    PS. I can compile/run them correctly, by themselves. But I want it can be compatible.

  • @Phong what about using the kit name for the conditions? as mentioned in this answer.

  • @Pablo-J.-Rogina

    Thanks, It works~

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.