{"id":1255,"date":"2013-09-25T20:33:42","date_gmt":"2013-09-26T00:33:42","guid":{"rendered":"http:\/\/www.rocketshipgames.com\/blogs\/tjkopena\/?p=1255"},"modified":"2013-09-25T20:33:42","modified_gmt":"2013-09-26T00:33:42","slug":"floating-point-in-haxe-on-android","status":"publish","type":"post","link":"https:\/\/www.rocketshipgames.com\/blogs\/tjkopena\/2013\/09\/floating-point-in-haxe-on-android\/","title":{"rendered":"Floating Point in Haxe on Android"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-1017\" alt=\"haxe\" src=\"https:\/\/www.rocketshipgames.com\/blogs\/tjkopena\/wp-content\/uploads\/2013\/01\/haxe1.jpg\" width=\"135\" height=\"135\" \/>One thing I discovered recently is that Haxe, via hxcpp, by default\u00a0builds to a fairly old Android target platform. A consequence of this is that it uses software floating point emulation. But any Android device from ARM v7 on supports hardware floating point. Switching to this produces a dramatic speedup, assuming you&#8217;re ok with that requirement. To do so, use the <code>HXCPP_ARMV7<\/code> option, something like so:<\/p>\n<pre>openfl build -DHXCPP_M64 -DHXCPP_ARMV7 android<\/pre>\n<p>The <code>HXCPP_M64<\/code> flag is to build correctly <em>on<\/em> a 64bit machine; <a href=\"https:\/\/www.rocketshipgames.com\/blogs\/tjkopena\/2013\/07\/haxe-3-openfl-arch\/\">details here<\/a>.<\/p>\n<p>However, there&#8217;s apparently a bug somewhere in the hxcpp toolchain. Enabling the ARM v7 target adds a `-7` prefix to a variable denoting the target library extension (`.so`). Seemingly some part of the toolchain doesn&#8217;t use this extension variable, so you get a warning like this:<\/p>\n<pre>Error: Source path \"export\/android\/obj\/libApplicationMain.so\" does not exist<\/pre>\n<p><strong>NOTE<\/strong> that if you had previously built under the default architecture, the toolchain will blithely continue on using that old version and you&#8217;ll be left confused as to why none of your code updates are being applied. You have to delete that file or your Android build folder, typically <code>export\/android\/<\/code>.<\/p>\n<p>I haven&#8217;t looked into how to really fix this problem, but it seems to be enough for now to simply not add that extension prefix. In your haxelib folder, edit <code>hxcpp\/3,0,2\/build-tool\/android-toolchain.xml<\/code> and comment out this line:<\/p>\n<pre>&lt;set name=\"ARCH\" value =\"-7\" if=\"HXCPP_ARMV7\" \/&gt;<\/pre>\n<p>Everything should now build correctly and run speedier. Huzzah!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One thing I discovered recently is that Haxe, via hxcpp, by default\u00a0builds to a fairly old Android target platform. A consequence of this is that it uses software floating point emulation. But any Android device from ARM v7 on supports hardware floating point. Switching to this produces a dramatic speedup, assuming you&#8217;re ok with that &hellip; <a href=\"https:\/\/www.rocketshipgames.com\/blogs\/tjkopena\/2013\/09\/floating-point-in-haxe-on-android\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58],"tags":[110,82,100,171,135],"class_list":["post-1255","post","type-post","status-publish","format-standard","hentry","category-code","tag-android","tag-haxe","tag-linux","tag-openfl","tag-tools"],"_links":{"self":[{"href":"https:\/\/www.rocketshipgames.com\/blogs\/tjkopena\/wp-json\/wp\/v2\/posts\/1255","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rocketshipgames.com\/blogs\/tjkopena\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rocketshipgames.com\/blogs\/tjkopena\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rocketshipgames.com\/blogs\/tjkopena\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rocketshipgames.com\/blogs\/tjkopena\/wp-json\/wp\/v2\/comments?post=1255"}],"version-history":[{"count":1,"href":"https:\/\/www.rocketshipgames.com\/blogs\/tjkopena\/wp-json\/wp\/v2\/posts\/1255\/revisions"}],"predecessor-version":[{"id":1257,"href":"https:\/\/www.rocketshipgames.com\/blogs\/tjkopena\/wp-json\/wp\/v2\/posts\/1255\/revisions\/1257"}],"wp:attachment":[{"href":"https:\/\/www.rocketshipgames.com\/blogs\/tjkopena\/wp-json\/wp\/v2\/media?parent=1255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rocketshipgames.com\/blogs\/tjkopena\/wp-json\/wp\/v2\/categories?post=1255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rocketshipgames.com\/blogs\/tjkopena\/wp-json\/wp\/v2\/tags?post=1255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}