Xcode different linker / cflags for device vs simulator for the same purpose?

Does anyone know if it is possible to set flags of flags / linkers for simulator and device for one build purpose in xcode.

+4
source share
1 answer

In the .xcconfig file you can have

OTHER_CFLAGS[sdk=iphoneos*] = foobar OTHER_CFLAGS[sdk=iphonesimulator*] = barfoo 

Any build setup may be due to a number of things, for example, shortname for sdk. The device SDKs are called iphoneos-4.0, for example, sim iphonesimulator-4.0. So you got "foobar" as CFLAG for the device and "barfoo" for the sim.

To get started quickly with xcconfigs:

  • New File> Other> Configuration Settings File
  • Open the project or target editor (cmd-alt-E for the target)
  • Select the setting you want to configure (e.g. cflags) and copy it with cmd-c
  • Paste into new xcconfig file
  • Change as above
  • In the lower right corner of your project or target editor, select the xcconfig file as "Based On".

Please note that the assembly settings user interface now allows editing conditional expressions ... You can create new symbols using the button with the lower left edge, but this will not allow you to install "iphoneos *", for example, only certain versions.

Note that magic $ (inherited) allows you to set a parameter that inherits project parameters, but overrides only part of it, for example:

 OTHER_CFLAGS[sdk=iphoneos*] = $(inherited) foobar OTHER_CFLAGS[sdk=iphonesimulator*] = $(inherited) barfoo 

I don't know a good resource for xcconfigs, but you will start anyway: http://robnapier.net/blog/build-system-1-build-panel-360#more-360

+8
source

Source: https://habr.com/ru/post/1313555/


All Articles