Skip to content

Commit 38714c5

Browse files
committed
Publish initial version
1 parent 84ad181 commit 38714c5

12 files changed

+1016
-401
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,11 @@
1313

1414
# IDEs
1515
.idea/
16+
.vscode/
17+
.vs/
18+
19+
# Dependencies
20+
liblsl/
21+
22+
# OS specific
23+
.DS_Store

CMakeLists.txt

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
cmake_minimum_required(VERSION 3.5.0)
2+
3+
set(CMAKE_OSX_ARCHITECTURES "x86_64") # force x86 archictecture on mac as Open Ephys still runs under Rosetta
4+
25
if (NOT DEFINED GUI_BASE_DIR)
36
if (DEFINED ENV{GUI_BASE_DIR})
47
set(GUI_BASE_DIR $ENV{GUI_BASE_DIR})
@@ -27,7 +30,7 @@ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
2730
$<$<CONFIG:Debug>:DEBUG=1>
2831
$<$<CONFIG:Debug>:_DEBUG=1>
2932
$<$<CONFIG:Release>:NDEBUG=1>
30-
)
33+
)
3134

3235

3336
set(SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Source)
@@ -57,9 +60,12 @@ if (NOT CMAKE_LIBRARY_ARCHITECTURE)
5760
endif()
5861
endif()
5962

63+
find_package(LSL REQUIRED
64+
HINTS "${PROJECT_FOLDER}/liblsl")
65+
6066
#Libraries and compiler options
6167
if(MSVC)
62-
target_link_libraries(${PLUGIN_NAME} ${GUI_BIN_DIR}/open-ephys.lib)
68+
target_link_libraries(${PLUGIN_NAME} PRIVATE ${GUI_BIN_DIR}/open-ephys.lib LSL::lsl)
6369
target_compile_options(${PLUGIN_NAME} PRIVATE /sdl- /W0)
6470

6571
install(TARGETS ${PLUGIN_NAME} RUNTIME DESTINATION ${GUI_BIN_DIR}/plugins CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES})
@@ -78,8 +84,13 @@ elseif(APPLE)
7884
set_property(TARGET ${PLUGIN_NAME} APPEND_STRING PROPERTY LINK_FLAGS
7985
"-undefined dynamic_lookup -rpath @loader_path/../../../../shared")
8086

81-
install(TARGETS ${PLUGIN_NAME} DESTINATION $ENV{HOME}/Library/Application\ Support/open-ephys/PlugIns)
87+
install(TARGETS ${PLUGIN_NAME} DESTINATION $ENV{HOME}/Library/Application\ Support/open-ephys/plugins-api8)
8288
set(CMAKE_PREFIX_PATH /opt/local)
89+
90+
target_link_libraries(${PLUGIN_NAME}
91+
PRIVATE
92+
LSL::lsl
93+
)
8394
endif()
8495

8596
#create filters for vs and xcode
@@ -91,17 +102,4 @@ foreach( src_file IN ITEMS ${SRC_FILES})
91102
source_group("${group_name}" FILES "${src_file}")
92103
endforeach()
93104

94-
#additional libraries, if needed
95-
find_package(LSL REQUIRED
96-
HINTS ${LSL_INSTALL_ROOT}
97-
PATH_SUFFIXES share/LSL
98-
)
99-
target_link_libraries(${PLUGIN_NAME} LSL::lsl)
100-
101-
# Copy lsl.dll into the build folder for easier debugging.
102-
if (WIN32)
103-
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
104-
COMMAND ${CMAKE_COMMAND} -E copy_if_different
105-
$<TARGET_FILE:LSL::lsl>
106-
$<TARGET_FILE_DIR:${PLUGIN_NAME}>)
107-
endif()
105+

README.md

Lines changed: 62 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,89 @@
1-
# LabStreamingLayer OpenEphys Data Thread Plugin
1+
# Introduction
22

