Apple and NME

Work is progressing on the nme install-tool, which helps make this a little bit easier.

haxelib run nme build MyCoolApp.nmml macos
haxelib run nme update MyCoolApp.nmml iphonesim

It will compile and run a Mac OS application, or generate an XCode project for compiling to iOS or the iOS simulator.

There are some sample applications which use the *.nmml file format, or you can download this one:

http://www.joshuagranick.com/code/haxe/NMML%20Test.zip

Make sure you are using the newest copies of hxcpp and nekonme, and that you have set "haxelib dev hxcpp /path/to/hxcpp" and "haxelib dev nme /path/to/nme". You can test either the original install-tool, or build the new tool by running "haxe InstallTool.hxml" from within the /nekonme/install-tool directory. Both should work for Mac OS and iOS.

Snow Leopard


In the instructions below, replace ::checkout_loc:: by your svn checkout location.

Setup

  • If you have not already done so, get nme and hxcpp into haxelib:
    haxelib install hxcpp
    haxelib install nme

  • check out the following libs into ::checkout_loc::
    svn checkout http://nekonme.googlecode.com/svn/trunk/ nekonme
    svn checkout http://hxcpp.googlecode.com/svn/trunk/ hxcpp
    svn checkout http://sdl-static.googlecode.com/svn/trunk/ sdl-static
    svn checkout http://gm2d.googlecode.com/svn/trunk/ gm2d
    svn checkout http://hxformat.googlecode.com/svn/branches/shx-branch/ hxformat-shx
  • point haxelib to the svn versions of hxcpp and nme
    haxelib dev nme ::checkout_loc::/nekonme
    haxelib dev hxcpp ::checkout_loc::/hxcpp
  • make sure your env vars are set up. one way is the create a ~/.bash_profile
    alias ls='ls -G'
    export NEKO_INSTALL_PATH=/usr/lib/neko
    export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:::checkout_loc::/hxcpp/bin/Mac:::checkout_loc::/nekonme/ndll/Mac:.
  • now source it
    source ~/.bash_profile
  • patch ::checkout_loc::/hxcpp/build-tool/BuildCommon.xml (only if your iphone version is different from SVN
    ### Eclipse Workspace Patch 1.0
    #P hxcpp
    Index: build-tool/BuildCommon.xml
    ===================================================================
    --- build-tool/BuildCommon.xml    (revision 345)
    +++ build-tool/BuildCommon.xml    (working copy)
    @@ -39,7 +39,7 @@
     
     <set name="DBG" value="-debug" if="debug"/>
     <set name="M64" value="64" if="HXCPP_M64"/>
    -<set name="IPHONE_VER" value="4.2" unless="IPHONE_VER" />
    +<set name="IPHONE_VER" value="4.3" unless="IPHONE_VER" />
     
     <set name="STD_MODULE_LINK" value="dll"/>
     
    @@ -186,7 +186,7 @@
     
       <compilerflag value="-I${HXCPP}/runtime/${GC_DIR}/include" if="HXCPP_BOEHM_GC" />
       <compilerflag value="-I${HXCPP}/runtime/${GC_DIR}/include/private" if="HXCPP_BOEHM_GC" />
    -  <compilerflag value="-I${HXCPP}/runtime/${GC_DIR}/libatomic_ops-${AO_VERSION}/src" if="BHXCPP_BOEHM_GC" />
    +  <compilerflag value="-I${HXCPP}/runtime/${GC_DIR}/libatomic_ops-${AO_VERSION}/src" if="HXCPP_BOEHM_GC" />
     
       <precompiledheader name="hxcpp" dir="${HXCPP}/include" if="USE_PRECOMPILED_HEADERS"/>

Rebuild HXCPP and NME


Please note:
By default the following flag is added for compilation:

-isysroot /Developer/SDKs/MacOSX10.5.sdk
If you don't have the 10.5 SDK installed, add "-DMAC_USE_CURRENT_SDK" for each of the haxelib commands below, like
haxelib run hxcpp BuildLibs.xml -DMAC_USE_CURRENT_SDK

echo ========= HXCPP ===========
cd ::checkout_loc::/hxcpp/runtime
rm -rf obj
rm -rf all_objs
haxelib run hxcpp BuildLibs.xml
rm -rf obj
rm -rf all_objs
haxelib run hxcpp BuildLibs.xml -Diphoneos
rm -rf obj
rm -rf all_objs
haxelib run hxcpp BuildLibs.xml -Diphonesim
rm -rf obj
rm -rf all_objs
echo ========= NME ===========
cd ::checkout_loc::/nekonme/project
rm -rf obj
rm -rf all_objs
haxelib run hxcpp Build.xml
rm -rf obj
rm -rf all_objs
haxelib run hxcpp Build.xml -Diphoneos
rm -rf obj
rm -rf all_objs
haxelib run hxcpp Build.xml -Diphonesim
rm -rf obj
rm -rf all_objs

Trying the new install-tool


cd ::checkout_loc::/nekonme/install-tool/
haxe InstallTool.hxml

Have Fun !


test say http://www.joshuagranick.com/code/haxe/NMML%20Test.zip with:

haxelib run nme update NMML\ Test.nmml iphonesim

..more examples in ::checkout_loc::/nekonme/samples and ::checkout_loc::/gm2d/samples

version #10862, modified 2011-08-22 10:38:50 by zjnue