How do you set file-specific build settings in XCode 4? - xcode4

In xcode 3 it was possible to configure specific option for building every single file of a project, like for example disabling specific warnings, thumb code generation and so on.
In xcode 4 such feature is not available, or at least not in an intuitive way. This is however supported, at least as a backward compatibility feature, in projects imported from xcode 3.x.
Does anyone knows a way to specify those settings without having to open the project back in older xcode or creating a project for every single file?

Select the project in the navigator, then select the target from the list. Select the Build Phases tab, then expand the Compile Sources phase. The Compiler Flags column is where you specify per-file compiler flags.

Related

Switching between different versions of an app with Qt Installer Framework

I have an app which makes specific files. Those files only can be opened by the app. Since we release updates often, sometimes users want to go to previous versions of the app to open old files. Hence, I should make a way to switch between different versions quickly by using Qt Installer Framework.
I think to upload different versions as repositories and let user select one of them.
User should have ability to select only one out of them, other
selections should be unchecked automatically.
Then Installer must uninstall the previous version and install the selected one instead.
I've searched and these two questions are more or less similar to my question.
https://forum.qt.io/topic/98000/qt-installer-framework-exclude-components
Switch between variants of component in Qt Installer Framework
Moreover, I have been through every single examples in Qt Installer Framework documentation.
Unfortunately, I didn't find a way to check/uncheck selection according to users selection and to uninstall and install accordingly.

Exclude Android build while building Xmarin.Forms sln

Currently I installed a Mac pipeline agent without android tools, because I intended to use it for iOS only. My question is how to filter the Xamarin.Form solution not to build Android because it fails on this environment.
I'm wondering if there is a way for exclude the android part in the Build Xamarin azure task. I'm asking a way of doing it through: msbuild /t:restore;build /avoid:Android.csproj;Android.Binding.csproj or something alike...
in VS Mac (should be similar, but possibly with different menu paths, on PC) select Solution --> Options in the Solution Explorer. Under Build/Configurations create a new config (or copy an existing one). Then select Configuration Mappings, select the config you just created, and Disable the projects that you want to exclude.
When setting up your build pipeline you should have to specify which configuration you want to use.

Preprocessor Macros ignored in XCode's project settings, but not target settings

When I add a Preprocessor Macro in XCode 4 to one of my targets, it is used and conditional compilation occurs as I expect it to.
However, if I move that setting to the project level and out of one of my targets the preprocessor macro apparently is ignored and not used at all.
I verified that the macro is defined at all if I put it in the project's build setting through logging that is only compiled in when that macro is enabled.
How can that be?
System: OS X Lion, XCode 4.1 build 4B110, building for iOS 4.3.5, using the LLVM compiler, not GCC.
Have you completely deleted the build setting at the target level (not just blanked it)? If not, the target setting will completely override the project one. (You can avoid this by using $(inherited) in the target-level build setting.)
Xcode 4 makes it easy to see this type of problem: in the target’s Build Settings view, select “Levels” (instead of “Combined”) in the filter bar.

Xcode: overwrite compilation parameters of a .c/.cpp file

I'm very familiar with MS's Visual Studio environment, and recently I had to do some stuff for iPhone. I have a c++ project and I have performance critical components included as part of the project. This performance critical file absolutely must be compiled using optimized settings even for debug builds. That is, I have to overwrite settings for a file and pass -O2 -DNDEBUG when compiling one of the files of the project without affecting default compilation settings of the rest of the project.
Can this be done, I spent like an hour browsing through menus of XCode and wasn't able to find it!
If you go to your project window and select the file, you can get info on it with command-i or right clicking. Then go to the build tab, where you can enter additional compilation flags for this particular file.
I am on xcode 3.x but I don't imagine that they would remove this.
I note that this is just for additional compiler flags. If you need to remove some of your default flags the only option I can think of is a bit of a pain: make a new target that is set up with build options just for this file and include that target in your main target.

XCode 4 active architecture setting

I've updated the XCode to the latest 4 version (final). My project depends on a 3rd party library that was build for armv6.
The problem is that i can not change the "active architecture" as it was in 3.x.x instead I see that during linking the active architecture flag is always passed as armv7.
Does anyone know how to set active architecture for the build target (or for scheme) ?
Thanks in advance.
Answering to myself ...
Yes and no. You can not change the arc but you can trick the Xcode. Set it to compile not only for active architecture and leave only archv6 in the list. Hope it helps to whoever looks for an answer.
It is still possible to change the Architecure settings in Xcode 4. Select the project file in the Project Navigator. Then select the target you like to build. Then select build settings->All->Levels. In the search box enter "architectures". You should see the Architectures and Build Active Architecture settings.

Resources