3-
This repository contains a [LabStreamingLayer](http://labstreaminglayer.readthedocs.io/) **Data Thread** plugin for the [Open Ephys GUI](https://github.com/open-ephys/plugin-GUI).
3+
This is an [Open Ephys GUI](https://github.com/open-ephys/plugin-GUI) data thread plugin for [LSL](https://labstreaminglayer.readthedocs.io/index.html) streams.
4+
Please read the guide regarding compiling plugins from [open-ephys](https://open-ephys.github.io/gui-docs/Developer-Guide/Compiling-plugins.html) and install cmake.
45

5-
## Releases
6+
## How to build
67

7-
TODO: These don't exist yet...
8+
The plugin repo needs to be cloned inside a directory (e.g. MyPlugins) that is at the same level as [plugin-GUI](https://github.com/open-ephys/plugin-GUI/), for example:
89

9-
Check the repository's [releases](https://github.com/labstreaminglayer/OpenEphysLSL-Inlet/releases) page for a downloadable plugin.
10-
11-
## Building
12-
13-
### Prerequisite: liblsl
14-
15-
You will need `liblsl` on your local disk in a location that CMake can find. This is platform-dependent.
16-
17-
#### MacOS
18-
19-
The easiest way is to use homebrew:
20-
21-
`brew install labstreaminglayer/tap/lsl`
10+
```
11+
/Users/foo/plugin-GUI
12+
/Users/foo/plugin-GUI/MyPlugins/lsl-inlet
13+
```
2214

23-
Otherwise, see the [Miscellaneous Platforms](#miscellaneous-platforms) section.
15+
### macOS
2416

25-
#### Windows
17+
A debug version of the plugin will not work with a release version of `Open Ephys GUI` and a release version of the plugin will not work with a debug version of `Open Ephys GUI`. Keep this in mind when deciding how to generate the makefiles.
2618

27-
Download `liblsl-x.xx.x-Win_amd64.zip` (where x.xx.x is the latest version number) from the [liblsl Releases page](https://github.com/sccn/liblsl/releases).
28-
Extract that archive somewhere convenient.
29-
Pass the path to the extracted folder as a CMake argument (`-DLSL_INSTALL_ROOT=path/to/extracted/liblsl`).
19+
Download liblsl:
3020

31-
#### Ubuntu Linux
21+
```
22+
mkdir liblsl
23+
cd liblsl
24+
curl -OL https://github.com/sccn/liblsl/releases/download/v1.16.0/liblsl-1.16.0-OSX_amd64.tar.bz2
25+
tar xvf liblsl-1.16.0-OSX_amd64.tar.bz2
26+
```
3227

33-
Download `liblsl-x.xx.x-yyy_amd64.deb` (where x.xx.x is the latest version number and yyy is the name of your Ubuntu distribution) from the [liblsl Releases page](https://github.com/sccn/liblsl/releases). Use your Ubuntu package manager to install it.
28+
On macOS either "Xcode" or "Unix Makefiles" can be generated and used to successfully build the plugin.
29+
If you prefer to work with VSCode then "Unix Makefiles" should be used.
30+
Generate the Makefile using:
3431

35-
#### Miscellaneous Platforms
32+
```
33+
cd Build
34+
cmake -DCMAKE_OSX_ARCHITECTURES="x86_64" -G "Unix Makefiles" ..
35+
```
3636

37-
See the [liblsl README](https://github.com/sccn/liblsl#building-liblsl) for more options.
37+
For a release build run:
3838

39-
### Prerequisite: OpenEphys Plugin-GUI
39+
```
40+
cd Build
41+
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64" -G "Unix Makefiles" ..
42+
```
4043

41-
You also need the OpenEphys Plugin GUI Source code.
44+
Build a binary:
4245

43-
Download or clone from its repo [here](https://github.com/open-ephys/plugin-GUI).
46+
```
47+
cd Build
48+
make
49+
```
4450

45-
Your folder structure should look like the following
51+
Install the plugin:
4652

4753
```
48-
shared_root/
49-
- plugin-GUI
50-
- OEPlugins/
51-
OpenEphysLSL-Inlet (this repo)
54+
cd Build
55+
make install
5256
```
5357

54-
### Repository structure
58+
This will copy the plugin (`OpenEphysLSL-Inlet.bundle`) to the `$HOME/Application Support/open-ephys/plugins-api8/` folder
59+
and will available the next time `Open Ephys GUI` is launched.
5560

56-
This repository contains 3 top-level directories:
61+
### Windows
5762

58-
- `Build` - Plugin build files will be auto-generated here. These files will be ignored in all `git` commits.
59-
- `Source` - All plugin source files (`.h` and `.cpp`) should live here. There can be as many source code sub-directories as needed.
60-
- `Resources` - This is where you should store any non-source-code files, such as library files or scripts.
63+
The build was tested using Visual Studio 2022 Community Edition.
64+
First, download liblsl from [GitHub](https://github.com/sccn/liblsl/releases/download/v1.16.0/liblsl-1.16.0-Win_amd64.zip) and extract it inside the plugin directory.
65+
The folder structure can be:
6166

62-
### Providing libraries for Windows
67+
```
68+
OpenEphysLSL-Inlet
69+
|
70+
|--liblsl
71+
|
72+
|-- bin
73+
|-- include
74+
|-- lib
75+
```
6376

64-
Since Windows does not have standardized paths for libraries, as Linux and macOS do, it is sometimes useful to pack the appropriate Windows version of the required libraries alongside the plugin.
65-
To do so, a _libs_ directory has to be created **at the top level** of the repository, alongside this README file, and files from all required libraries placed there. The required folder structure is:
77+
Open `Developer Command Prompt for VS 2022` and generate the Makefile using cmake:
6678

6779
```
68-
libs
69-
├─ include #library headers
70-
├─ lib
71-
├─ x64 #64-bit compile-time (.lib) files
72-
└─ x86 #32-bit compile time (.lib) files, if needed
73-
└─ bin
74-
├─ x64 #64-bit runtime (.dll) files
75-
└─ x86 #32-bit runtime (.dll) files, if needed
80+
cd Build
81+
cmake -G "Visual Studio 17 2022" -A x64 ..
7682
```
7783

78-
DLLs in the bin directories will be copied to the open-ephys GUI _shared_ folder when installing.
84+
You can now open the `ALL_BUILD.vcxproj` file from the Build folder with Visual Studio and build a binary.
85+
86+
To install the plugin copy the file `OpenEphysLSL-Inlet.dll` to the `C:\ProgramData\Open Ephys\plugins-api8` folder and copy
87+
the file `lsl.dll` to the `C:\ProgramData\Open Ephys\shared-api8` folder.
88+
89+
The plugin will load the next time `Open Ephys GUI` is launched.

Source/DataThreadPlugin.cpp

Lines changed: 0 additions & 169 deletions
This file was deleted.

0 commit comments

Comments
 (0)