# iLAND Runtime Layout

This folder is used for bundled, OS-specific iLAND console runtimes.

Detected locations:

- `runtime/windows/iLANDc.exe`
- `runtime/macos/iLANDc` (or `runtime/macos/ilandc`)
- `runtime/linux/iLANDc` (or `runtime/linux/ilandc`)

For non-Windows platforms, a source snapshot from `iland-model-main/src/ilandc` is included under `runtime/<os>/src/ilandc`.
That snapshot is for reference and does not by itself create a runnable binary.

To run on macOS/Linux, place a native executable named `iLANDc` or `ilandc` in the corresponding OS folder.

## Windows Local Build (Easy Path)

The repository includes a helper script to build and stage a Windows runtime:

- Script: `build_windows_runtime.ps1`
- Default source: `iland-model-main`
- Default target runtime tag: `dev-latest`

By default, the build script stages runtime only into the plugin tree (uninstall-clean behavior).
User-level staging in `%LOCALAPPDATA%` is opt-in via `-StageUserRuntime`.

Run from repository root:

```powershell
.\build_windows_runtime.ps1
```

What it does:

1. Builds `ilandc.exe` from `iland-model-main/src/ilandc/ilandc.pro`
2. Stages binary into plugin tree at `iland_qgis_plugin/runtime/windows/iLANDc.exe`
3. Optionally stages binary into user runtime store at `%LOCALAPPDATA%/iLANDWorkbenchQGIS/runtimes/dev-latest/ilandc.exe`
4. Optionally updates `%LOCALAPPDATA%/iLANDWorkbenchQGIS/runtimes/index.json` and activates the tag

Optional examples:

```powershell
.\build_windows_runtime.ps1 -RuntimeTag dev-local -Clean
.\build_windows_runtime.ps1 -RuntimeTag dev-local -StageUserRuntime
.\build_windows_runtime.ps1 -IlandSourceDir C:\dev\iland-model -QmakePath C:\Qt\6.7.2\msvc2022_64\bin\qmake.exe
```

Cleanup helper (for user runtime store):

```powershell
.\remove_windows_runtime.ps1 -RuntimeTag dev-local
.\remove_windows_runtime.ps1 -All -RemoveConfig
```
