Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to CMake + modern Qt #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
13 changes: 1 addition & 12 deletions .github/workflows/cppcmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,6 @@ jobs:
with:
version: ${{ matrix.config.qt_ver }}
arch: ${{ matrix.config.qt_arch }}

- name: Install boost
uses: MarkusJx/[email protected]
id: install-boost
with:
# REQUIRED: Specify the required boost version
# A list of supported versions can be found here:
# https://github.com/Markus
boost_version: 1.80.0
toolset: msvc

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
Expand All @@ -77,8 +67,6 @@ jobs:
-DCPACK_PACKAGE_DIRECTORY=${PWD}/package \
-DLSL_INSTALL_ROOT=${PWD}/LSL/ \
${{ matrix.config.cmake_extra }}
env:
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}

- name: make
run: cmake --build build --config ${{env.BUILD_TYPE}} -j --target install
Expand All @@ -91,6 +79,7 @@ jobs:

- name: Upload Artifacts
uses: actions/upload-artifact@v3
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
with:
name: pkg-${{ matrix.config.name }}
path: package
Expand Down
8 changes: 2 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.12)

project(SerialPortLSL
project(SerialPort
DESCRIPTION "Read byte stream from COM port and emit as an LSL stream"
HOMEPAGE_URL "https://github.com/labstreaminglayer/App-SerialPort/"
LANGUAGES CXX
Expand Down Expand Up @@ -30,9 +30,6 @@ set(CMAKE_AUTOUIC ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets)

## Boost
find_package(Boost REQUIRED)

## Threads
find_package(Threads REQUIRED)

Expand All @@ -44,15 +41,14 @@ add_executable(${PROJECT_NAME})
target_sources(${PROJECT_NAME} PRIVATE
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.hpp
mainwindow.ui
)

target_link_libraries(${PROJECT_NAME}
PRIVATE
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Widgets
Boost::headers
Threads::Threads
LSL::lsl
)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The program reads a byte stream from a given COM port and emits it as an LSL str

# Usage
* Start the SerialPort app. You should see a window like the following.
![serialport.png](serialport.png)
> ![serialport.png](serialport.png)

* Make sure that your device is plugged in and that you know its COM port (you can usually check this in the Device Manager).

Expand All @@ -14,4 +14,4 @@ The program reads a byte stream from a given COM port and emits it as an LSL str

* Click the "Link" button. If all goes well you should now have a stream on your lab network that has the name that you entered under Stream Name and type "Raw". Note that you cannot close the app while it is linked.

* For subsequent uses you can save the settings in the GUI via File / Save Configuration. If the app is frequently used with different settings you might can also make a shortcut on the desktop that points to the app and appends to the Target field the snippet `-c name_of_config.cfg`.
* For subsequent uses you can save the settings in the GUI via File / Save Configuration. If the app is frequently used with different settings you might can also make a shortcut on the desktop that points to the app and appends to the Target field the snippet `name_of_config.cfg`.
2 changes: 2 additions & 0 deletions SerialPort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<coresettings><comport>1</comport><baudrate>57600</baudrate></coresettings><streamsettings><samplingrate>0</samplingrate><chunksize>32</chunksize><streamname>SerialPort</streamname></streamsettings><miscsettings><databits>4</databits><parity>0</parity><stopbits>0</stopbits></miscsettings><timeoutsettings><readintervaltimeout>500</readintervaltimeout><readtotaltimeoutconstant>50</readtotaltimeoutconstant><readtotaltimeoutmultiplier>10</readtotaltimeoutmultiplier></timeoutsettings>
20 changes: 0 additions & 20 deletions SerialPortLSL.cfg

This file was deleted.

19 changes: 4 additions & 15 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
#include "mainwindow.hpp"
#include <QApplication>
#include "mainwindow.h"
#include <string>


int main(int argc, char *argv[])
{
// determine the startup config file...
std::string config_file = "SerialPortLSL.cfg";
for (int k=1;k<argc;k++)
if (std::string(argv[k]) == "-c" || std::string(argv[k]) == "--config")
config_file = argv[k+1];

int main(int argc, char *argv[]) {
QApplication a(argc, argv);
MainWindow w(0,config_file);
MainWindow w(nullptr, argc > 1 ? argv[1] : nullptr);
w.show();


return a.exec();
}
}
Loading