Is it possible to have an Xcode project file which contains both the Cocoa (MacOSX) and CocoaTouch (iPhone) versions of a component?
是否有可能拥有一个包含Cocoa(MacOSX)和CocoaTouch(iPhone)版本组件的Xcode项目文件?
I thought I was getting close until I realized that you need to set "Base SDK for All Configurations" in the Project Settings in order for the cross-compiler to be called (and for any CocoaTouch frameworks to be found and properly handled by Xcode).
我认为我已经接近,直到我意识到你需要在项目设置中设置“所有配置的基础SDK”,以便调用交叉编译器(并且可以找到任何CocoaTouch框架并由Xcode正确处理) 。
Since that is a project-wide setting, I don't know how I can have both MacOSX and iPhoneOS targets in the same project file.
由于这是一个项目范围的设置,我不知道如何在同一个项目文件中同时拥有MacOSX和iPhoneOS目标。
Specifying:
SDKROOT = iphoneos3.0
in an xcconfig file (used by iPhone-only targets) did not seem to work.
在xcconfig文件中(由仅限iPhone的目标使用)似乎不起作用。
1 个解决方案
#1
Yes, you can, but there are some glitches.
是的,你可以,但有一些故障。
Okay first off, you can override any Base SDK in several ways. One is that you can on the gear at the bottom of the inspector and "Add Build Setting Condition" which lets you conditionalize any build settings based on things like the target architecture, etc.
好的,首先,您可以通过多种方式覆盖任何Base SDK。一个是您可以在检查器底部的齿轮和“添加构建设置条件”,它允许您根据目标体系结构等条件对任何构建设置进行条件化。
Second, even if you have a project wide setting, it can been overriden per target. So if you have seperate targets you can just add an SDKROOT to the to the various targets with their SDKROOT.
其次,即使您有项目范围设置,也可以按目标覆盖它。因此,如果你有单独的目标,你可以使用他们的SDKROOT将SDKROOT添加到各种目标。
Third, the SDK selected in the popup in your Xcode window overrides evertyhing else. So if you have something besides "Base SDK" in that popup it will get used. Also, if you do switch that (lets say from "Base SDK" to "iPhone Simulator") and then you switch targets to a target that does not support the currently selected SDK it will appear to deselect, but it doesn't actually correctly autorevert the Base SDK, you need to reselect it in the pop up.
第三,在Xcode窗口的弹出窗口中选择的SDK会覆盖其他内容。因此,如果你在弹出窗口中有“Base SDK”之外的东西,它将被使用。此外,如果你切换它(从“Base SDK”到“iPhone模拟器”),然后你将目标切换到不支持当前选择的SDK的目标,它将会取消选择,但实际上并没有正确自动恢复Base SDK,您需要在弹出窗口中重新选择它。
I still can't consistently get multiple archs building together properly as part of an aggregate (for instance, having an OS X target that preprocesses some resource built so that it can be used as a build phase in a later target building an iPhone app).
作为聚合的一部分,我仍然无法一致地将多个arch一起构建在一起(例如,具有预处理某些资源的OS X目标,以便它可以在构建iPhone应用程序的后续目标中用作构建阶段) 。
#1
Yes, you can, but there are some glitches.
是的,你可以,但有一些故障。
Okay first off, you can override any Base SDK in several ways. One is that you can on the gear at the bottom of the inspector and "Add Build Setting Condition" which lets you conditionalize any build settings based on things like the target architecture, etc.
好的,首先,您可以通过多种方式覆盖任何Base SDK。一个是您可以在检查器底部的齿轮和“添加构建设置条件”,它允许您根据目标体系结构等条件对任何构建设置进行条件化。
Second, even if you have a project wide setting, it can been overriden per target. So if you have seperate targets you can just add an SDKROOT to the to the various targets with their SDKROOT.
其次,即使您有项目范围设置,也可以按目标覆盖它。因此,如果你有单独的目标,你可以使用他们的SDKROOT将SDKROOT添加到各种目标。
Third, the SDK selected in the popup in your Xcode window overrides evertyhing else. So if you have something besides "Base SDK" in that popup it will get used. Also, if you do switch that (lets say from "Base SDK" to "iPhone Simulator") and then you switch targets to a target that does not support the currently selected SDK it will appear to deselect, but it doesn't actually correctly autorevert the Base SDK, you need to reselect it in the pop up.
第三,在Xcode窗口的弹出窗口中选择的SDK会覆盖其他内容。因此,如果你在弹出窗口中有“Base SDK”之外的东西,它将被使用。此外,如果你切换它(从“Base SDK”到“iPhone模拟器”),然后你将目标切换到不支持当前选择的SDK的目标,它将会取消选择,但实际上并没有正确自动恢复Base SDK,您需要在弹出窗口中重新选择它。
I still can't consistently get multiple archs building together properly as part of an aggregate (for instance, having an OS X target that preprocesses some resource built so that it can be used as a build phase in a later target building an iPhone app).
作为聚合的一部分,我仍然无法一致地将多个arch一起构建在一起(例如,具有预处理某些资源的OS X目标,以便它可以在构建iPhone应用程序的后续目标中用作构建阶段) 。