Project github page: https://github.com/onevcat/XUPorter
Hi, everyone. I’d like to share a tool to you.
Overview
If you are doing mobile game development and targeting for iOS platform, you might be suffering in the post build process of Unity3D, especially when you are using some third part framework or plugin. You always drag a lot of frameworks and files to your Xcode project, and then build to see whether you forget something. You even made a check list and do it again and again every time you want to see how your game runs on iOS devices. Of course you can use post process script to regenerate the Xcode project, but it required a lot of skills and time, which might not be a clever way.
Now here is a tool for you to make your life easier. I am working on a project call XUPorter (means a dependency porter from Unity to Xcode), which can help you to add files and frameworks to your Xcode project after it is generated by Unity 3D automatically and dramatically.
Installation
Add all files of the repo to your Unity project’s Editor Folder: {$ProjectFolder}/Assets/Editor/XUPorter or you can download this unity package and import to your project.
Some demos are contained in /Mods folder, they are just a tutorial to help you getting start. Please feel free to delete or substitute all files in that folder as soon as you know how to use XUPorter. A simplified MiniJSON is now used in XUPorter, but I put it into a namespace, so there is no worry of conflicting, even if you are already using a same JSON wrapper.
XUPorter require Unity 3.5 or higher and Xcode 4 to work properly. I have tested for Xcode 5 DP and it can work well now too.
Usage
After the Unity’s building phase, OnPostProcessBuild in XCodePostProcess.cs will be called and Xcode project file will be modified. All .projmods (which is in JSON) will be treated as Xcode patch setting files (In the demos, all .projmods files are in /Mods folder). XUPorter will find and read all projmods files in /Assets and modify Xcode project file as settings.
In these setting files, specify the fields using a json pattern.
- group:The group name in Xcode to which files and folders will added by this projmods file
- libs:The name of libs should be added in Xcode Build Phases, libz.dylib for example. If you want to import a .a lib to Xcode, add it as a file(in “files”)
- frameworks:The name of framework should be added in Xcode Build Phases, Security.framework for example. If you want to add a third part framework, add it using a relateive path to files section instead of here.
- headerpaths:Header Search Paths in Build Setting of Xcode
- files:Files which should be added
- folders:Folders which should be added. All file and folders(recursively) will be added
- excludes:Regular expression pattern. Matched files will not be added.
- linker_flags: Linker flags which should be added, e.g. “-ObjC”
One example, the following file will add all files in /iOS/KKKeychain to the Xcode group KKKeychain and add the Security.framework to Xcode project.
{
"group": "KKKeychain",
"libs": [],
"frameworks": ["Security.framework"],
"headerpaths": [],
"files": [],
"folders": ["iOS/KKKeychain/"],
"excludes": ["^.*.meta$", "^.*.mdown$", "^.*.pdf$"],
"linker_flags": []
}
LICENSE
This code is distributed under the terms and conditions of the MIT license.
Copyright (c) 2012 Wei Wang @onevcat
Project github page: https://github.com/onevcat/XUPorter
Use it as you like! And of course you are welcome to follow and fork the project. If you have any problems, feel free to open an issue in the project page or modify the code and send me a pull request. I hope it can help you. Cheers :razz: (If you’d like to support me, could you consider to look at my this asset about easy implement of rating system for mobile and if you find it useful you can purchase one. That will encourage me a lot, thank you)