[Development] Qmake variable for iOS

Shobana Suresh SSuresh at esri.com
Mon Feb 17 04:33:11 CET 2014


Hi Fawzi,

Thanks for the explanation.
You are right. Though the message is misleading, it appears to work.
I tried the below simple test and it worked as expected.

App1.pro:

ios {

    iphonesimulator {

      message("iphonesimulator")

      DEFINES += iphonesimulator

    }

    iphoneos{

      message("iphoneos")

      DEFINES += iphoneos

    }

}


Mainwindow.cpp


void MainWindow::on_pushButton_clicked()

{

    QMessageBox msgBox;

#ifdef iphonesimulator

    msgBox.setText("Simulator");

#elif defined (iphoneos)

    msgBox.setText("Phone");

#endif

    msgBox.exec();

}


Thanks

Shobana

From: Mohamed Fawzi <Fawzi.Mohamed at digia.com<mailto:Fawzi.Mohamed at digia.com>>
Date: Sat, 15 Feb 2014 01:36:31 +1100
To: Shobana Suresh <ssuresh at esri.com<mailto:ssuresh at esri.com>>
Cc: "development at qt-project.org<mailto:development at qt-project.org>" <development at qt-project.org<mailto:development at qt-project.org>>
Subject: Re: [Development] Qmake variable for iOS

Hi,

qmake for ios is a bit strange, in the sense that it treats device and simulator as two build  versions.
This is like debug and release, setting it in CONFIG sets the default used in Makefile, but it also still generates specific makefiles for each possible combination (iphoneos debug/relase,...).
This is a bit unecessary, especially for how it is used in creator (shadow build, always setting the default, and always building using the default Makefile.
So message is misleading because it is called for each Makefile version.
Thill it should work, have you tried to see?

Fawzi

On 10 Feb 2014, at 01:30, Shobana Suresh <SSuresh at esri.com<mailto:SSuresh at esri.com>> wrote:


Hello All,

I am trying to find the qmake variable that could be used to differentiate between the iPhone simulator and iPhone arm kits.
In my .pro file, I would like to use conditions like

  1.
ios {
  2.
    CONFIG += c++11
  3.
    iphonesimulator {
  4.
      message("iphonesimulator")
  5.
      #Do Something
  6.
    }
  7.
    iphoneos{
  8.
      message("iphoneos")
  9.
     #Do Something
  10.
    }
  11.
}

On running qmake with the iphonesimulator kit, it prints out

  1.
Project MESSAGE: iphonesimulator
  2.
Project MESSAGE: iphonesimulator
  3.
Project MESSAGE: iphonesimulator
  4.
Project MESSAGE: iphonesimulator
  5.
Project MESSAGE: iphoneos
  6.
Project MESSAGE: iphonesimulator
  7.
Project MESSAGE: iphonesimulator
  8.
Project MESSAGE: iphoneos

With iPhone device kit , it prints

  1.
Project MESSAGE: iphoneos
  2.
Project MESSAGE: iphoneos
  3.
Project MESSAGE: iphoneos
  4.
Project MESSAGE: iphonesimulator
  5.
Project MESSAGE: iphoneos
  6.
Project MESSAGE: iphoneos
  7.
Project MESSAGE: iphonesimulator
  8.
Project MESSAGE: iphoneos


I tried using the QT_ARCH variable, but message($$QT_ARCH) prints out “arm” for both the kits.

What is the correct qmake variable to use to differentiate between iPhone simulator and iPhone arm kits?


Regards

Shobana

_______________________________________________
Development mailing list
Development at qt-project.org<mailto:Development at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/development



__________ Information from ESET NOD32 Antivirus, version of virus signature database 9109 (20131128) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140217/9258f2fe/attachment.html>


More information about the Development mailing list