Skip to content

Commit a498a44

Browse files
authored
Merge pull request #51 from labstreaminglayer/qt6
Qt6
2 parents 5055f4d + f606754 commit a498a44

5 files changed

Lines changed: 152 additions & 66 deletions

File tree

.github/workflows/cppcmake.yml

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ on:
1111
types: ['created']
1212

1313
env:
14-
LSL_RELEASE_URL: 'https://github.com/sccn/liblsl/releases/download/v1.14.0'
15-
LSL_RELEASE: '1.14.0'
14+
LSL_RELEASE_URL: 'https://github.com/sccn/liblsl/releases/download/v1.14.1b9'
15+
LSL_RELEASE: '1.14.1'
1616

1717
defaults:
1818
run:
1919
shell: bash
2020

21-
21+
# Check qt_ver on # https://download.qt.io/online/qtsdkrepository/
2222
jobs:
2323
build:
2424
name: ${{ matrix.config.name }}
@@ -27,31 +27,32 @@ jobs:
2727
fail-fast: false
2828
matrix:
2929
config:
30-
- {name: "ubuntu-20.04", os: "ubuntu-20.04"}
31-
- {name: "ubuntu-18.04", os: "ubuntu-18.04"}
32-
- {name: "ubuntu-16.04", os: "ubuntu-16.04"}
30+
- name: "ubuntu-20.04"
31+
os: "ubuntu-20.04"
32+
- name: "ubuntu-18.04"
33+
os: "ubuntu-18.04"
3334
- name: "windows-x64"
3435
os: "windows-latest"
3536
cmake_extra: "-T v142,host=x86"
3637
arch: "amd64"
37-
qt: "win64_msvc2019_64"
38+
qt_arch: "win64_msvc2019_64"
39+
qt_ver: "6.1.0"
3840
- name: "windows-x86"
3941
os: "windows-latest"
4042
cmake_extra: "-T v142,host=x86 -A Win32"
4143
arch: "i386"
42-
qt: "win32_msvc2019"
43-
- {name: "macOS-latest", os: "macOS-latest"}
44+
qt_arch: "win32_msvc2019"
45+
qt_ver: "5.15.2"
46+
- name: "macOS-10"
47+
os: "macos-10.15"
48+
qt_ver: "6.1.0"
4449
steps:
4550
- uses: actions/checkout@v2
4651

47-
- name: Install Qt
48-
uses: jurplel/install-qt-action@v2.11.0
49-
with:
50-
arch: ${{ matrix.config.qt }}
51-
5252
- name: Install liblsl (Ubuntu)
5353
if: startsWith(matrix.config.os, 'ubuntu-')
5454
run: |
55+
sudo apt install -y libpugixml-dev
5556
curl -L ${LSL_RELEASE_URL}/liblsl-${LSL_RELEASE}-$(lsb_release -sc)_amd64.deb -o liblsl.deb
5657
sudo dpkg -i liblsl.deb
5758
@@ -62,11 +63,19 @@ jobs:
6263
7z x liblsl.zip -oLSL
6364
6465
- name: Download liblsl (macOS)
65-
if: matrix.config.os == 'macOS-latest'
66-
run: |
67-
curl -L ${LSL_RELEASE_URL}/liblsl-${LSL_RELEASE}-OSX_amd64.tar.bz2 -o liblsl.tar.bz2
68-
mkdir LSL
69-
tar -xvf liblsl.tar.bz2 -C LSL
66+
if: startsWith(matrix.config.os, 'macos-')
67+
run: brew install labstreaminglayer/tap/lsl
68+
69+
- name: Install Qt .deb packages
70+
if: startsWith(matrix.config.os, 'ubuntu-')
71+
run: sudo apt install -y qtbase5-dev
72+
73+
- name: Install Qt (Win and Mac)
74+
if: startsWith(matrix.config.os, 'windows') || startsWith(matrix.config.os, 'macos')
75+
uses: jurplel/install-qt-action@v2.12.2
76+
with:
77+
version: ${{ matrix.config.qt_ver }}
78+
arch: ${{ matrix.config.qt_arch }}
7079

