您可以根据文件类型为 XCode 创建自定义构建规则吗?
我有一个包含一堆 .png 文件的项目,我想将它们转换为 PVRTC 压缩纹理。现在,我正在使用一个自定义的 XCode 运行脚本阶段,如下所示:
TEXTURE_TOOL=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool
$TEXTURE_TOOL -e PVRTC --bits-per-pixel-2 -o "$SRCROOT/images/select_menu_bgs1.pvr" -f PVR "$SRCROOT/images/select_menu_bgs1.png"
$TEXTURE_TOOL -e PVRTC --bits-per-pixel-2 -o "$SRCROOT/images/select_menu_bgs2.pvr" -f PVR "$SRCROOT/images/select_menu_bgs2.png"
但必须使其显式包含我需要转换的文件的确切列表,这很烦人。 (它们还需要添加到构建步骤的输入和输出属性中,这是更烦人的部分。)
我想做的是使用“make”做一些简单的事情:有一条规则说“如果有项目中的 .pvr,它是使用此命令行从相应的 .png 构建的。”
XCode 中可能有这样的事情吗?
I have a project with a bunch of .png files that I want to convert to PVRTC compressed textures. Right now, I'm using a custom XCode run script phase that looks like this:
TEXTURE_TOOL=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool
$TEXTURE_TOOL -e PVRTC --bits-per-pixel-2 -o "$SRCROOT/images/select_menu_bgs1.pvr" -f PVR "$SRCROOT/images/select_menu_bgs1.png"
$TEXTURE_TOOL -e PVRTC --bits-per-pixel-2 -o "$SRCROOT/images/select_menu_bgs2.pvr" -f PVR "$SRCROOT/images/select_menu_bgs2.png"
but it's annoying to have to make it explicitly include the exact list of files I need converted. (they also need to be added to the input & output properties of the build step, which is the even more annoying part.)
what I would like to do is something easy with "make": have a rule that says "if there's a .pvr in the project, it's built from the corresponding .png using this command line."
Is anything like this possible in XCode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
双击目标。
选择“规则”窗格,使用特定于目标的弹出规则进行简化
单击窗口底部的加号按钮。
对于 Process: 弹出窗口,选择最后一个条目 - 名称匹配的源文件,它允许您输入文件全局模式。
对于“使用”,选择自定义脚本并在下面输入您的脚本。
使用“${INPUT_FILE_BASE}”,例如:
Double-click a Target.
Choose the Rules pane, simplify it with the popup Rules Specific to target
Click the Plus button at the bottom of the window.
For the Process: popup, choose the last entry - Source files with names matching, which allows you to enter a file glob pattern.
For Using, choose Custom Script and enter your script below.
Use "${INPUT_FILE_BASE}" eg: