The build files for plugins located in our official plugin repository as well as third party plugins using our plugin template must be generated using CMake, a widely used automated build generation tool.
Installing CMake
On Linux, CMake should be installed via the distribution official package system. For Ubuntu and other Debian-based distributions execute
sudo apt-get update sudo apt-get install cmake
On Windows and Mac, it can be downloaded from its official download page.
On Windows, it is highly recommended to select the option "Add CMake to the system PATH" for either all users or current users, as it will allow easy use of the command line tools.
On Mac, it is recommended to run the following command to install system-wide access to the command line tools
sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install
Creating build files
IMPORTANT: The plugin repository must be clone alongside the GUI repository. For example, if the GUI is located in /usr/src/open-ephys/plugin-GUI the plugin should be in /usr/src/open-ephys/PuginName. Please look below if the GUI repository must be located in a different location.
CMake can be used to create build files for any target. To do so, just create a new directory under the Build directory and call cmake like this
cd Build mkdir <PLATFORM> cd <PLATFORM> cmake -G "<GENERATOR>" .. (for Windows and Mac build files, see below for Linux)
<PLATFORM> means your target. It can be any name, but we recommend a descriptive name like "Linux" or "VS2013"
<GENERATOR> tells CMake which kind of build files to create. Examples of valid generators are:
"Visual Studio 12 2013 Win64"
"Visual Studio 14 2015 Win64"
"Visual Studio 15 2017 Win64"
"Xcode"
"Unix Makefiles"
(For 32bit windows just remove Win64 from the generator string)
This way, multiple sets of build files could be created. Note, however, that the generated build files use absolute paths, so they might not be usable outside of the system that generated them.
Linux build files
Since Linux Makefiles are created for a single configuration, it is necessary to specify if the Makefile is to be created for Debug or Release. To do so, cmake must be called like:
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .. or cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
Changing the location of the GUI repository
In case the GUI respository is not located alongside the plugin repository, there are two ways to specify its location
1) Creating an environment variable called GUI_BASE_DIR export GUI_BASE_DIR=path/to/GUI cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug .. or GUI_BASE_DIR=/path/to/GUI cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug .. 2) By using a cmake variable with the -D argument cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DGUI_BASE_DIR=/path/to/GUI ..
Note that setting a variable using the -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 overwriting the existing value or unset by calling cmake -UVARIABLE. This is also true for the MAKE_BUILD_TYPE option.
Deleting all files on the directory will also delete the set values, so any call to cmake from an empty directory must set all required -D parameters.
Building and Installing plugins
Linux
Just like with most Linux sources, just execute
make
to build the plugin. Executing
make install
afterwards will copy the plugin and any required files, if any, to the GUI's appropriate directories.
Windows
To build the plugin on windows, open the generated oe_pluginname.sln Visual Studio solution file. Select the apropriate 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
Similarly with Windows, open the oe_pluginname Xcode project. Building the ALL_BUILD scheme will build the plugin while selecting the INSTALL in the scheme selector and Building it will install the plugin.
The default 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