Thursday, 15 September 2011

iphone - Can you create custom build rules for XCode based on file type? -


I have a project with a group of .png files that I want to convert to compressed texture PVRTC. Right now, I am using a custom XCode Run Script Phase which looks like this:

  TEXTURE_TOOL = / developer / platform / iPhoneOS.platform / developer / usr / bin / texturetool $ TEXTURE_TOOL -e PVRTC --bits per pixel 2 -o "$ SRCROOT / images / select_menu_bgs1.pvr" PVR -f "$ 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 this is to clearly include the right list of files Is annoying for They need to be changed (they need to be added in the input and output properties of the build, which is even more painful part.)

What I have to do is make something "easy" with: There is a rule that says, "If there is a PRR in this project, then it is made using PNG to use this command line."

Is such a thing possible in XCode?

Double-click on a target.

Choose rule pane, make it simple with popup rules to target

Click on the plus button at the bottom of the window.

To process: Select Popup, Last Entry - Name Matching Source Files , which allows you to. Use

to enter a file globe pattern, use custom script for select and enter your script below

"$ {INPUT_FILE_BASE} } "For example:

  $ TEXTURE_TOOL -e PVRTC - Beats-per-pixel-2 -o" $ {INPUT_FILE_BASE} .pvr "-f PVR" $ {INPUT_FILE_BASE} .png "  

No comments:

Post a Comment