如何使用不同的构建配置设置Xcode项目依赖项? [英] How to set Xcode project dependencies with different build configurations?

查看:212
本文介绍了如何使用不同的构建配置设置Xcode项目依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Xcode 7.3工作区,其中包含三个项目:App,FrameworkA和FrameworkB。每个项目都有一个目标。这是iOS,因此框架目标是Cocoa Touch框架,这意味着框架包含动态链接的共享库。

I have an Xcode 7.3 workspace with three projects, App, FrameworkA, and FrameworkB. Each project has a single target. This is iOS, so the framework targets are Cocoa Touch Frameworks, which means frameworks containing dynamically linked shared libraries.

应用程序依赖于框架A,而框架A依赖于框架B。只要A正确链接到B的生成产品,并且App正确链接到和同时嵌入框架A和B(因为您不能将一个框架嵌入另一个框架,因此似乎应用程序捆绑包需要链接并嵌入直接和传递依赖项。)

App depends on Framework A which depends on Framework B. These dependencies are working, insofar as A properly links to the build product of B, and the App properly links to and embeds both frameworks A and B (because you cannot have one framework embedding another, it seems an application bundle needs to link and embed both direct and transitive dependencies.)

是我的问题。框架A和B具有通常的构建配置,即Debug和Release。 App具有附加的构建配置LocalRelease,它由运行构建动作触发,用于构建优化的构建(如Release),但代码带有开发者身份签名(如Debug)。

But here is my problem. Frameworks A and B have the usual build configurations, Debug and Release. App has an additional build configuration, LocalRelease, which is triggered by the Run build action, and used for building an optimized build (like Release) but code signed with a developer identity (like Debug).

当我尝试使用此LocalRelease构建配置来构建App时,由于它破坏了对框架A和B的依赖关系,因此这破坏了构建。我相信是因为这些框架没有LocalRelease构建配置,所以Xcode从不将其构建产品放到LocalRelease-iphoneos文件夹中,就像App一样。

When I try to build App with this LocalRelease build configuration, this breaks the build since it breaks the dependencies on frameworks A and B. I believe that is because these frameworks do not have LocalRelease build configurations, so Xcode never puts their build products into a LocalRelease-iphoneos folder, as it does with App.

所以我的狭窄问题是,我如何配置构建设置,以便具有非标准构建配置名称(例如LocalRelease)的项目可以依赖于仅使用标准构建配置名称?我希望有一种简单的方法,不需要添加脚本或xcconfig文件,但是如果需要的话,我很想了解原因。

So my narrow question is, how do I configure build settings so that a project with a nonstandard build configuration name (like LocalRelease) can depend on other projects that use only the standard build configuration names? I'm hoping there's a simple way to do this that does not require adding scripts or xcconfig files, but if those are necessary I'd love to understand why.

我的更广泛的问题是,引入额外的构建配置通常是一个坏主意,因为它们不允许共享工作空间中项目之间的依赖关系进行平滑交互吗?我之所以要定义此第三种配置,是因为我想要一个优化的本地构建,我不想定义一个新方案,并且我希望构建类型的选择可以通过以下各种构建动作(运行,配置文件,发布)来表达:

And my broader question is, is it in general a bad idea to introduce additional build configurations because they do not allow smooth interaction of dependencies between projects in a shared workspace? I was led to defining this third configuration because I wanted an optimized local build, I did not want to define a new scheme, and I wanted the choice of build type to be expressed by the various build actions (run, profile, release) of a single scheme.

但是也许这是错误的方法。只要是由构建配置名称驱动构建产品目录路径的情况,并且从属项目需要在共享目录中查找彼此的构建产品,似乎在项目中引入非标准构建配置名称将破坏与取决于其他项目。

But maybe this was the wrong way to do it. As long as it is the case that build configuration names drive build product directory paths, and dependent projects need to find each other's build products in a shared directory, it seems like introducing a non-standard build configuration name to a project will break interoperation with depended-upon other projects.

推荐答案

我为此向Apple提出了开发人员技术支持票,并与WWDC的Xcode工程师进行了交谈。

I raised a Developer Technical Support ticket with Apple about this, and spoke to the Xcode engineers at WWDC.

回答我自己的问题


如何配置构建设置,使具有非标准构建配置名称(如LocalRelease)可以依赖于仅使用标准构建配置名称的其他项目吗?

how do I configure build settings so that a project with a nonstandard build configuration name (like LocalRelease) can depend on other projects that use only the standard build configuration names?

答案:无法完成


通常引入一个额外的构建配置是一个坏主意,因为它们不允许共享工作空间中项目之间的依赖关系进行平滑交互。 ?

is it in general a bad idea to introduce additional build configurations because they do not allow smooth interaction of dependencies between projects in a shared workspace?

答案:是的,这是个坏主意。

Answer: yes, this is a bad idea.

所以创建一个新的命名构建配置不是我尝试做的聪明方法。不幸的是,似乎最简单的解决方案是包含xcconfig文件并为此类事情手动更改配置文件。

So creating a new named build configuration is not the smart way to do what I was trying to do. Unfortunately, seems like the "simplest" solution is to embrace xcconfig files and change config files manually for this sort of thing.

这篇关于如何使用不同的构建配置设置Xcode项目依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