---
title: Deployment
sidebar_label: Deployment
---

# Deployment

This page explains how MNE-CPP handles deployment on Windows, Linux, and macOS. Deployment bundles the required Qt runtime libraries with the compiled applications so they can run outside of a development environment.

## Build Rules

All MNE-CPP libraries are built to the `mne-cpp/lib` folder. All applications, test, and examples are built to the `mne-cpp/out/Release` folder.

## Dependency Solving
MNE-CPP depends on [Qt](https://www.qt.io/) and [Eigen](http://eigen.tuxfamily.org/index.php?title=Main_Page). Eigen, as a lightweight template library, [is included in the MNE-CPP repository by default](https://github.com/mne-tools/mne-cpp/tree/main/include/3rdParty/eigen3) and does not need further dependency solving. For Qt dependencies we use Qt specific deployment tools (`windeployqt`, `linuxdeployqt`, `macdeployqt`).

### Windows

The `WinDynamic` workflow in [release.yml](https://github.com/mne-tools/mne-cpp/blob/main/.github/workflows/release.yml) excludes examples and tests. MNE-CPP libraries are copied to both `mne-cpp/lib` and `mne-cpp/out/Release`.

Dependency resolution uses `windeployqt` (maintained by Qt), called from [deploy.bat](https://github.com/mne-tools/mne-cpp/blob/main/tools/deploy.bat) with `dynamic` as the first argument. It runs against:
- The MNE Scan `.exe` (covers all application-level Qt modules)
- The Disp3D `.dll` (the highest-level library, linking all needed Qt modules)

Afterward, Qt and system libraries reside in `mne-cpp/out/Release`. The test data folder is deleted, and the output is compressed to a `.zip` file and uploaded as a release asset.

### Linux

The `LinuxDynamic` workflow in [release.yml](https://github.com/mne-tools/mne-cpp/blob/main/.github/workflows/release.yml) excludes examples and tests. CMake configures the `RPATH` to link against libraries in `mne-cpp/lib`.

Dependency resolution uses [linuxdeployqt](https://github.com/probonopd/linuxdeployqt), called from the deployment script under `tools/deployment`.

The test data folder is deleted, and the folders `out/Release/apps`, `out/Release/lib`, `out/Release/plugins`, and `out/Release/translations` are compressed to a `.tar.gz` file and uploaded as a release asset.

### macOS

The `MacOSDynamic` workflow in [release.yml](https://github.com/mne-tools/mne-cpp/blob/main/.github/workflows/release.yml) excludes examples and tests. All applications are built as `.app` bundles.

Dependency resolution uses `macdeployqt` (maintained by Qt). MNE-CPP libraries are manually copied to each app's `Contents/Frameworks` folder, and resources and plugin folders are copied to the corresponding `.app` directories.

Before packaging, standalone plugin folders (`mne_scan_plugins`, `mne_analyze_plugins`, `mne_rt_server_plugins`) and the `resources` symlink are deleted. The `out/Release` folder is compressed to a `.tar.gz` file and uploaded as a release asset.

## Static Builds

The information above corresponds to deploying the dynamically built version of MNE-CPP. In case of static deployment the process differs slightly. See the deployment scripts in `tools/deployment`.

## Deployment Scripts

The deployment scripts live in `tools/deployment`. Platform-specific scripts (`deploy.bat` for Windows, `deploy.sh` for Linux/macOS) handle dependency resolution and packaging.

Each script accepts two arguments:

1. **Linkage type**: `dynamic` (default) or `static`.
2. **Packaging**: Pass `pack` as the second argument to generate a compressed archive (`.zip` or `.tar.gz`) containing all binaries and required libraries.

During development, running the deployment script with just the `dynamic` argument is useful to resolve Qt dependencies for a particular MNE-CPP application without creating a full package.

Example:

```bash
# Resolve Qt dependencies for development (no archive)
./tools/deploy.bat dynamic

# Create a distributable archive
./tools/deploy.bat dynamic pack
```
