by ibisum » Tue Jun 26, 2012 11:53 am
First thing I do when I pull a new version of MOAI (I rarely use the SDK release), is open the $MOAI/xcode/ios/ folder, and double-click the XCode project (Moai Sample), then build libmoai, then build and run the sample.
This will package up the iOS package with the sources, and run it on your phone (or simulator?), and so on. If you can get this done, the hard part is over: the MOAI host executable is built, packaged into the iOS app bundle, along with the Lua sources, and off it goes.
Trouble is, this is a build-only configuration: XCode is really crappy for editing the Lua project (navigation/awareness/etc.) and is generally not out-of-the-box ready for using other peoples compiler/build systems, and anyway: you mostly should use XCode only to build, not edit, MOAI projects.
Remember, there is a MOAI host executable, which is what you're really building with XCode, and there is the external MOAI-exclusive Lua-based source tree, which is what XCode is packaging into the bundle to give you the rotating sample.
The XCode project file, as bundled, will refer to a file in the collection called 'moai-target'. This is the *only* file you need to edit, regularly, within XCode - to set it to different values (as you move through the samples, for example), and to set it to your project source directory.
This file should contain the PATH to your MOAI project - everything (and I mean everything, so watch out) that you put in that PATH will be bundled into the iOS App bundle, and then the MOAI executable will be told to run that MOAI project. Thats how it gets bundled up - in fact, XCode is really *only* being used to build the bundle, generally, I think, by most MOAI hackers.
I do all MOAI work in Sublime Text 2 (you could use other editors), and then only use XCode and Android build tools (ant) for device testing and distribution. So, my advice: don't use XCode for *development* of your MOAI app, just use it for building and testing on iOS devices (and eventual building-for-distribution).
Instead, use Sublime Text2 to edit the Lua-based MOAI sources. Get the native MOAI binary for your host (MacOSX moai, Windows moai.exe, Linux moai, etc.) and set up Sublime Text 2 so that, when you hit the Build button, it runs the moai executable with the currently-selected file. Then, open the main.lua, and hit Build -> Have a Running MOAI app on your desktop.
This is a smoother way to develop MOAI apps, once you get it set up.
All that said, there was someone who did get their XCode environment to do pretty much the same thing: run the local host MOAI executable on a selected file; but I have no idea about that and frankly I don't think its as neat to use XCode as it is to use Sublime Text 2, when it comes to editing a Lua-based project.
Try this: open the moai-target file, change the path, switch back to XCode, and hit run. Then directly edit the sample that is pointed to by that path, save the .lua file, hit Run again on XCode. This should work quite smoothly, by the way - but you need to know to edit the Lua project with something else, and also, if you haven't found moai-target by now .. and package.sh .. then you will probably need to read that next.