Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@
'repo': ('https://github.com/%s', None),
'lslrepo': ('https://github.com/labstreaminglayer/App-%s', None),
'lslrelease': ('https://github.com/labstreaminglayer/App-%s/releases', 'Download %s'),
# liblsl's own documentation (a sub-project of this site): :liblsl:`guide/linking.html`
'liblsl': ('https://labstreaminglayer.readthedocs.io/projects/liblsl/%s', None),
}
24 changes: 5 additions & 19 deletions docs/dev/LSL_INSTALL_ROOT.rst
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
:orphan:

.. role:: cmd(code)
:language: bash

``LSL_INSTALL_ROOT``
====================

To import the LSL library in a separate CMake build, you need to set the
the **absolute path** to the `‘installed’ LSL
directory <#install-directory-tree>`__ in the ``LSL_INSTALL_ROOT``
variable (e.g. :cmd:`-DLSL_INSTALL_ROOT=C:/LSL/build/install/`) or add the
**absolute path** to the\ ``LSL/cmake`` subfolder of the `‘installed’
LSL directory <#install-directory-tree>`__ to your ``CMAKE_PREFIX_PATH``
(:cmd:`list(APPEND CMAKE_MODULE_PATH "C:/path/to/LSL/build/install/cmake/")`).

CMake looks for the file
``${LSL_INSTALL_ROOT}/LSL/share/LSL/LSLConfig.cmake``, so make sure your
``LSL_INSTALL_ROOT`` has the files listed in `the previous
section <#installed-directory-tree>`__.
Many LSL apps accept ``-DLSL_INSTALL_ROOT=<path>`` when configuring with CMake. It is a hint for
``find_package(LSL)`` and should point to a liblsl install prefix: the folder that contains
``lib/`` and ``include/``, e.g. an extracted release archive or the result of ``cmake --install``.
Adding the same folder to ``CMAKE_PREFIX_PATH`` works for any CMake project.

By default, apps should look in ``../../LSL/liblsl/build/install`` so if
you have a ``build`` folder in each submodule (``LSL/liblsl/build``,
``Apps/Examples/build`` etc.) and installed ``liblsl`` first, CMake
automatically finds liblsl.
See :liblsl:`Using liblsl in your project <guide/linking.html>` for all the ways to find and link liblsl.
3 changes: 1 addition & 2 deletions docs/dev/app_build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,12 @@ Always be sure to read the specific application build instructions first.
* If using command line

* Start the build process (:cmd:`cmake --build . --config Release --target install`)
* (see also :ref:`cmakeinstalltarget`)

* If using Visual Studio >=2017 built-in CMake utilities
* Use the menu :guilabel:`Build > Install > ApplicationName`

This will create a distribution tree in the folder specified by
:ref:`CMAKE_INSTALL_PREFIX <cmakeinstalltarget>` similar to this:
``CMAKE_INSTALL_PREFIX`` similar to this:

‘installed’ directory tree
~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
22 changes: 8 additions & 14 deletions docs/dev/app_dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,18 @@ Or see below for full applications.
C++ apps
--------

The recommended way to get liblsl is to simply download the latest release from
`the release page <https://github.com/sccn/liblsl/releases>`__.
You may need to click on the black arrow to expand the list of assets.

If you are using CMake, pass the :doc:`LSL_INSTALL_ROOT` argument set to the location where your
liblsl file installed / unpacked to.
And your application should use something like the following line to find liblsl:
With CMake, either let CMake build liblsl as part of your app (``FetchContent``) or use an
installed liblsl (a `release download <https://github.com/sccn/liblsl/releases>`__, a package
manager, or your own build) with ``find_package``:

.. code-block:: cmake