7180
- name: Configure CMake
7281
run: |
@@ -85,10 +94,10 @@ jobs:
8594

8695
- name: package
8796
run: |
88-
export LD_LIBRARY_PATH=$Qt5_Dir/lib:$LD_LIBRARY_PATH
97+
export LD_LIBRARY_PATH=$Qt5_DIR/lib:$Qt6_DIR/lib:$LD_LIBRARY_PATH
8998
cmake --build build --config Release -j --target package
9099
cmake -E remove_directory package/_CPack_Packages
91-
100+
92101
- name: Upload Artifacts
93102
uses: actions/upload-artifact@v2
94103
with:

CMakeLists.txt

Lines changed: 66 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,63 @@
1-
cmake_minimum_required(VERSION 3.5)
2-
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "Minimum MacOS deployment version")
1+
cmake_minimum_required(VERSION 3.12)
2+
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum MacOS deployment version")
33

44
project(LabRecorder
55
DESCRIPTION "Record and write LabStreamingLayer streams to an XDF file"
66
HOMEPAGE_URL "https://github.com/labstreaminglayer/App-LabRecorder/"
77
LANGUAGES C CXX
8-
VERSION 1.14.0)
8+
VERSION 1.14.1)
99

1010
# Needed for customized MacOSXBundleInfo.plist.in
1111
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake" ${CMAKE_MODULE_PATH})
1212

13-
find_package(LSL REQUIRED
14-
HINTS ${LSL_INSTALL_ROOT}
15-
"${CMAKE_CURRENT_LIST_DIR}/../../LSL/liblsl/build/"
16-
"${CMAKE_CURRENT_LIST_DIR}/../../LSL/liblsl/build/install"
17-
"${CMAKE_CURRENT_LIST_DIR}/../../LSL/liblsl/out/build/x64-Release"
18-
"${CMAKE_CURRENT_LIST_DIR}/../../LSL/liblsl/out/install/x64-Release"
19-
PATH_SUFFIXES share/LSL
20-
)
21-
22-
set(CMAKE_CXX_STANDARD 14)
13+
set(CMAKE_CXX_STANDARD 17)
2314
set(CMAKE_CXX_STANDARD_REQUIRED On)
2415

25-
set(CMAKE_INCLUDE_CURRENT_DIR ON)
26-
set(CMAKE_AUTOMOC ON)
27-
set(CMAKE_AUTOUIC ON)
16+
# Dependencies
17+
18+
## LSL
19+
if(ANDROID)
20+
set(LIBLSL_SOURCE_PATH "../../LSL/liblsl" CACHE STRING "Path to liblsl sources")
21+
22+
# force include liblsl as target to build with the android toolchain
23+
# as path of the normal build process
24+
add_subdirectory(${LIBLSL_SOURCE_PATH} liblsl_bin)
25+
add_library(LSL::lsl ALIAS lsl)
26+
else()
27+
find_package(LSL REQUIRED
28+
HINTS ${LSL_INSTALL_ROOT}
29+
"${CMAKE_CURRENT_LIST_DIR}/../../LSL/liblsl/build/"
30+
"${CMAKE_CURRENT_LIST_DIR}/../../LSL/liblsl/build/install"
31+
"${CMAKE_CURRENT_LIST_DIR}/../../LSL/liblsl/out/build/x64-Release"
32+
"${CMAKE_CURRENT_LIST_DIR}/../../LSL/liblsl/out/install/x64-Release"
33+
PATH_SUFFIXES share/LSL
34+
)
35+
endif()
36+
37+
## Qt
38+
set(CMAKE_AUTOMOC ON) # The later version of this in LSLCMake is somehow not enough.
2839
set(CMAKE_AUTORCC ON)
29-
find_package(Qt5 REQUIRED COMPONENTS Widgets Network)
40+
set(CMAKE_AUTOUIC ON)
41+
find_package(Qt6 COMPONENTS Core Widgets Network DBus)
42+
if(NOT Qt6_FOUND)
43+
# If we require 5.15 then we can use version-agnostic linking, but 5.15 not easily available on Ubuntu.
44+
find_package(Qt5 COMPONENTS Core Widgets Network DBus REQUIRED)
45+
add_executable(${PROJECT_NAME} MACOSX_BUNDLE)
46+
set(LSLAPP_QT_VER Qt5)
47+
else()
48+
qt_add_executable(${PROJECT_NAME} MACOSX_BUNDLE MANUAL_FINALIZATION)
49+
set(LSLAPP_QT_VER Qt)
50+
endif()
3051

