This is a sample project for running Haxe on the Nintendo Switch using devkitA64 and libnx.
Right now the libnx binding only contains what's needed to run the Hello World sample. It's very easy to add more, PRs are welcome :)
Special thanks to Aurel300 for his guidance on how to use ammer.
haxelib git
), containing the modified toolchainhaxelib git
), used to bind external C librarieshaxe_src
build_haxe.sh
to compile the Haxe code
clean_haxe.sh
to clean thatmake
to link the output of that in an NROMakefile
like any other homebrewbuild_haxe.sh
:
.a
file (libMain.a
)
Makefile
:
wrapper.c
, which contains a main
function booting the Haxe main classlibMain.a
and wrapper.o
into the final NROSo Haxe is responsible for the compilation step, and the homebrew Makefile
is responsible for the linking step. It's important to know if you want to add external libraries.
You need to add the includes directory to the hxcpp path, and the library to the Makefile
.
Build.xml
to your project, add the includes directory to the hxcpp pathswitch.h
, not nx.h
), edit build_haxe.sh
and add an ammer define like the one libnx has (ammer.lib.xxx.headers
)Makefile
, add the library to the LIBS
variable as you would for a regular homebrew
wrapper.c
is the only file left to compile at that point$(HAXE_LIBMAIN)
corresponds to your Haxe code (libMain.a
)