How to distribute a Haxe app with Hashlink?

I have a Haxe application that I want to make available to people with a Windows system. I use Hashlink to run the application locally and it works very well.

I am wondering if I should distribute my application with Hashlink. Can he build me .exe?

+8
haxe
source share
1 answer

It seems that generating binary distribution files today is not supported out of the box (March 10, 2017):

> haxe -main Main -hl main.c Code generated in main.c automatic native compilation not yet implemented 

Hopefully this will be supported soon!

Note. I am talking about creating the final executable using hashlink. A completely separate approach, which I will not consider here, is the possibility of delivering a hashlink virtual machine with your output hl-bit.

Sound people stop reading here.

But at the same time ... you can create binaries with hashlink today if you create a hash link from the source.

Warnings:

  • This is not a general cross-platform answer to your question - it is just my experience with Linux.
  • There will probably be a better way soon than this.
  • But I wanted to write these notes, even for myself, in order to remember later.

Here is what I had to do on Ubuntu 14.04, 64-bit:

Install the necessary libraries for building hl (there may be others that I already installed, for example build-essential, etc.)

 sudo apt-get install libvorbis-dev libturbojpeg libsdl2-dev libopenal-dev libssl-dev 

Clone and build the mbedtls library: (rev note: b5ba28 )

 cd ~/dev/ git clone https://github.com/ARMmbed/mbedtls.git cd mbedtls make CFLAGS='-fPIC' 

Clone the hashlink repository: (rev note: eaa92b )

 cd ~/dev/ git clone https://github.com/HaxeFoundation/hashlink.git cd hashlink 

In the # Linux section of the Makefile , ~ 67 line, add these flags:

 CFLAGS += -I ../mbedtls/include LIBFLAGS += -L../mbedtls/library 

Now create with make

If everything works, you will see two important output files: hl and libhl.so

Well, right now this is easiest if you just create your project in the hashlink directory. For example:

 # Still in the hashlink directory haxe -cp /path/to/my/project -debug -main Main.hx -hl src/_main.c 

Now run make hlc , and if everything works, hlc is the output executable (which depends on libhl.so ):

 cp libhl.so hlc /tmp/ cd /tmp/ ./hlc 

Print

 Main.hx:7: Hello world! 
+12
source share

All Articles