nmex

Status


Success building nmex: I had to fix Build.xml.
success building my ios nme project using nmex: I had to fix my application.nmml, and manually edit the final Xcode project.
Then ran it in the iPhone simulator and it did successfully launch and did show Sign in to Game Center alert.
Note for my builds: the libGoogleAnalytics.a had to be copied to libGoogleAnalytics.iphoneos-v7.a, ditto other libs.
Remaining problem: any time i do a new haxe-nme build, it will overwrite my manual Xcode project changes, breaking the build. That's very untenable, un-user-friendly.

Building the iOS project


I'm on haxe 2.10, hxcpp 2.10.2, mac os x 10.7.5, xcode 4.4.
I started with xcode 4.5 but that seemed to force iOS 6, and i was wondering if that forced arm v7, so i used xcode-select to change over to 4.4. so it says it is building for 5.1, but i am still stuck with it forcing only arm v7 afaict.
cd ~/Dev
mkdir NMEX
cd NMEX
svn checkout http://nmex.googlecode.com/svn/trunk/ nmex-read-only
??? did i have to "haxelib dev nmex ~/Dev/NMEX/nmex-read-only" at this point ???
cd ~/Dev/NMEX/nmex-read-only/project
edit Build.xml, compare yours to my current.
haxelib run hxcpp Build.xml -Dios

See newly generated libs: ndll/iPhone/libnmex.iphoneos.a and ndd/iPhone/libnmex.iphonesim.a

Running the iOS sample


After building the project and successfully generating the libs:
- Open sample/ios/nmexSample.xcodeproj inside Xcode.
- Choose a simulator.
- Run.
Eventually the game center login alert will appear.

Getting set up for Game Center


See http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-game-center-achievements-and-leaderboards-part-1/

Updating my own code


I'm using nme's build system.
Update the application.nmml file to have:
<extension name="nmex" path="~/Dev/NMEX/nmex-read-only"/>

Look at sample/ios/haxe/IPhoneMain.hx, for nmex calls.
So in my "Main", I added:
nmex.GameCenter.getInstance().authenticateLocalUser() // after addChild()
It did successfully build.
So I updated my local NMEX Build.xml file to fix the -v7 naming issue, and can now generate both the non-v7 and -v7 versions.
Back in my own application.nmml, I added :
<dependency name="GameKit.framework" if="ios" />

Ditto for CFNetwork, iAd, StoreKit, MessageUI, SystemConfiguration.
Also:
<dependency name="sqlite3" if="ios" />

You have to open the project in Xcode and manually update Build Phases / Link Binary With Libraries to include libGoogleAnalytics.a, wherever you decide to get it from (there's a version in svn nmex, or you can download the latest from google i guess).
libGoogleAdMobAds.a
Use Xcode to build, make sure the target is not Simulator but "iOS Device" or some such. I was worried about getting link errors because of targeting i386 architecture, but after it built OK for iOS Device, I could in fact also run it in the Simulator.

Build.xml

<xml>
<set name="no_thirdparty_extras" value="1"/>
<set name="tool" value="static_link"/>
<set name="mobile" value="1"/>
<set name="ARM_V" value="-v7" if="HXCPP_ARMV7"/>
<set name="ndll-tool" value="static_link"/>
<set name="name_extra" value=".iphoneos${ARM_V}" if="iphoneos"/>
<set name="name_extra" value=".iphonesim" if="iphonesim"/>
<include name="${HXCPP}/build-tool/BuildCommon.xml"/>
<set name="SLIBEXT" value=".a"/>

<files id="iphone">
<dependency name="UIKit.framework"/>
<depend name="${HXCPP}/include/hx/Macros.h"/>
<depend name="${HXCPP}/include/hx/CFFI.h"/>
<compilerflag value="-IiPhone/include"/>
<compilerflag value="-Iinclude"/>
<file name="iPhone/Device.mm"/>
<file name="iPhone/iRate.mm"/>
<file name="iPhone/UI.mm"/>
<file name="iPhone/GA.mm"/>
<file name="iPhone/GAD.mm"/>
<file name="iPhone/GameCenter.mm"/>
<file name="iPhone/InAppPurchase.mm"/>
</files>

<files id="common">
<compilerflag value="-Iinclude"/>
<file name="common/ExternalInterface.cpp"/>
</files>

<target id="NDLL" output="libnmex${name_extra}" tool="linker" toolid="${ndll-tool}">

<outdir name="../ndll/${BINDIR}"/>
<files id="iphone"/>
<files id="common"/>

</target>

<target id="default">
<target id="NDLL"/>
</target>

</xml> 

version #15717, modified 2012-11-20 23:34:17 by jan_flanders