Skip to content

Commit f87bc09

Browse files
committed
Merge branch 'master' into tstenner/outlet_sync
2 parents ed35fda + e6c8b6c commit f87bc09

File tree

359 files changed

+4977
-34228
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

359 files changed

+4977
-34228
lines changed

.clang-tidy

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Checks: |
1212
-readability-isolate-declaration,
1313
-readability-function-cognitive-complexity,
1414
bugprone-*,
15-
concurrency-*
15+
-bugprone-easily-swappable-parameters,
16+
concurrency-*,
1617
portability-*
1718
...

.editorconfig

+4
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ insert_final_newline = true
66
charset = utf-8
77
indent_style = tab
88

9+
[*.yaml]
10+
indent_style = space
11+
indent_size = 2
12+

.github/workflows/cppcmake.yml

+11-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ name: C/C++ CI
33
on:
44
push:
55
branches: ['*']
6-
tags:
7-
paths_ignore: ['docs/**', '.travis.yml']
6+
tags: ['*']
7+
paths:
8+
- '**'
9+
- '!docs/**'
10+
- '!.github/**'
11+
- '.github/workflows/cppcmake.yml'
812
pull_request:
913
release:
1014
types: ['created']
@@ -30,8 +34,8 @@ jobs:
3034
config:
3135
- {name: "ubuntu-20.04", os: "ubuntu-20.04", cmake_extra: "-DLSL_BUNDLED_PUGIXML=OFF"}
3236
- {name: "ubuntu-18.04", os: "ubuntu-latest", docker: "ubuntu:18.04" }
33-
- {name: "windows-x64", os: "windows-latest", cmake_extra: "-T v140,host=x86"}
34-
- {name: "windows-32", os: "windows-latest", cmake_extra: "-T v140,host=x86 -A Win32"}
37+
- {name: "windows-x64", os: "windows-2019", cmake_extra: "-T v140,host=x86"}
38+
- {name: "windows-32", os: "windows-2019", cmake_extra: "-T v140,host=x86 -A Win32"}
3539
- {name: "macOS-latest", os: "macOS-latest"}
3640

3741
# runs all steps in the container configured in config.docker or as subprocesses when empty
@@ -60,7 +64,8 @@ jobs:
6064
-DCPACK_PACKAGE_DIRECTORY=${PWD}/package \
6165
-Dlslgitrevision=${{ github.sha }} \
6266
-Dlslgitbranch=${{ github.ref }} \
63-
${{ matrix.config.cmake_extra }}
67+
${{ matrix.config.cmake_extra }} \
68+
${{ github.event.inputs.cmakeextra }}
6469
echo ${PWD}
6570
- name: make
6671
run: cmake --build build --target install --config Release -j
@@ -82,6 +87,7 @@ jobs:
8287
dpkg -I package/liblsl*.deb
8388
fi
8489
cmake -E remove_directory package/_CPack_Packages
90+
cp testing/lslcfgs/default.cfg .
8591
- name: upload install dir
8692
uses: actions/upload-artifact@master
8793
with:

.github/workflows/mingw_static.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ name: MinGW Windows static test
33
on:
44
push:
55
branches: ['*']
6-
tags:
7-
paths_ignore: ['docs/**', '.travis.yml']
6+
paths:
7+
- '**'
8+
- '!docs/**'
9+
- '!.github/**'
10+
- '.github/workflows/mingw_static.yml'
811
pull_request:
912

1013
jobs:
1114
build:
1215
name: MinGW batteries-included
13-
runs-on: windows-latest
16+
runs-on: windows-2019
1417

1518
defaults:
1619
run:

