| Replace V with Nim 472eb49 nandithebull 3h ago | 1 | # nimflutter_ffi — Nim logic, Flutter front end. |
| Add a justfile f7c3825 nandithebull 5h ago | 2 | # |
| 3 | # Flutter is not assumed to be on PATH: set FLUTTER_BIN if yours lives |
| 4 | # somewhere other than ~/flutter/bin. |
| 5 | |
| 6 | flutter_bin := env_var_or_default("FLUTTER_BIN", env_var("HOME") / "flutter/bin") |
| Replace V with Nim 472eb49 nandithebull 3h ago | 7 | nim_bin := env_var_or_default("NIM_BIN", env_var("HOME") / "nim/bin") |
| Add a justfile f7c3825 nandithebull 5h ago | 8 | flutter := flutter_bin / "flutter" |
| 9 | lib_path := justfile_directory() / "build" |
| 10 | |
| Add a WebAssembly backend for the example 728acaa nandithebull 3h ago | 11 | # Port for `just web`. Override with WEB_PORT=9000 just web |
| 12 | web_port := env_var_or_default("WEB_PORT", "8080") |
| 13 | |
| Add a justfile f7c3825 nandithebull 5h ago | 14 | _default: |
| 15 | @just --list |
| 16 | |
| 17 | # Run the Mandelbrot explorer. |
| 18 | mandelbrot: build |
| Replace V with Nim 472eb49 nandithebull 3h ago | 19 | cd example && PATH="{{nim_bin}}:{{flutter_bin}}:$PATH" {{flutter}} run -d linux |
| Add a justfile f7c3825 nandithebull 5h ago | 20 | |
| 21 | # Alias: the example app is the Mandelbrot explorer. |
| 22 | run: mandelbrot |
| 23 | |
| Replace V with Nim 472eb49 nandithebull 3h ago | 24 | # Build the host Nim library into build/ (--mm:arc -d:danger) and check exports. |
| Add a justfile f7c3825 nandithebull 5h ago | 25 | build: |
| Replace V with Nim 472eb49 nandithebull 3h ago | 26 | PATH="{{nim_bin}}:$PATH" ./tool/build.sh |
| Add a justfile f7c3825 nandithebull 5h ago | 27 | |
| Replace V with Nim 472eb49 nandithebull 3h ago | 28 | # Compile the Nim source to C for iOS/macOS. Run after editing src/nimflutter.nim. |
| Add a justfile f7c3825 nandithebull 5h ago | 29 | gen-ios: |
| Replace V with Nim 472eb49 nandithebull 3h ago | 30 | PATH="{{nim_bin}}:$PATH" ./tool/gen_ios_sources.sh |
| Add a justfile f7c3825 nandithebull 5h ago | 31 | |
| Add a WebAssembly backend for the example 728acaa nandithebull 3h ago | 32 | # 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 ago | 36 | # Compile the Nim source to WebAssembly for the web build. |
| Add a WebAssembly backend for the example 728acaa nandithebull 3h ago | 37 | wasm: |
| Replace V with Nim 472eb49 nandithebull 3h ago | 38 | PATH="{{nim_bin}}:$PATH" ./tool/build_wasm.sh |
| Add a WebAssembly backend for the example 728acaa nandithebull 3h ago | 39 | |
| 40 | # Headless check of the wasm module — no browser, no Flutter. |
| 41 | test-wasm: wasm |
| 42 | node tool/test_wasm.mjs |
| 43 | |
| Render in parallel on web, via a pool of Web Workers 4506a58 nandithebull 2h ago | 44 | # Does the web build really render in parallel, and still get the same pixels? |
| 45 | check-pool: wasm |
| 46 | ./tool/check_pool.sh |
| 47 | |
| Add a WebAssembly backend for the example 728acaa nandithebull 3h ago | 48 | # Same frame from the wasm and native kernels, compared byte for byte. |
| 49 | parity: 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 ago | 55 | # Serve the Mandelbrot explorer, with Nim running as wasm. |
| Add a WebAssembly backend for the example 728acaa nandithebull 3h ago | 56 | web: 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/ |
| 60 | build-web: wasm |
| 61 | cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} build web --release |
| 62 | |
| Replace V with Nim 472eb49 nandithebull 3h ago | 63 | # 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 ago | 64 | check-web: build-web |
| 65 | ./tool/check_web.sh |
| 66 | |
| Add a justfile f7c3825 nandithebull 5h ago | 67 | # Analyze and test the example. Needs the host library for the FFI calls. |
| 68 | test: 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 ago | 72 | # Nim vs Dart timings for the same frame (AOT, so it matches a release app). |
| Add a justfile f7c3825 nandithebull 5h ago | 73 | bench: build |
| Replace V with Nim 472eb49 nandithebull 3h ago | 74 | 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 ago | 76 | |
| Raise the isolate ceiling to 32, and add the sweep that justifies it 59a731a nandithebull 5h ago | 77 | # Sweep the isolate count to find the best band split for this machine. |
| 78 | sweep: build |
| Replace V with Nim 472eb49 nandithebull 3h ago | 79 | 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 ago | 81 | |
| Add a justfile f7c3825 nandithebull 5h ago | 82 | # String round-trip and isolate dispatch. No Flutter SDK required. |
| 83 | smoke: build |
| 84 | LD_LIBRARY_PATH="{{lib_path}}" dart example/lib/main_test.dart |
| 85 | |
| Replace V with Nim 472eb49 nandithebull 3h ago | 86 | # RSS regression guard for the shared-heap ownership rule. No Flutter SDK needed. |
| Add a justfile f7c3825 nandithebull 5h ago | 87 | memcheck: build |
| 88 | LD_LIBRARY_PATH="{{lib_path}}" dart example/lib/memory_check.dart |
| 89 | |
| 90 | # Release build of the example. |
| 91 | release: build |
| Replace V with Nim 472eb49 nandithebull 3h ago | 92 | cd example && PATH="{{nim_bin}}:{{flutter_bin}}:$PATH" {{flutter}} build linux --release |
| Add a justfile f7c3825 nandithebull 5h ago | 93 | |
| 94 | # Everything CI would run. |
| Render in parallel on web, via a pool of Web Workers 4506a58 nandithebull 2h ago | 95 | ci: build smoke memcheck test bench test-wasm parity check-pool check-web |
| Add a justfile f7c3825 nandithebull 5h ago | 96 | |
| 97 | clean: |
| Replace V with Nim 472eb49 nandithebull 3h ago | 98 | rm -rf build example/build example/web/nimflutter.js example/web/nimflutter.wasm |