Lelelo1/haxe_sample_targets

README

Opened this issue · 0 comments

haxe_sample_targets

This is a showcase of cross language compilation feature of Haxe. See fullist of targets in the docs. The following targets here are the ones I think is the most attractive for software development, which is my interest area.

Java
Javascript
Python
C#

(Maybe also)
C++
Objective-C

Instructions:

Make sure you have native tooling installed, Java, Node.js, .NET Core for example. If you don't want to run a certain target you can comment out a line in Run.hxml

Install haxe - which should should be simple: https://haxe.org/download/

From the root folder of he project, open a terminal and...

haxe build.hxml

Which build native libraries, like .jar, javasciptlib and .dll into the bin/ folder.

Then run:

haxe run.hxml

Which calls the with the native libraries and source code with tooling, like java, node, dotnet.

(Note that you can open the hxml files and see what cmd/terminal commands are executed, you can copy it and call it in your own terminal as well. It's the same thing)

Result:

haxe:) /Users/lelelo1/Projects/haxe_sample_targets/bin/binJava/Main.jar
haxe:) /Users/lelelo1/Projects/haxe_sample_targets/bin/binJS/Main.js
haxe:) /Users/lelelo1/Projects/haxe_sample_targets/bin/binPython/main.py
The template "Console Application" was created successfully.
Processing post-creation actions...
Running 'dotnet restore' on /Users/lelelo1/Projects/haxe_sample_targets/bin/binCSharp/src/src.csproj...
Determining projects to restore...
Restored /Users/lelelo1/Projects/haxe_sample_targets/bin/binCSharp/src/src.csproj (in 102 ms).
Restore succeeded.
haxe:) /Users/lelelo1/Projects/haxe_sample_targets/bin/binCSharp/src/bin/Debug/net5.0/src.dll

The file path will be printed in each native library. You can look at the file extension to see which one is executed. This is to illustrate the cross language feature of haxe.

There are lots of other neat things that can done - visit the forum for more info: https://community.haxe.org