如何使 Xcode 中的 DerivedData 或 Build Location 与项目相关 [英] How to make DerivedData or Build Location in Xcode to be relative to project

查看:41
本文介绍了如何使 Xcode 中的 DerivedData 或 Build Location 与项目相关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 xcode 工作区中有多个 pbxproj 文件.默认情况下,所有构建输出和临时 .obj 文件都转到 xcode 中的某个随机位置,我想让所有输出转到相对于我拥有所有源文件的位置的路径.除了 xcode 将所有结果输出到某个随机位置之外,我们对跨不同构建目标的所有构建输出都有统一的布局.

I have multiple pbxproj files in my xcode workspace. By default all build outputs and temporary .obj files go to some random location in xcode and I would like to make all that output goes to path relative to where I have all the source files. We have uniform layout for all build output across different build targets except xcode outputs all results to some random location.

同时,这必须以某种方式完成,以便此更改可以存储在版本控制系统(例如 git)中,以便此更改可以在其他开发人员机器上获取.这意味着我不想更改 XCode 的全局首选项来更改 DerivedData 路径.

At the same time this has to be done in a way so that this change could be stored in versioning system (e.g. git) and so that this change would be picked up on other developer machines. That means I don't want to change XCode's global preferences to change DerivedData path.

当我尝试更改每个项目的设置时,可以选择更改 DerivedData 位置或在高级"对话框中,我可以将构建位置"设置为自定义"和相对于工作区"它可以工作,...但是它无法正常工作,因为此更改未反映在 pbxproj 文件中,而是在各处创建了一些特定于用户的配置,将这些配置添加到 git 毫无意义,因为这些文件的路径中甚至包含我的用户名.

When I tried to change per-project settings there are options to change DerivedData location or in "Advanced" dialog I could make "Build Location" to be "Custom" and "Relative to Workspace" it works, ... but it doesn't work properly, as this change isn't reflected in pbxproj files, but creates some userspecific configs all over the place which do not make sense to be added to git as these files even have my username in their paths.

推荐答案

不要费心去尝试配置 DerivedData 位置,这条路线无处可去.唯一的方法似乎是使用 自定义 .xcconfig:

Don't bother trying to configure DerivedData location, this route leads nowhere. The only way to do it seems to use custom .xcconfig:

这篇关于如何使 Xcode 中的 DerivedData 或 Build Location 与项目相关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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