How to Add New OpenFL CPP Target?

195 views
Skip to first unread message

Shin-NiL

unread,
Aug 6, 2013, 7:54:21 AM8/6/13
to haxe...@googlegroups.com
Hello guys!

I'm trying to add a new cpp target to OpenFL. My goal is to run OpenFL programs on a mips based portable device running a customized linux OS.

I was able to make changes enough on hxcpp to compile and run a "hello world" program, but now I have no clues what to do next. I've added my configurations in NME/project/Build.xml and tried to rebuild tools, but I got this error: "Class not found : CommandLineTools".

Is that the correct approach? Any tips?

Thank you.

Jason O'Neil

unread,
Aug 6, 2013, 7:01:07 PM8/6/13
to haxe...@googlegroups.com
Hopefully Joshua Granick will chime in :)

If not, ping him on twitter (@singmajesty) to ask for help


--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Hugh

unread,
Aug 7, 2013, 12:59:43 AM8/7/13
to haxe...@googlegroups.com
Hi,
Once you have hxcpp working, the next step is the compile the native NME ndll.
The ndll requires a set of libraries provided in the "sdl-static" peoject, see

This has a "makefile" you can use on linux, but you make need to set some compile flags - especially if you wan to do cross-compiling.  You may also want to use the system version of libSDL - in which case you will not need all of these libs.

Once you have these libraries, you can build the nme ndll via haxelib:
haxelib run hxcpp Build.xml
from the "project" directory.  You may want to edit the Build.xml if you want to use specific system versions of various support libraries.  Otherwise, it will look for them in a relative path, so you want to put the sdl-static checkout next to the nme checkout.

See how you go with these steps.

Hugh

Nilton Rufino

unread,
Aug 7, 2013, 7:17:51 AM8/7/13
to haxe...@googlegroups.com
Thanks guys :)

I've made some progress following Hugh's instructions. Now I'm stuck getting some HardwareContext and OpenGL errors at linking time. I've tried both approaches, using sdl_static and sdl_dynamic getting same errors. My target system supports SDL but no OpenGL at all. Maybe I haven't configured Build.xml properly...

Is OpenGL required to run OpenFL? Is there any other target with characteristics similar to mine so I can use it as a template?

Thanks again, my friends.

 


2013/8/7 Hugh <game...@gmail.com>
--
You received this message because you are subscribed to a topic in the Google Groups "Haxe" group.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Hugh

unread,
Aug 8, 2013, 12:25:19 AM8/8/13
to haxe...@googlegroups.com
Hi,
I guess we were not expecting sdl without opengl ( winrt target does not use opengl, but then it does not use sdl)

You should be able to remove references to 'HardwareRenderer::CreateOpenGL' from SDLStage, either by commenting them out to start with, or using
#ifndef YOUR_PLATFORM
around the call.

Hugh

On Tuesday, 6 August 2013 19:54:21 UTC+8, Shin-NiL wrote:
Message has been deleted

Nilton Rufino

unread,
Aug 8, 2013, 9:02:17 AM8/8/13
to haxe...@googlegroups.com
I've finally got nme.dll! What should I do next? I'm lost again :(

Thanks!


2013/8/8 Shin-NiL <nil...@gmail.com>
I've finally got nme.dll! What should I do next? I'm lost again :(

Thanks!

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Hugh

unread,
Aug 9, 2013, 12:53:15 AM8/9/13
to haxe...@googlegroups.com
Hi,
The next thing to do is work out how your device wants the build "packaged".
You can build the cpp exe just by using the command-line, like
haxe -main MyMain -lib nme -cpp build ...
Then grab you exe from build/MyMain.exe
You should somehow be able to put this on your device, along side the nme.ndll and have it run.  You may need a directory structure or manifest etc.  If you start with an example project and copy in the new binaries you should be able to make progress.  (you will probably need the hxcpp ndll libraries too)
The exe will try to load your nme.ndll code, which may require some customisation, depending on where things are put.  You can see this in the nme.Loader code - you could first try hardwiring a path in here.
Good to check the logs for error messages as to why libraries etc cant be loaded.  You can also force on gLoadDebug in  $HXCPP/src/hx/Lib.cpp for some more details, or if you really need to change how the library is loaded.
Once you have done this manually, it is time to automate the procedure by adding templates and changing the openfl code.  (over to Joshua for this)

Hugh

Nilton Rufino

unread,
Aug 9, 2013, 8:04:42 AM8/9/13
to haxe...@googlegroups.com
Thanks again, Hugh!

With your tips, I was able to create my executable. I've not had the opportunity to test it on my device, I'll probably have to make some adjustments before fully work, but this should not be so difficult.

My weekend will be challenging :)


2013/8/9 Hugh <game...@gmail.com>
Reply all
Reply to author
Forward
0 new messages