.github/workflows/sanitize.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Clang Sanitizer
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
cmakeextra:
7+
description: "Extra CMake options"
8+
required: false
9+
default: ""
10+
sanitizer:
11+
description: 'Sanitizer to run'
12+
required: true
13+
default: 'address'
14+
options: ['address', 'thread', 'memory', 'undefined']
15+
type: choice
16+
17+
defaults:
18+
run:
19+
shell: bash
20+
21+
jobs:
22+
build:
23+
name: "${{ github.event.inputs.sanitizer }}"
24+
runs-on: 'ubuntu-latest'
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Install build toolchain
29+
run: |
30+
wget https://apt.llvm.org/llvm-snapshot.gpg.key
31+
echo "deb [signed-by=$PWD/llvm-snapshot.gpg.key] http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" | sudo tee /etc/apt/sources.list.d/llvm.list
32+
sudo apt update
33+
sudo apt install -y libpugixml-dev clang-13 gdb
34+
- name: Configure CMake
35+
run: |
36+
# linking a C++ library to a C program fails with ubsan enabled; disable lslver for this run
37+
sed -i -e'/lslver/d' CMakeLists.txt
38+
cmake --version
39+
cmake -S . -B build \
40+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
41+
-DCMAKE_C_COMPILER=clang-13 \
42+
-DCMAKE_{CXX_COMPILER,LINKER}=clang++-13 \
43+
-DCMAKE_{C,CXX,EXE_LINKER,SHARED_LINKER}_FLAGS="-fsanitize=${{ github.event.inputs.sanitizer }}" \
44+
-DLSL_COMFY_DEFAULTS=ON \
45+
-DLSL_UNITTESTS=ON \
46+
-DLSL_BENCHMARKS=ON \
47+
-DLSL_BUILD_EXAMPLES=OFF \
48+
-DLSL_BUNDLED_PUGIXML=OFF \
49+
-DLSL_SLIMARCHIVE=ON \
50+
-DLSL_OPTIMIZATIONS=ON \
51+
-Dlslgitrevision=${{ github.sha }} \
52+
-Dlslgitbranch=${{ github.ref }} \
53+
${{ github.event.inputs.cmakeextra }}
54+
echo ${PWD}
55+
56+
- name: make
57+
run: cmake --build build --config RelWithDebInfo -j
58+
59+
- name: run unit tests
60+
run: |
61+
# alias gdbwrap="gdb --batch -ex 'run --order rand --wait-for-keypress never --durations yes' -ex 'thread apply all bt' -return-child-result"
62+
gdb --batch -ex 'run --order rand --wait-for-keypress never --durations yes' -ex 'thread apply all bt' -return-child-result build/testing/lsl_test_internal
63+
gdb --batch -ex 'run --order rand --wait-for-keypress never --durations yes' -ex 'thread apply all bt' -return-child-result build/testing/lsl_test_exported
64+
timeout-minutes: 15

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/build*/
2+
/install/
3+
/package/
24
/CMakeLists.txt.user
35
/CMakeLists.json
46
/CMakeSettings.json

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# Changes for liblsl 1.16
2+
3+
* add: optional, minimal header-only replacement for Boost.Serialization (Tristan Stenner)
4+
* add: extensible `lsl_create_inlet_ex()` for high-precision buffer lengths (Chadwick Boulay)
5+
* change: replace Boost.Uuid, Boost.Random and Boost.Thread with built-in functions (Tristan Stenner)
6+
* change: replace Boost.Asio with upstream Asio (Tristan Stenner)
7+
* change: update bundled Boost to 1.78 (Tristan Stenner)
8+
* change: allow building against system Boost again (@chausner)
9+
* change: speed up resolving a fixed number of streams (Tristan Stenner)
10+
* change: reduce Asio operation overhead (Tristan Stenner)
11+
* change: IPv6 is enabled by default on macOS (Tristan Stenner)
12+
* change: share io contexts for IPv4+IPv6 services (Tristan Stenner)
13+
* **change**: send resolve requests from all local network interfaces (Tristan Stenner)
14+
* fix: fix a minor memory leak when closing streams (Tristan Stenner)
15+
116
# Changes for liblsl 1.15.2
217

