haxeui / hxWidgets

Haxe externs (and wrappers) for wxWidgets
MIT License
77 stars 22 forks source link

cppia support #37

Closed ibilon closed 5 years ago

ibilon commented 8 years ago

Looked into cppia support, would allow building a native app in seconds.

To compile a host: haxe -cpp host -D scriptable --macro include\(\"hx.widgets\"\) -lib hxWidgets -main cpp.cppia.Host -dce no

Issues so far:

And host doesn't compile:

In file included from ./src/__boot__.cpp:590:0:
include/haxe/ds/_GenericStack/GenericStackIterator.h:48:16: error: conflicting return type specified for ‘virtual int haxe::ds::_GenericStack::GenericStackIterator_obj::hasNext()’
   virtual Bool hasNext();
                ^
In file included from /home/ibilon/Code/Haxelibs/hxcpp/include/Array.h:4:0,
                 from /home/ibilon/Code/Haxelibs/hxcpp/include/hxcpp.h:322:
/home/ibilon/Code/Haxelibs/hxcpp/include/cpp/FastIterator.h:24:17: error:   overriding ‘bool cpp::FastIterator_obj<T>::hasNext() [with T = Dynamic]’
    virtual bool hasNext() = 0;
                 ^
Error: Build failed

removing -dce no hides that error but doesn't give a working host.

ianharrigan commented 8 years ago

This is interesting, ive never used cppia, so what would be the benefits of using this rather than just a normal haxe app? I mean, you say you can build an app in seconds; what does that mean exactly?

ibilon commented 8 years ago

I mean, you say you can build an app in seconds; what does that mean exactly?

Literally, you make your hxWidgets app, launch the compilation and a couple of seconds latter it's done.

Cppia apps are separated in the host and the script, the host is a vm for the script and the script is a form of bytecode (or ascii text file in debug mode). That makes the script really fast to compile since it's just haxe, no g++.

Here the host would contain all of hxWidgets, so it would be the host that's linked against all of wx's libraries.

This is interesting, ive never used cppia, so what would be the benefits of using this rather than just a normal haxe app?

Besides the time, which is a huge benefit (for users, if you modify the lib you have to recompile the host) you don't need g++/wx-dev just haxe (and ofc the normal wx libraries installed to run it).

edit: other explanations in https://haxe.io/roundups/wwx/2015/, http://gamehaxe.com/wwx/wwx2015.swf and https://groups.google.com/forum/#!topic/haxelang/yURC8k2fGeg

ianharrigan commented 8 years ago

Very very interesting stuff. Is there a PoC to play with? Or is this something that requires quite alot of work before its FFP... And how do you see this fitting in with the current codebase... a separate "cppia host" app or something along those lines?

ibilon commented 8 years ago

No PoC yet, having some troubles compiling the host, some weird c++ errors.

We need two things, for the client compilation changing the hxml

-cpp myapp.cppia
-D cppia

and the host, so maybe shipping one with the lib, and letting people do haxelib run hxWidgets myapp.cppia.

cambiata commented 7 years ago

Cppia for HxWidgets development would be sooo coool..!

darmie commented 5 years ago

@ibilon how far with this?

ibilon commented 5 years ago

It went nowhere, cppia and externs don't mix well, mainly the enums which are used in user code (so would be in the cppia file) but require access to the externs. Probably not doable with the current system.