Skip to content

Commit

Permalink
Add fmt sample, and temp hack to hopefully make the ninja generator w…
Browse files Browse the repository at this point in the history
…ork on macOS.
  • Loading branch information
Apprentice-Alchemist committed Nov 30, 2024
1 parent 6f69b83 commit f42af64
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,11 @@ jobs:
popd
fi
haxe -hl out/main.c -cp other/tests -main HelloWorld -D hlgen.makefile=ninja
out/main
haxe -hl out/helloworld/main.c -cp other/tests -main HelloWorld -D hlgen.makefile=ninja
out/helloworld/main
haxe -hl out/fmtsample/main.c -cp other/fmtsample -main FmtSample -D hlgen.makefile=ninja
out/fmtsample/main
;;
esac
Expand Down
10 changes: 10 additions & 0 deletions other/fmtsample/FmtSample.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function main() {
var out = haxe.io.Bytes.alloc(16);
var src = haxe.io.Bytes.ofString("Hello World!");
hl.Format.digest(out.getData(), src.getData(), src.length, 0 /* md5 */);
final expected = "ed076287532e86365e841e92bfc50d8c";
final got = out.toHex();
if (got != expected) {
throw 'expected $expected, got $got';
}
}
4 changes: 2 additions & 2 deletions other/haxelib/Run.hx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class NinjaGenerator {
gen.bind('cflags', '$opt_flag -std=c11 -DHL_MAKE -Wall -I. -pthread');
final libflags = config.libs.map((lib) -> switch lib {
case "std": "-lhl";
case "uv": '-l:$lib.hdll -luv';
case var lib: '-l:$lib.hdll';
case "uv": '/usr/local/lib/$lib.hdll -luv';
case var lib: '/usr/local/lib/$lib.hdll';
}).join(' ');
gen.bind('ldflags', '-pthread -lm -L/usr/local/lib $libflags $rpath');
gen.rule('cc', [
Expand Down

0 comments on commit f42af64

Please sign in to comment.