nandi/vflutter_ffipublic Fork 0
main
Commits
Clone
git clone https://git.rickub.com/nandi/vflutter_ffi.git
git clone ssh://git@rickub.com/nandi/vflutter_ffi.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

justfile · 98 lines · 3.5 KBMakefile Blame HistoryRaw
Replace V with Nim 472eb49 nandithebull 3h ago1# nimflutter_ffi — Nim logic, Flutter front end.
Add a justfile f7c3825 nandithebull 5h ago2#
3# Flutter is not assumed to be on PATH: set FLUTTER_BIN if yours lives
4# somewhere other than ~/flutter/bin.
5
6flutter_bin := env_var_or_default("FLUTTER_BIN", env_var("HOME") / "flutter/bin")
Replace V with Nim 472eb49 nandithebull 3h ago7nim_bin := env_var_or_default("NIM_BIN", env_var("HOME") / "nim/bin")
Add a justfile f7c3825 nandithebull 5h ago8flutter := flutter_bin / "flutter"
9lib_path := justfile_directory() / "build"
10
Add a WebAssembly backend for the example 728acaa nandithebull 3h ago11# Port for `just web`. Override with WEB_PORT=9000 just web
12web_port := env_var_or_default("WEB_PORT", "8080")
13
Add a justfile f7c3825 nandithebull 5h ago14_default:
15 @just --list
16
17# Run the Mandelbrot explorer.
18mandelbrot: build
Replace V with Nim 472eb49 nandithebull 3h ago19 cd example && PATH="{{nim_bin}}:{{flutter_bin}}:$PATH" {{flutter}} run -d linux
Add a justfile f7c3825 nandithebull 5h ago20
21# Alias: the example app is the Mandelbrot explorer.
22run: mandelbrot
23
Replace V with Nim 472eb49 nandithebull 3h ago24# Build the host Nim library into build/ (--mm:arc -d:danger) and check exports.
Add a justfile f7c3825 nandithebull 5h ago25build:
Replace V with Nim 472eb49 nandithebull 3h ago26 PATH="{{nim_bin}}:$PATH" ./tool/build.sh
Add a justfile f7c3825 nandithebull 5h ago27
Replace V with Nim 472eb49 nandithebull 3h ago28# Compile the Nim source to C for iOS/macOS. Run after editing src/nimflutter.nim.
Add a justfile f7c3825 nandithebull 5h ago29gen-ios:
Replace V with Nim 472eb49 nandithebull 3h ago30 PATH="{{nim_bin}}:$PATH" ./tool/gen_ios_sources.sh
Add a justfile f7c3825 nandithebull 5h ago31
Add a WebAssembly backend for the example 728acaa nandithebull 3h ago32# emcc is not installed: tool/bin/emcc is a DotSlash file that fetches a
33# content-pinned emscripten on first run and caches it in ~/.cache/dotslash.
34# Only `dotslash` itself needs to be on PATH.
35#
Replace V with Nim 472eb49 nandithebull 3h ago36# Compile the Nim source to WebAssembly for the web build.
Add a WebAssembly backend for the example 728acaa nandithebull 3h ago37wasm:
Replace V with Nim 472eb49 nandithebull 3h ago38 PATH="{{nim_bin}}:$PATH" ./tool/build_wasm.sh
Add a WebAssembly backend for the example 728acaa nandithebull 3h ago39
40# Headless check of the wasm module — no browser, no Flutter.
41test-wasm: wasm
42 node tool/test_wasm.mjs
43
Render in parallel on web, via a pool of Web Workers 4506a58 nandithebull 2h ago44# Does the web build really render in parallel, and still get the same pixels?
45check-pool: wasm
46 ./tool/check_pool.sh
47
Add a WebAssembly backend for the example 728acaa nandithebull 3h ago48# Same frame from the wasm and native kernels, compared byte for byte.
49parity: build wasm
50 ./tool/check_parity.sh
51
52# Prints a URL and waits; no browser is launched. Hot restart still works
53# (press R). Override the port with WEB_PORT=9000 just web
54#
Replace V with Nim 472eb49 nandithebull 3h ago55# Serve the Mandelbrot explorer, with Nim running as wasm.
Add a WebAssembly backend for the example 728acaa nandithebull 3h ago56web: wasm
57 cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} run -d web-server --web-port={{web_port}}
58
59# Release web build of the example. Output: example/build/web/
60build-web: wasm
61 cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} build web --release
62
Replace V with Nim 472eb49 nandithebull 3h ago63# Load the built web app in headless Chrome and assert Nim drew a real frame.
Add a WebAssembly backend for the example 728acaa nandithebull 3h ago64check-web: build-web
65 ./tool/check_web.sh
66
Add a justfile f7c3825 nandithebull 5h ago67# Analyze and test the example. Needs the host library for the FFI calls.
68test: build
69 cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} analyze
70 cd example && LD_LIBRARY_PATH="{{lib_path}}" PATH="{{flutter_bin}}:$PATH" {{flutter}} test
71
Replace V with Nim 472eb49 nandithebull 3h ago72# Nim vs Dart timings for the same frame (AOT, so it matches a release app).
Add a justfile f7c3825 nandithebull 5h ago73bench: build
Replace V with Nim 472eb49 nandithebull 3h ago74 dart compile exe example/lib/fractal_bench.dart -o /tmp/nimflutter_bench
75 LD_LIBRARY_PATH="{{lib_path}}" /tmp/nimflutter_bench
Add a justfile f7c3825 nandithebull 5h ago76
Raise the isolate ceiling to 32, and add the sweep that justifies it 59a731a nandithebull 5h ago77# Sweep the isolate count to find the best band split for this machine.
78sweep: build
Replace V with Nim 472eb49 nandithebull 3h ago79 dart compile exe example/lib/tile_sweep.dart -o /tmp/nimflutter_sweep
80 LD_LIBRARY_PATH="{{lib_path}}" /tmp/nimflutter_sweep
Raise the isolate ceiling to 32, and add the sweep that justifies it 59a731a nandithebull 5h ago81
Add a justfile f7c3825 nandithebull 5h ago82# String round-trip and isolate dispatch. No Flutter SDK required.
83smoke: build
84 LD_LIBRARY_PATH="{{lib_path}}" dart example/lib/main_test.dart
85
Replace V with Nim 472eb49 nandithebull 3h ago86# RSS regression guard for the shared-heap ownership rule. No Flutter SDK needed.
Add a justfile f7c3825 nandithebull 5h ago87memcheck: build
88 LD_LIBRARY_PATH="{{lib_path}}" dart example/lib/memory_check.dart
89
90# Release build of the example.
91release: build
Replace V with Nim 472eb49 nandithebull 3h ago92 cd example && PATH="{{nim_bin}}:{{flutter_bin}}:$PATH" {{flutter}} build linux --release
Add a justfile f7c3825 nandithebull 5h ago93
94# Everything CI would run.
Render in parallel on web, via a pool of Web Workers 4506a58 nandithebull 2h ago95ci: build smoke memcheck test bench test-wasm parity check-pool check-web
Add a justfile f7c3825 nandithebull 5h ago96
97clean:
Replace V with Nim 472eb49 nandithebull 3h ago98 rm -rf build example/build example/web/nimflutter.js example/web/nimflutter.wasm