nandi/vflutter_ffipublic Fork 0
472eb493bac94bdcb79a38829ccca0c541256fef
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 · 94 lines · 3.4 KBMakefile Blame HistoryRaw
Replace V with Nim 472eb49 nandithebull 5h ago1# nimflutter_ffi — Nim logic, Flutter front end.
Add a justfile f7c3825 nandithebull 7h 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 5h ago7nim_bin := env_var_or_default("NIM_BIN", env_var("HOME") / "nim/bin")
Add a justfile f7c3825 nandithebull 7h ago8flutter := flutter_bin / "flutter"
9lib_path := justfile_directory() / "build"
10
Add a WebAssembly backend for the example 728acaa nandithebull 5h 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 7h ago14_default:
15 @just --list
16
17# Run the Mandelbrot explorer.
18mandelbrot: build
Replace V with Nim 472eb49 nandithebull 5h ago19 cd example && PATH="{{nim_bin}}:{{flutter_bin}}:$PATH" {{flutter}} run -d linux
Add a justfile f7c3825 nandithebull 7h ago20
21# Alias: the example app is the Mandelbrot explorer.
22run: mandelbrot
23
Replace V with Nim 472eb49 nandithebull 5h ago24# Build the host Nim library into build/ (--mm:arc -d:danger) and check exports.
Add a justfile f7c3825 nandithebull 7h ago25build:
Replace V with Nim 472eb49 nandithebull 5h ago26 PATH="{{nim_bin}}:$PATH" ./tool/build.sh
Add a justfile f7c3825 nandithebull 7h ago27
Replace V with Nim 472eb49 nandithebull 5h ago28# Compile the Nim source to C for iOS/macOS. Run after editing src/nimflutter.nim.
Add a justfile f7c3825 nandithebull 7h ago29gen-ios:
Replace V with Nim 472eb49 nandithebull 5h ago30 PATH="{{nim_bin}}:$PATH" ./tool/gen_ios_sources.sh
Add a justfile f7c3825 nandithebull 7h ago31
Add a WebAssembly backend for the example 728acaa nandithebull 5h 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 5h ago36# Compile the Nim source to WebAssembly for the web build.
Add a WebAssembly backend for the example 728acaa nandithebull 5h ago37wasm:
Replace V with Nim 472eb49 nandithebull 5h ago38 PATH="{{nim_bin}}:$PATH" ./tool/build_wasm.sh
Add a WebAssembly backend for the example 728acaa nandithebull 5h ago39
40# Headless check of the wasm module — no browser, no Flutter.
41test-wasm: wasm
42 node tool/test_wasm.mjs
43
44# Same frame from the wasm and native kernels, compared byte for byte.
45parity: build wasm
46 ./tool/check_parity.sh
47
48# Prints a URL and waits; no browser is launched. Hot restart still works
49# (press R). Override the port with WEB_PORT=9000 just web
50#
Replace V with Nim 472eb49 nandithebull 5h ago51# Serve the Mandelbrot explorer, with Nim running as wasm.
Add a WebAssembly backend for the example 728acaa nandithebull 5h ago52web: wasm
53 cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} run -d web-server --web-port={{web_port}}
54
55# Release web build of the example. Output: example/build/web/
56build-web: wasm
57 cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} build web --release
58
Replace V with Nim 472eb49 nandithebull 5h ago59# Load the built web app in headless Chrome and assert Nim drew a real frame.
Add a WebAssembly backend for the example 728acaa nandithebull 5h ago60check-web: build-web
61 ./tool/check_web.sh
62
Add a justfile f7c3825 nandithebull 7h ago63# Analyze and test the example. Needs the host library for the FFI calls.
64test: build
65 cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} analyze
66 cd example && LD_LIBRARY_PATH="{{lib_path}}" PATH="{{flutter_bin}}:$PATH" {{flutter}} test
67
Replace V with Nim 472eb49 nandithebull 5h ago68# Nim vs Dart timings for the same frame (AOT, so it matches a release app).
Add a justfile f7c3825 nandithebull 7h ago69bench: build
Replace V with Nim 472eb49 nandithebull 5h ago70 dart compile exe example/lib/fractal_bench.dart -o /tmp/nimflutter_bench
71 LD_LIBRARY_PATH="{{lib_path}}" /tmp/nimflutter_bench
Add a justfile f7c3825 nandithebull 7h ago72
Raise the isolate ceiling to 32, and add the sweep that justifies it 59a731a nandithebull 7h ago73# Sweep the isolate count to find the best band split for this machine.
74sweep: build
Replace V with Nim 472eb49 nandithebull 5h ago75 dart compile exe example/lib/tile_sweep.dart -o /tmp/nimflutter_sweep
76 LD_LIBRARY_PATH="{{lib_path}}" /tmp/nimflutter_sweep
Raise the isolate ceiling to 32, and add the sweep that justifies it 59a731a nandithebull 7h ago77
Add a justfile f7c3825 nandithebull 7h ago78# String round-trip and isolate dispatch. No Flutter SDK required.
79smoke: build
80 LD_LIBRARY_PATH="{{lib_path}}" dart example/lib/main_test.dart
81
Replace V with Nim 472eb49 nandithebull 5h ago82# RSS regression guard for the shared-heap ownership rule. No Flutter SDK needed.
Add a justfile f7c3825 nandithebull 7h ago83memcheck: build
84 LD_LIBRARY_PATH="{{lib_path}}" dart example/lib/memory_check.dart
85
86# Release build of the example.
87release: build
Replace V with Nim 472eb49 nandithebull 5h ago88 cd example && PATH="{{nim_bin}}:{{flutter_bin}}:$PATH" {{flutter}} build linux --release
Add a justfile f7c3825 nandithebull 7h ago89
90# Everything CI would run.
Add a WebAssembly backend for the example 728acaa nandithebull 5h ago91ci: build smoke memcheck test bench test-wasm parity check-web
Add a justfile f7c3825 nandithebull 7h ago92
93clean:
Replace V with Nim 472eb49 nandithebull 5h ago94 rm -rf build example/build example/web/nimflutter.js example/web/nimflutter.wasm