find_package(LSL 1.13.0 REQUIRED
HINTS ${LSL_INSTALL_ROOT}
"${CMAKE_CURRENT_LIST_DIR}/../../LSL/liblsl/build/"
"${CMAKE_CURRENT_LIST_DIR}/../../LSL/liblsl/build/install"
PATH_SUFFIXES share/LSL
)
find_package(LSL REQUIRED) # configure with -DCMAKE_PREFIX_PATH=<liblsl prefix> if needed
target_link_libraries(${PROJECT_NAME} PRIVATE LSL::lsl)

Then you can link your target to liblsl with ``target_link_libraries(${PROJECT_NAME} PRIVATE LSL::lsl)``.
:liblsl:`Using liblsl in your project <guide/linking.html>` covers both ways, shipping liblsl
with your app (DLLs, RPATHs, macOS frameworks) and the ``LSLCMake`` helper functions.
Many existing apps also accept :doc:`LSL_INSTALL_ROOT` as a hint for where liblsl is.

For a more complete example to help you get started with a C++ acquisition app, take a look at the `AppTemplate_cpp_qt <https://github.com/labstreaminglayer/AppTemplate_cpp_qt/>`__, a small example that provides a solid groundwork for at least the following parts:

Expand Down
66 changes: 5 additions & 61 deletions docs/dev/build_android.rst
Original file line number Diff line number Diff line change
@@ -1,64 +1,8 @@
:orphan:

Building for Android
####################

Prerequisites
=============

You'll need: the `Android SDK <https://developer.android.com/studio#command-tools>`__
(in doubt, install the whole `Android Studio <https://developer.android.com/studio#downloads>`__).
With it, install (preferred) the most recent NDK version or a specific NDK version you need.

.. note:: **Unity**: Each Unity version needs liblsl to be compiled with a specific NDK version,
e.g. NDK 16 for Unity 2019.2. For a list, consult the
`Unity docs, section "Change the Android NDK path" <https://docs.unity3d.com/Manual/android-sdksetup.html>`__

Generally, an NDK installed with the Android SDK manager is preferred,
because the SDK and some support files are newer.

Make sure the NDK is installed in a path without spaces.
If it is already installed, use start Powershell as Administrator and create a link:

:samp:`New-Item -ItemType SymbolicLink -Path "C:\\NDK" -Target "C:\\Space Path\\NDK"`

At the time of writing this, :ref:`buildenvcmake` shipped with the Android SDK
is too old, so you need to install a recent version.

Building liblsl
===============

Open a Terminal / Developer Command Prompt and retrieve the needed packages:

.. code:: bash

git clone --depth=1 https://github.com/sccn/labstreaminglayer.git
git submodule update --init LSL/liblsl LSL/liblsl-Java

Next, chdir to the `labstreaminglayer/LSL/liblsl-Java` subdirectory
and configure your environment in the :file:`local.properties`:

.. code:: bash

ndk.dir=C\:\\Users\\user\\AppData\\Local\\Android\\Sdk\\ndk\\16.1.4479499
android.ndkVersion=16.1.4479499
sdk.dir=C\:\\Users\\user\\AppData\\Local\\Android\\Sdk
cmake.dir=C\:\\Program Files\\CMake

.. note:: For older NDK versions without C++11 support, the alternative STL
has to be enabled with the CMake option `"-DANDROID_STL=c++_static"` in
:file:`build.gradle`


Make sure to escape all special characters and double-check the paths.

After that, you can start the build from the command line:

.. code:: bash

gradlew assembleRelease

After some time, this will create :file:`build/outputs/aar/liblsl-Java-Release.aar`.
Open it with 7zip (or rename it to `liblsl.zip`) and extract the `jni/` folder
containing the native libraries.

.. note:: For Android apps, you can add the `.aar` file as dependency, no need to mess
with the `.so` files.
Building liblsl for Android (with the NDK toolchain, or from an Android Studio project's
``CMakeLists.txt``) is described in :liblsl:`Building liblsl <guide/building.html#android>`.
For Java/Kotlin apps see the :doc:`language bindings <../info/language_wrappers>`.
Loading
Loading