318
* fix: bump artifact / soname version

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required (VERSION 3.12)
22
project (liblsl
3-
VERSION 1.15.2
3+
VERSION 1.16.0
44
LANGUAGES C CXX
55
DESCRIPTION "Labstreaminglayer C/C++ library"
66
HOMEPAGE_URL "https://github.com/sccn/liblsl"

README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,15 @@ The most up-to-date instructions are in the
2020
Precompiled packages are uploaded
2121

2222
- to the [Release page](https://github.com/sccn/liblsl/releases)
23-
- the [Anaconda cloud](https://anaconda.org/conda-force/liblsl), install with `conda install -c conda-forge liblsl`
23+
- the [Anaconda cloud](https://anaconda.org/conda-forge/liblsl), install with `conda install -c conda-forge liblsl`
2424

25-
To compile the library yourself from source please follow the [online documentation](https://labstreaminglayer.readthedocs.io/dev/lib_dev.html).
25+
liblsl is also available via the following package managers:
26+
27+
- [vcpkg](https://vcpkg.io)
28+
- [Conan](https://conan.io/center/liblsl)
29+
30+
To compile the library yourself from source,
31+
please follow the [online documentation](https://labstreaminglayer.readthedocs.io/dev/lib_dev.html).
2632

2733
For single board computers running linux, you can also try
2834
`standalone_compilation_linux.sh`.

examples/SendDataInChunks.cpp

+9-8
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ struct fake_device {
2525
*/
2626
std::size_t n_channels;
2727
double srate;
28-
int64_t pattern_samples;
29-
int64_t head;
28+
std::size_t pattern_samples;
29+
std::size_t head;
3030
std::vector<int16_t> pattern;
3131
std::chrono::steady_clock::time_point last_time;
3232

3333
fake_device(const int16_t n_channels, const float srate)
3434
: n_channels(n_channels), srate(srate), head(0) {
35-
pattern_samples = (int64_t)(srate - 0.5) + 1; // truncate OK.
35+
pattern_samples = (std::size_t)(srate - 0.5) + 1; // truncate OK.
3636

3737
// Pre-allocate entire test pattern. The data _could_ be generated on the fly
3838
// for a much smaller memory hit, but we also use this example application
@@ -47,8 +47,9 @@ struct fake_device {
4747
// sin(2*pi*f*t), where f cycles from 1 Hz to Nyquist: srate / 2
4848
double f = (chan_ix + 1) % (int)(srate / 2);
4949
pattern.emplace_back(
50-
offset_0 + chan_ix * offset_step +
51-
magnitude * static_cast<int16_t>(sin(2 * M_PI * f * sample_ix / srate)));
50+
static_cast<int16_t>(
51+
offset_0 + chan_ix * offset_step +
52+
magnitude * sin(2 * M_PI * f * sample_ix / srate)));
5253
}
5354
}
5455
last_time = std::chrono::steady_clock::now();
@@ -70,8 +71,8 @@ struct fake_device {
7071
auto now = std::chrono::steady_clock::now();
7172
auto elapsed_nano =
7273
std::chrono::duration_cast<std::chrono::nanoseconds>(now - last_time).count();
73-
int64_t elapsed_samples = std::size_t(elapsed_nano * srate * 1e-9); // truncate OK.
74-
elapsed_samples = std::min(elapsed_samples, (int64_t)(buffer.size() / n_channels));
74+
std::size_t elapsed_samples = std::size_t(elapsed_nano * srate * 1e-9); // truncate OK.
75+
elapsed_samples = std::min(elapsed_samples, (std::size_t)(buffer.size() / n_channels));
7576
if (nodata) {
7677
// The fastest but no patterns.
7778
// memset(&buffer[0], 23, buffer.size() * sizeof buffer[0]);
@@ -126,7 +127,7 @@ int main(int argc, char **argv) {
126127
chn.append_child_value("unit", "microvolts");
127128
chn.append_child_value("type", type);
128129
}
129-
int32_t buf_samples = max_buffered * samplingrate;
130+
int32_t buf_samples = (int32_t)(max_buffered * samplingrate);
130131
auto flags = static_cast<lsl_transport_options_t>(
131132
(do_sync ? transp_sync_blocking : transp_default) | transp_bufsize_samples);
132133
lsl::stream_outlet outlet(info, chunk_samples, buf_samples, flags);

examples/SendDataMinimal.cpp

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <chrono>
2+
#include <thread>
3+
#include <lsl_cpp.h>
4+
5+
/**
6+
* This is a minimal example of how a multi-channel data stream can be sent to LSL.
7+
* Here, the stream is named SimpleStream, has content-type EEG, 8 channels, and 200 Hz.
8+
* The transmitted samples contain random numbers.
9+
*/
10+
11+
const int nchannels = 8;
12+
13+
int main(int argc, char *argv[]) {
14+
// make a new stream_info and open an outlet with it
15+
lsl::stream_info info("SimpleStream", "EEG", nchannels, 200.0);
16+
lsl::stream_outlet outlet(info);
17+
18+
// send data forever
19+
float sample[nchannels];
20+
while (true) {
21+
// generate random data
22+
for (int c = 0; c < nchannels; c++) sample[c] = (float)((rand() % 1500) / 500.0 - 1.5);
23+
// send it
24+
outlet.push_sample(sample);
25+
// maintain our desired sampling rate (approximately; real software might do something else)
26+
std::this_thread::sleep_for(std::chrono::milliseconds(5));
27+
}
28+
29+
return 0;
30+
}

examples/SendDataSimple.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ int main(int argc, char *argv[]) {
2222
float sample[nchannels];
2323
while (outlet.have_consumers()) {
2424
// generate random data
25-
for (int c = 0; c < nchannels; c++) sample[c] = (rand() % 1500) / 500.0 - 1.5;
25+
for (int c = 0; c < nchannels; c++) sample[c] = (float)((rand() % 1500) / 500.0 - 1.5);
2626
// send it
2727
outlet.push_sample(sample);
2828
std::this_thread::sleep_for(std::chrono::milliseconds(5));

examples/SendStringMarkersC.c

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ void sleep_(int ms) { usleep(ms * 1000); }
1818
int main(int argc, char *argv[]) {
1919
lsl_streaminfo info; /* out stream declaration object */
2020
lsl_outlet outlet; /* stream outlet */
21-
double endtime; /* used for send timing */
2221
const char *mrk; /* marker to send next */
2322

2423
/* declare a new streaminfo (name: "MyEventStream", content type: "Markers", 1 channel,

lslboost/additional_headers.h

-3
This file was deleted.

lslboost/boost-thread-windows.patch

-24
This file was deleted.

lslboost/boost/archive/detail/check.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
// MS compatible compilers support #pragma once
55
#if defined(_MSC_VER)
66
# pragma once
7+
#if !defined(__clang__)
78
#pragma inline_depth(255)
89
#pragma inline_recursion(on)
910
#endif
11+
#endif
1012

1113
#if defined(__MWERKS__)
1214
#pragma inline_depth(255)

lslboost/boost/archive/detail/iserializer.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
// MS compatible compilers support #pragma once
55
#if defined(BOOST_MSVC)
66
# pragma once
7+
#if !defined(__clang__)
78
#pragma inline_depth(255)
89
#pragma inline_recursion(on)
910
#endif
11+
#endif
1012

1113
#if defined(__MWERKS__)
1214
#pragma inline_depth(255)

lslboost/boost/archive/detail/oserializer.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
// MS compatible compilers support #pragma once
55
#if defined(_MSC_VER)
66
# pragma once
7+
#if !defined(__clang__)
78
#pragma inline_depth(255)
89
#pragma inline_recursion(on)
910
#endif
11+
#endif
1012

1113
#if defined(__MWERKS__)
1214
#pragma inline_depth(255)

lslboost/boost/archive/impl/basic_text_iprimitive.ipp

+2-1
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ basic_text_iprimitive<IStream>::basic_text_iprimitive(
112112
) :
113113
is(is_),
114114
flags_saver(is_),
115-
precision_saver(is_),
116115
#ifndef BOOST_NO_STD_LOCALE
116+
precision_saver(is_),
117117
codecvt_null_facet(1),
118118
archive_locale(is.getloc(), & codecvt_null_facet),
119119
locale_saver(is)
@@ -125,6 +125,7 @@ basic_text_iprimitive<IStream>::basic_text_iprimitive(
125125
is_ >> std::noboolalpha;
126126
}
127127
#else
128+
precision_saver(is_)
128129
{}
129130
#endif
130131

lslboost/boost/archive/impl/basic_text_oprimitive.ipp

+2-1
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ basic_text_oprimitive<OStream>::basic_text_oprimitive(
8787
) :
8888
os(os_),
8989
flags_saver(os_),
90-
precision_saver(os_),
9190
#ifndef BOOST_NO_STD_LOCALE
91+
precision_saver(os_),
9292
codecvt_null_facet(1),
9393
archive_locale(os.getloc(), & codecvt_null_facet),
9494
locale_saver(os)
@@ -100,6 +100,7 @@ basic_text_oprimitive<OStream>::basic_text_oprimitive(
100100
os_ << std::noboolalpha;
101101
}
102102
#else
103+
precision_saver(os_)
103104
{}
104105
#endif
105106

0 commit comments

Comments
 (0)