Files
orisys-app/build/README.md
T
2026-09-06 21:57:50 +08:00

81 lines
2.6 KiB
Markdown

# Build
Windows packaging for the customer desktop app.
## Layout
```text
build/
customer/
entry.py # frozen entry (no source chdir)
orisys-customer.spec # PyInstaller onedir spec
build.ps1 # create/reuse .venv-build and build
_pyinstaller/ # PyInstaller workpath (gitignored)
dist/
OrisysCustomer/
OrisysCustomer.exe
config/ # lean locales + sensors (no finger visualization/)
_internal/ # Python, PyQt5, opencv-headless, orisys, …
```
## Prerequisites
- Windows + Python 3.10+ on PATH
- `orisys` installable into the build venv (`pip install orisys>=0.5`)
- Do **not** install `orisys[gui]` / Open3D for this build
## Build
From `build\customer` (recommended):
```bat
build.bat
build.bat -Clean
build.bat -SkipInstall
```
Or from repo root:
```powershell
powershell -ExecutionPolicy Bypass -File .\build\customer\build.ps1
```
`build.bat` always resolves `build.ps1` next to itself (cwd-independent) and forwards flags.
Flags:
| Flag | Meaning |
|------|---------|
| `-Clean` | Pass `--clean` to PyInstaller (use after dep/spec changes) |
| `-SkipInstall` | Reuse packages already in `.venv-build` (faster iteration) |
Output: `dist\OrisysCustomer\OrisysCustomer.exe`
## Dependency notes
- App shared dep uses **`opencv-python-headless`** (PyQt owns the GUI).
- Upstream `orisys` may still declare `opencv-python`. `build.ps1` uninstalls that wheel and installs **`opencv-python-headless>=4.10,<5`** (5.x has shipped broken wheels without a `cv2` module). The script verifies `import cv2` before packaging.
- **Open3D is excluded** (spec + build env). Finger 3D remains a placeholder in the UI.
## Size / startup
- **onedir** (not onefile): faster cold start; ship the whole `OrisysCustomer` folder.
- Finger `assets/visualization/` is stripped from the shipped `config/` (~11 MB saved).
- Customer shell defers OpenCV / acquisition imports until Preview or Run.
Expect hundreds of MB total (Qt + numpy/scipy/numba + OpenCV). Without Open3D this stays smaller than a full `orisys[gui]` bundle.
## Verification
1. Launch `OrisysCustomer.exe` on the build machine (and ideally a clean PC without Python).
2. Theme / locale / prefs work; `preference.json` and `outputs\` appear next to the EXE.
3. Camera preview + box/mini/finger Run (video) with image modes and force plots.
4. Confirm no `open3d*` files under `dist\OrisysCustomer`.
## Editable run (unchanged)
```powershell
$env:PYTHONPATH = "D:\repo\orisys-app\shared\src;D:\repo\orisys-app\apps\customer\src"
python D:\repo\orisys-app\apps\customer\run.py
```