diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..bb845d5 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,46 @@ +name: Build eismuliplexer for linux +run-name: Building eismuliplexer for linux +on: [push] + +jobs: + Build: + runs-on: ubuntu-22.04 + steps: + - name: Install dependancies + run: apt update; apt install -y libusb-1.0-0-dev cmake qt6-base-dev qt6-base-dev-tools qt6-tools-dev-tools libqt6widgets6 wget + - name: Check out repository code + uses: ischanx/checkout@8c80eac3058d03dc5301629e8f7d59ae255d6cc3 + - name: Checkout libeismultiplexer + run: git clone http://192.168.178.27/git/Eismultiplexer/libeismultiplexer.git + - name: Install Appimagetool + run: | + wget https://github.com/probonopd/go-appimage/releases/download/continuous/appimagetool-904-x86_64.AppImage + chmod +x appimagetool-904-x86_64.AppImage + mv appimagetool-904-x86_64.AppImage /usr/bin/appimagetool + - name: Version + id: libeismultiplexer version + run: | + cd ${{ gitea.workspace }}/libeismultiplexer + git fetch -a; + echo "tag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT + - name: Build and install libeismultiplexer + run: | + mkdir ${{ gitea.workspace }}/libeismultiplexer/build; cd ${{ gitea.workspace }}/libeismultiplexer/build + cmake -DCMAKE_BUILD_TYPE=Release -DGIT_TAG=${{ steps.version.outputs.tag }} .. + make + make install + - name: Build + run: | + mkdir ${{ gitea.workspace }}/build; cd ${{ gitea.workspace }}/build + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install/usr .. + make + make install + - name: Create Appimage + run: | + cd ${{ gitea.workspace }}/build/ + appimagetool deploy install/usr/share/applications/eismultiplexerqt.desktop + appimagetool install + uses: actions/upload-artifact@v3 + with: + name: eismultiplexer-qt-appimage + path: ${{ gitea.workspace }}/build/*.appimage diff --git a/CMakeLists.txt b/CMakeLists.txt index e86a2c3..e3f9565 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,28 +1,25 @@ cmake_minimum_required(VERSION 3.14) -project(eismuliplexer-qt) +project(eismultiplexer-qt) -set(CMAKE_PROJECT_VERSION_MAJOR 0) -set(CMAKE_PROJECT_VERSION_MINOR 9) -set(CMAKE_PROJECT_VERSION_PATCH 0) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") +include(GitVersion) +get_version_from_git() +message("Building version ${PROJECT_VERSION}") add_compile_definitions(VERSION_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR}) add_compile_definitions(VERSION_MINOR=${CMAKE_PROJECT_VERSION_MINOR}) add_compile_definitions(VERSION_PATCH=${CMAKE_PROJECT_VERSION_PATCH}) -if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") - message(FATAL_ERROR "Windows builds have to be cross compiled on UNIX") -endif() - message("Platform " ${CMAKE_SYSTEM_NAME}) -if(WIN32) +if(WIN32 AND NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/release-win.sh ${CMAKE_CURRENT_BINARY_DIR}/release.sh @ONLY) add_custom_target(package COMMAND ${CMAKE_CURRENT_BINARY_DIR}/release.sh WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Createing release archive" VERBATIM) -endif(WIN32) +endif(WIN32 AND NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -45,6 +42,9 @@ add_executable(${PROJECT_NAME} multiplexer.h multiplexer.cpp ) +set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE ON) target_compile_options(${PROJECT_NAME} PUBLIC "-Wall") target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Widgets Qt6::Core ${EISMULIPLEXER_LIBRARIES}) -#target_include_directories(${PROJECT_NAME} PUBLIC ${EISMULIPLEXER_INCLUDE_DIRS}) +install(TARGETS ${PROJECT_NAME} DESTINATION bin) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/eismultiplexerqt.desktop DESTINATION share/applications) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/eismultiplexerqt.png DESTINATION share/icons/hicolor/256x256/apps) diff --git a/mainwindow.cpp b/mainwindow.cpp index a41892a..0b7ae5d 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -39,7 +39,8 @@ void MainWindow::enumerateDevices() { uint16_t serial = serials[i]; std::shared_ptr multiplexer(new struct eismultiplexer); - if (!eismultiplexer_connect(multiplexer.get(), serial)) + int ret = eismultiplexer_connect(multiplexer.get(), serial); + if (ret == 0) { uint16_t channelCount = 0; qDebug()<<"Adding channels from device "<channelLayout->addStretch(); } diff --git a/resources/eismultiplexerqt.desktop b/resources/eismultiplexerqt.desktop new file mode 100644 index 0000000..58f04ce --- /dev/null +++ b/resources/eismultiplexerqt.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Categories=Qt;Science +Comment=Application to control RHD eismultiplexer devices +Icon=eismultiplexerqt +Name=EisMultiplexerQT +Exec=eismultiplexer-qt +Type=Application diff --git a/resources/eismultiplexerqt.png b/resources/eismultiplexerqt.png new file mode 100644 index 0000000..6408f2e Binary files /dev/null and b/resources/eismultiplexerqt.png differ