Xcode构建设置“构建产品路径” (CONFIGURATION_BUILD_DIR)是骗人的? [英] Xcode build setting "Build Products Path" (CONFIGURATION_BUILD_DIR) is a lie?

查看:3290
本文介绍了Xcode构建设置“构建产品路径” (CONFIGURATION_BUILD_DIR)是骗人的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我创建一个新的应用程序项目,构建设置如下所示:

If I create a new application project, the build settings look something like this:

它声称使用的是构建目录 build / Debug-iphoneos 。我假设这是相对于项目目录?实际上,项目被编译到派生数据目录,在〜/ Library / Developer / Xcode / DerivedData / CryptoTest2-abc ...

It claims to be using a build dir build/Debug-iphoneos. I assume this is relative to the project directory? In reality, the project is compiled to the "derived data" directory, under ~/Library/Developer/Xcode/DerivedData/CryptoTest2-abc...

那么这里发生了什么?这个构建设置是否被忽略了?什么是控制输出目录的构建设置?

So what is going on here? Is this build setting simply ignored? What is the build setting that controls the output directory?

推荐答案

此构建设置实际上是相对于派生数据设置。
如果转到Xcode>首选项>位置,可以更改此设置,并将派生数据目录设置更改为适合您需要的设置(默认,相对或自定义)。

This build setting is actually relative to the Derived Data setting. You can change this setting if you go to Xcode > Preferences > Locations, and change the Derived Data directory setting to whatever suits your needs (Default, Relative or Custom).

您还可以指定这是基于每个项目,如果您为该设置指定绝对路径:

You can also specify this on a per project-basis, if you specify an absolute path for that settings:


  • 您可以硬编码路径,例如 / build / $ {CONFIGURATION} $ {EFFECTIVE_PLATFORM_NAME} ,然后项目将内置到根文件夹中的文件夹构建中。

  • 或您可以选择将现有路径添加到另一个环境变量中。例如,要创建相对于项目/工作区的路径(正如您所期望的那样),可以使用 $ {SRCROOT} / 添加原始值,从而有效地创建 build 项目/工作区根目录下的文件夹。

  • You can either hardcode a path such as /build/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}, then the project will be built into the folder build in the root folder.
  • Or can you can choose to prepend the existing path with another environment variable. For example, to make the path relative to your project/workspace (As you would expect), you can prepend the original value with ${SRCROOT}/, effectively creating a build folder at the root of your project/workspace.

可以设置的设置在 $ {< setting>} 中替换为构建设置,并在您开始构建项目时由Xcode / xcodebuild自动设置。 Apple在此处维护可用的构建设置列表:

http ://help.apple.com/xcode/mac/8.0/#/itcaec37c2a6

Settings that can be substitued in ${<setting>} are called Build settings, and are set automatically by Xcode/xcodebuild whenever you start building your project. Apple maintains a list of the available build settings here:
http://help.apple.com/xcode/mac/8.0/#/itcaec37c2a6

这篇关于Xcode构建设置“构建产品路径” (CONFIGURATION_BUILD_DIR)是骗人的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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