# Building native installers (.dmg / .exe)

Native installers must be built **on the matching OS** — you cannot build a Mac
`.dmg` on Windows/Linux or vice-versa. The spec (`sulcora.spec`) is shared.

## Prerequisites (both)
```bash
pip install -e ".[gui,sample]"
pip install pyinstaller
```

## Windows → Sulcora.exe
```bat
pyinstaller installer\sulcora.spec
:: result: dist\Sulcora\Sulcora.exe  (a folder build; zip it for distribution)
```
For a single-file exe, add `--onefile` semantics via a one-file spec (larger, slower start).

## macOS → Sulcora.app → Sulcora.dmg
```bash
pyinstaller installer/sulcora.spec          # -> dist/Sulcora.app
# package into a .dmg:
brew install create-dmg
create-dmg --volname "Sulcora" --window-size 500 300 \
  Sulcora.dmg dist/Sulcora.app
# (or:  hdiutil create -volname Sulcora -srcfolder dist/Sulcora.app Sulcora.dmg )
```

## ⚠️ Code signing (the part that costs money)
Unsigned apps trigger Gatekeeper (macOS) / SmartScreen (Windows) warnings and may
be blocked on managed hospital machines.
- **macOS:** Apple Developer Program (~$99/yr) → `codesign` + `notarytool` notarization.
- **Windows:** an EV/OV code-signing certificate (annual cost) → `signtool`.
Do this only when you have a real reason to distribute installers (e.g., a pilot
site). For demos, the browser version avoids all of this.

## Heads-up
- VTK + PyQt5 bundles are large (~250–500 MB) and sometimes need extra
  `hiddenimports`; test the built app on a clean machine.
- The bundled sample MRI lets the app launch with data out of the box.
