[Development] Qmake variable for iOS

Shobana Suresh SSuresh at esri.com
Wed Feb 19 23:56:19 CET 2014


Hi Tor Arne,

I have a few libraries compiled for phone and simulator.

I want to add condition checks in my application's .pro file, to link to the correct libs based on the architecture the application is compiled for.

I would basically want to do something like this,

ios: {

    iphonesimulator {

      LIBS += \

        -L/Users/XXX/MyLib/ios_simulator

    }

    iphoneos {

      LIBS += \

        -L/Users/XXX/MyLib/ios_armv7

    }

    CONFIG(debug, debug|release) {

      LIBS += -lMyLibd

    } else {

      LIBS += -lMyLib

    }

}

Regards

Shobana


From: Tor Arne Vestbø [mailto:tor.arne.vestbo at digia.com]
Sent: Thursday, 20 February 2014 12:14 AM
To: Shobana Suresh; Mohamed Fawzi
Cc: development at qt-project.org
Subject: Re: Qmake variable for iOS


Out of curiosity, what's the use case here for doing stuff for simulator
only in the project file? Is it to set a define you can use in the sources?

tor arne

On 17/02/14 4:33 , Shobana Suresh wrote:
> 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%0b>> <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%0b>> <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> <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
>
>
> _______________________________________________
> 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


__________ 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/20140219/b622c98f/attachment.html>


More information about the Development mailing list