Compiling plugins#

Whether you’re creating a new plugin or you cloned an existing plugin repository, the following steps will allow you to compile your plugin across all three platforms. Note that CMake is required in all cases. See the compiling the GUI page for recommended instructions for installing CMake if you don’t have it already.

Most Open Ephys GUI plugins work equally well on Windows, Linux, and Mac. However, there are some plugins that rely on platform-specific libraries, and can only be compiled for certain platforms. Be sure to check the relevant plugin documentation page for platform compatibility.

Important

These instructions assume you have already compiled the main application from source. If not, you should start by following the instructions on this page.

Obtaining the source code#

The first step for compiling a pre-existing plugin is downloading the source code. If you’re planning to make your own changes to the plugin, we recommend first forking the plugin’s GitHub repository to your own account, then cloning the fork via the command line or the GitHub Desktop app. If you’re not planning to make any changes to the plugin, you can clone the original repository or download the code as a .zip file.

All of the officially supported plugins assume that the plugin source code is contained within a separate directory at the same level as that of the host application (the plugin-GUI GitHub repository). Before attempting to compile your plugin, make sure your directory structure looks something like this:

Code
├── plugin-GUI
│   ├── Build
│   ├── Source
│   └── ...
│
├── OEPlugins
│   └── plugin-1
│   │   ├── Build
│   │   ├── Source
│   │   └── ...
│   │
│   └── plugin-2
│       ├── Build
│       ├── Source
│       └── ...

Windows#

Generate the Visual Studio 2022 project files by typing the following from the command prompt inside the plugin’s top-level directory:

> cd Build
> cmake -G "Visual Studio 17 2022" -A x64 ..

Note

For earlier version of Visual Studio, substitute the last command with:
cmake -G "Visual Studio 16 2019" -A x64 ..
cmake -G "Visual Studio 15 2017 Win64" ..
cmake -G "Visual Studio 14 2015 Win64" ..
or
cmake -G "Visual Studio 12 2013 Win64" ..

Next, launch Visual Studio and open the OE_PLUGIN_<plugin-name>.sln file that was just created in the “Build” folder. Select the appropriate configuration (Debug/Release) and either build the solution or build the ALL_BUILD project. That will run the build process on all projects except INSTALL, thus building the plugin.

Selecting the INSTALL project and manually building it will trigger the install procedure, copying the plugin and any required files, if any, to the GUI’s appropriate directories.

macOS#

To create the Xcode project files for the plugin, type the following commands from the plugin’s top-level directory:

$ cd Build
$ cmake -G "Xcode" ..

Note that the final two periods are critical for getting this command to work.

Next, launch Xcode and open the <plugin-name>.xcodeproj file that now lives in the “Build” directory.

Building the ALL_BUILD scheme will build the plugin, while selecting INSTALL will install the plugin in the appropriate location within the plugin-GUI Build directory.

Important

If you’re building the plugin on a Mac with Apple Silicon, you’ll need to make sure the ALL_BUILD profile is set use “Rosetta”. You will likely need to first set the build target to “Any Mac,” and then select the “My Mac (Rosetta)” option that appears. It is possible to build a version of the GUI that runs natively on Apple Silicon, but there are a few extra steps involved, and it won’t work with plugins downloaded via the Plugin Installer. If you’re interested in this, please reach out to support@open-ephys.org for more info.

The default Xcode build configuration is “Debug.” To build the plugin in “Release” mode either modify the scheme settings or, instead of clicking Project/Build to build and install the plugin select Project > Build for > Profiling.

Linux#

Generate the Linux makefiles by entering the following from the plugin’s top-level directory:

$ cd Build
$ cmake -G "Unix Makefiles" ..

Note

To specify “Debug” or “Release” mode, add -DCMAKE_BUILD_TYPE=Release or -DCMAKE_BUILD_TYPE=Debug to the last command, just before the two periods. Setting a variable using a -D argument will be permanent, with following calls to cmake in the same folder using its set value even if the argument is not used in them. Variables can be either set to a different value by calling cmake with a different -D option (thereby overwriting the existing value) or unset by calling cmake -UVARIABLE.

Once the makefile generation step is finished, enter the following line from the “Build” directory:

$ make

This will build the plugin.

Next, running:

$ make install

will copy the plugin and any additional required files to the appropriate location within the host application.