Building LabStreamingLayer Full Tree

This guide is intended only for advanced developers who intend to work
on multiple projects and/or the core library simultaneously.

Project Structure

This main labstreaminglayer repository contains only the general project structure and references (“git submodules”) to the liblsl C/C++ library (LSL/liblsl), various language bindings (e.g. LSL/liblsl-Python), the Apps to stream data from several types of devices including a template examples, and the LabRecorder.:

├── Apps
│   ├── AMTI ForcePlate
│   ├── LabRecorder
│   ├── [several other apps]
│   └── Wiimote
└── LSL
  ├── liblsl
  │   ├── include
  │   ├── lslboost
  │   ├── project
  │   ├── src
  │   └── testing
  ├── liblsl-Matlab
  ├── liblsl-Python
  └── liblsl-Java

To get the project source code using Git, see Working With The LabStreamingLayer Repository.

Dependencies (optional)

The core liblsl does not have any external dependencies.

Different language bindings or apps have their own dependencies so please consult those projects’ build instructions.

Many apps depend on Qt5, Boost, and many use CMake build system. Follow the instructions to set up your LSL build environment.

Build instructions

‘installed’ directory tree

├── AppX
│   ├── AppX.exe
│   ├── liblsl64.dll
│   ├── Qt5Xml.dll
│   ├── Qt5Gui.dll
│   └── AppX_configuration.ini
├── AppY
│   ├── AppY.exe
│   ├── AppY_conf.exe
│   ├── liblsl64.dll
│   └── example.png
├── examples
│   ├── CppReceive.exe
│   ├── CppSendRand.exe
│   ├── SendDataC.exe
│   ├── liblsl64.dll
└── LSL
  ├── share
  │   ├── LSL
  │   │   ├── LSLCMake.cmake
  │   │   ├── LSLConfig.cmake
  │   │   └── LSLCMake.cmake
  ├── include
  │   ├── lsl_c.h
  │   └── lsl_cpp.h
  └── lib
    ├── liblsl64.dll
    ├── liblsl64.lib
    └── lslboost.lib

On Unix systems (Linux+OS X) the executable’s library path is changed to include ../LSL/lib/ and the executable folder (./) so common libraries (Qt, Boost) can be distributed in a single library directory or put in the same folder. On Windows, the library is copied to (and searched in) the executable folder.

The resulting folder LSL contains three subfolders:

  • cmake contains the exported build configuration (LSLConfig.cmake) that can be used to import the library in out of tree builds.
  • include contains the include headers for C (lsl_c.h) and C++ (lsl_cpp.h) programs.
  • lib contains the library files. To run a program, you need the liblslXY.dll (Windows) or .so (Linux) or .dylib (MacOS).

Common CMake Options

(See Command Line Options).

  • App dependencies (required by some apps). See LSL build environment for more info.
    • -DQt5_DIR=<path/to/qt/binaries>/lib/cmake/Qt5
    • -DBOOST_ROOT=<path/to/boost>
      • liblsl comes with its own boost used by itself, but it is not uncommon for apps to require ‘normal’ boost.
  • Install root (see LSL_INSTALL_ROOT)
    • Not necessary for in-tree builds.

Here are some example cmake commands:

  • Chad’s Windows build: cmake .. -G "Visual Studio 14 2015 Win64" -DQt5_DIR=C:\Qt\5.11.1\msvc2015_64\lib\cmake\Qt5 -DBOOST_ROOT=C:\local\boost_1_67_0 -DLSLAPPS_LabRecorder=ON -DLSLAPPS_XDFBrowser=ON -DLSLAPPS_OpenVR=ON
  • Chad’s Mac build: cmake .. -DQt5_DIR=$(brew --prefix qt)/lib/cmake/Qt5/ -DLSLAPPS_LabRecorder=ON -DLSLAPPS_Benchmarks=ON -DLSLAPPS_XDFBrowser=ON

Configure CMake options in VS 2017 / VS 2019

If you are using Visual Studio 2017’s built-in CMake Tools then the default options would have been used to configure the project. To set any variables you have to edit a file. Use the CMake menu > Change CMake Settings > LabStreamingLayer. This will open a json file. For each configuration of interest, add a ‘variables’ entry with a list of key/value pairs. For example, under "name": "x64-Release", and immediately after "ctestCommandArgs": "" add the following:

      "variables": [
          "name": "Qt5_DIR",
          "value": "C:\\Qt\\5.11.1\\msvc2015_64\\lib\\cmake\\Qt5 "
          "name": "BOOST_ROOT",
          "value": "C:\\local\\boost_1_67_0"
          "name": "LSLAPPS_LabRecorder",
          "value": "ON"
          "name": "LSLAPPS_Benchmarks",
          "value": "ON"
          "name": "LSLAPPS_XDFBrowser",
          "value": "ON"