52+
## Threads
3153
find_package(Threads REQUIRED)
3254

55+
# Targets
56+
57+
## xdfwriter - stand alone library
3358
add_subdirectory(xdfwriter)
3459

35-
add_executable(${PROJECT_NAME} MACOSX_BUNDLE #WIN32
60+
target_sources(${PROJECT_NAME} PRIVATE
3661
src/main.cpp
3762
src/mainwindow.cpp
3863
src/mainwindow.h
@@ -52,8 +77,9 @@ add_executable(LabRecorderCLI MACOSX_BUNDLE
5277
target_link_libraries(${PROJECT_NAME}
5378
PRIVATE
5479
xdfwriter
55-
Qt5::Widgets
56-
Qt5::Network
80+
${LSLAPP_QT_VER}::Widgets
81+
${LSLAPP_QT_VER}::Network
82+
${LSLAPP_QT_VER}::DBus
5783
Threads::Threads
5884
LSL::lsl
5985
)
@@ -76,25 +102,34 @@ installLSLAuxFiles(${PROJECT_NAME}
76102
)
77103

78104
if (WIN32)
79-
get_target_property(QT5_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
80-
get_filename_component(QT5_WINDEPLOYQT_EXECUTABLE ${QT5_QMAKE_EXECUTABLE} PATH)
81-
set(QT5_WINDEPLOYQT_EXECUTABLE "${QT5_WINDEPLOYQT_EXECUTABLE}/windeployqt.exe")
105+
get_target_property(QT_QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION)
106+
get_filename_component(QT_WINDEPLOYQT_EXECUTABLE ${QT_QMAKE_EXECUTABLE} PATH)
107+
set(QT_WINDEPLOYQT_EXECUTABLE "${QT_WINDEPLOYQT_EXECUTABLE}/windeployqt.exe")
82108

83109
add_custom_command(
84110
TARGET ${PROJECT_NAME} POST_BUILD
85-
COMMAND ${QT5_WINDEPLOYQT_EXECUTABLE} --qmldir
86-
${CMAKE_CURRENT_SOURCE_DIR} $<TARGET_FILE_DIR:${PROJECT_NAME}>)
111+
COMMAND ${QT_WINDEPLOYQT_EXECUTABLE}
112+
--no-translations --no-system-d3d-compiler
113+
--qmldir ${CMAKE_CURRENT_SOURCE_DIR}
114+
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
87115
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
88-
COMMAND ${CMAKE_COMMAND} -E copy_if_different
89-
$<TARGET_FILE:LSL::lsl>
90-
$<TARGET_FILE:xdfwriter>
91-
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
116+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
117+
$<TARGET_FILE:LSL::lsl>
118+
$<TARGET_FILE:xdfwriter>
119+
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
92120
add_custom_command(
93121
TARGET ${PROJECT_NAME} POST_BUILD
94122
COMMAND ${CMAKE_COMMAND} -E copy
95-
${CMAKE_CURRENT_SOURCE_DIR}//${PROJECT_NAME}.cfg
96-
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
123+
${CMAKE_CURRENT_SOURCE_DIR}//${PROJECT_NAME}.cfg
124+
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
125+
endif()
126+
127+
if(Qt6_FOUND)
128+
set_target_properties(${PROJECT_NAME} PROPERTIES
129+
QT_ANDROID_EXTRA_LIBS "${CMAKE_CURRENT_BINARY_DIR}/liblsl_bin/liblsl.so")
130+
qt_finalize_executable(${PROJECT_NAME})
97131
endif()
98132

99133
set(CPACK_DEBIAN_LABRECORDER_PACKAGE_SECTION "science" CACHE INTERNAL "")
100134
LSLGenerateCPackConfig()
135+

README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,41 @@
55

66
The LabRecorder is the default recording program that comes with LSL. It allows to record all streams on the lab network (or a subset) into a single file, with time synchronization between streams.
77

8-
[Download it from the Releases page](https://github.com/labstreaminglayer/App-LabRecorder/releases).
9-
108
# File Format
119

1210
The file format used by the LabRecorder is XDF. This is an open general-purpose format that was designed concurrently with LSL and supports all features of LSL streams. The project page is [here](https://github.com/sccn/xdf). There are importers for MATLAB, EEGLAB, BCILAB, Python, and MoBILAB.
1311

1412
# Getting LabRecorder
1513

14+
## Dependencies
15+
16+
For LabRecorder to work on your system, you might need to first install some dependencies.
17+
18+
### MacOS
19+
20+
In the near future it will be necessary to use [homebrew](https://brew.sh/) to manage LSL Apps and their dependencies:
21+
* Install homebrew: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
22+
* Install liblsl: `brew install labstreaminglayer/tap/lsl`
23+
* Install Qt6: `brew install qt`
24+
25+
### Linux Ubuntu
26+
27+
The Ubuntu releases do not typically ship with their dependencies so you will also have to download and install those:
28+
* Download and install the latest [liblsl-{version}-bionic_amd64.deb from its release page](https://github.com/sccn/liblsl/releases)
29+
* We hope to make this available via a package manager soon.
30+
* You can install liblsl directly by double clicking on it, or with with `sudo dpkg -i {filename}.deb`
31+
* See the bottom of the [lsl build env docs](https://labstreaminglayer.readthedocs.io/dev/build_env.html).
32+
* For most cases, this will amount to `sudo apt-get install qtbase5-dev`
33+
34+
## Downloading LabRecorder
35+
36+
### MacOS
37+
38+
* `brew install labrecorder`
39+
40+
### Others
41+
1642
Navigate to the [`releases` page](https://github.com/labstreaminglayer/App-LabRecorder/releases) and download the latest release for your platform.
17-
The Ubuntu releases do not typically ship with the libsl dependencies so you will also have to download and install [liblsl from its release page](https://github.com/sccn/liblsl/releases).
1843

1944
# Usage
2045

src/mainwindow.cpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
#include <QMessageBox>
88
#include <QSettings>
99
#include <QStandardPaths>
10+
#if QT_VERSION_MAJOR < 6
11+
#include <QRegExp>
12+
#else
13+
#include <QRegularExpression>
14+
using QRegExp = QRegularExpression;
15+
#endif
1016

1117
#include <string>
1218
#include <vector>
@@ -90,14 +96,14 @@ MainWindow::MainWindow(QWidget *parent, const char *config_file)
9096

9197
void MainWindow::statusUpdate() const {
9298
if (currentRecording) {
93-
auto elapsed = static_cast<unsigned int>(lsl::local_clock() - startTime);
99+
auto elapsed = static_cast<int>(lsl::local_clock() - startTime);
94100
QString recFilename = replaceFilename(QDir::cleanPath(ui->lineEdit_template->text()));
95101
auto fileinfo = QFileInfo(QDir::cleanPath(ui->rootEdit->text()) + '/' + recFilename);
96102
fileinfo.refresh();
97103
auto size = fileinfo.size();
98104
QString timeString = QStringLiteral("Recording to %1 (%2; %3kb)")
99105
.arg(QDir::toNativeSeparators(recFilename),
100-
QDateTime::fromTime_t(elapsed).toUTC().toString("hh:mm:ss"),
106+
QTime(0,0).addSecs(elapsed).toString("hh:mm:ss"),
101107
QString::number(size / 1000));
102108
statusBar()->showMessage(timeString);
103109
}
@@ -126,14 +132,25 @@ void MainWindow::load_config(QString filename) {
126132
// ----------------------------
127133
// required streams
128134
// ----------------------------
129-
missingStreams = pt.value("RequiredStreams").toStringList().toSet();
135+
auto required = pt.value("RequiredStreams").toStringList();
136+
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
137+
missingStreams = QSet<QString>(required.begin(), required.end());
138+
#else
139+
missingStreams = required.toSet();
140+
#endif
130141

131142
// ----------------------------
132143
// online sync streams
133144
// ----------------------------
134145
QStringList onlineSyncStreams = pt.value("OnlineSync", QStringList()).toStringList();
135146
for (QString &oss : onlineSyncStreams) {
136-
QStringList words = oss.split(' ', QString::SkipEmptyParts); // Deprecated --> Qt::SkipEmptyParts as of Qt 5.14, but not easily available to Ubuntu 18.04
147+
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
148+
auto skipEmpty = Qt::SkipEmptyParts;
149+
#else
150+
auto skipEmpty = QString::SkipEmptyParts;
151+
#endif
152+
153+
QStringList words = oss.split(' ', skipEmpty);
137154
// The first two words ("StreamName (PC)") are the stream identifier
138155
if (words.length() < 2) {
139156
qInfo() << "Invalid sync stream config: " << oss;

xdfwriter/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ project(xdfwriter
44
DESCRIPTION "C++ library for writing XDF files"
55
HOMEPAGE_URL "https://github.com/labstreaminglayer/App-LabRecorder/"
66
LANGUAGES C CXX
7-
VERSION 1.14.0)
7+
VERSION 1.14.1)
88

99
option(LABRECORDER_XDFZ "use Boost.Iostreams for XDFZ support" Off)
1010
option(LABRECORDER_BOOST_TYPE_CONVERSIONS "Use boost for type conversions" Off)
@@ -16,7 +16,7 @@ add_library(${PROJECT_NAME} xdfwriter.cpp)
1616

1717
add_executable(testxdfwriter test_xdf_writer.cpp)
1818

19-
target_link_libraries(testxdfwriter PRIVATE xdfwriter)
19+
target_link_libraries(testxdfwriter PRIVATE ${PROJECT_NAME})
2020
target_include_directories(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
2121

2222
# Test for floating point format and endianness
@@ -42,22 +42,22 @@ endif()
4242
if(LABRECORDER_BOOST_TYPE_CONVERSIONS)
4343
message(STATUS "Searching Boost for type conversions")
4444
find_package(Boost REQUIRED)
45-
target_link_libraries(xdfwriter PRIVATE Boost::boost)
46-
target_compile_definitions(xdfwriter PUBLIC EXOTIC_ARCH_SUPPORT)
45+
target_link_libraries(${PROJECT_NAME} PRIVATE Boost::boost)
46+
target_compile_definitions(${PROJECT_NAME} PUBLIC EXOTIC_ARCH_SUPPORT)
4747
endif()
4848

4949
# Enable xdfz support if Boost::iostreams and Boost.zlib (Windows) or plain zlib (Unix) was found
5050
if(LABRECORDER_XDFZ)
5151
find_package(Boost REQUIRED COMPONENTS iostreams)
5252
if(WIN32)
5353
find_package(Boost REQUIRED COMPONENTS zlib)
54-
target_link_libraries(xdfwriter PRIVATE Boost::iostreams Boost::zlib)
54+
target_link_libraries(${PROJECT_NAME} PRIVATE Boost::iostreams Boost::zlib)
5555
else()
5656
find_package(ZLIB REQUIRED)
57-
target_link_libraries(xdfwriter PRIVATE Boost::iostreams ${ZLIB_LIBRARIES})
57+
target_link_libraries(${PROJECT_NAME} PRIVATE Boost::iostreams ${ZLIB_LIBRARIES})
5858
endif()
5959
message(STATUS "Found zlib, enabling support for xdfz files")
60-
target_compile_definitions(xdfwriter PUBLIC XDFZ_SUPPORT=1)
60+
target_compile_definitions(${PROJECT_NAME} PUBLIC XDFZ_SUPPORT=1)
6161
endif()
6262

6363

0 commit comments

Comments
 (0)