From b2f10f52ae4a7d9e4baf151f79553c3eb03bf457 Mon Sep 17 00:00:00 2001 From: Odizinne Date: Fri, 16 Aug 2024 21:00:31 +0200 Subject: [PATCH] ubuntu workflow attempt --- .github/workflows/qt-linux-build.yml | 58 +++++++++++++++++++++++++ HeadsetControl-Qt.pro | 5 ++- src/ShortcutManager/shortcutmanager.cpp | 12 +++-- 3 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/qt-linux-build.yml diff --git a/.github/workflows/qt-linux-build.yml b/.github/workflows/qt-linux-build.yml new file mode 100644 index 0000000..85b6030 --- /dev/null +++ b/.github/workflows/qt-linux-build.yml @@ -0,0 +1,58 @@ +name: Build + +on: + push: + branches: + - linux + +jobs: + linux-build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Qt + uses: jurplel/install-qt-action@v4 + with: + version: '6.7.2' + host: 'linux' + add-tools-to-path: true + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential libgl1-mesa-dev + + - name: Build with qmake + run: | + mkdir build + cd build + qmake ../HeadsetControl-Qt.pro CONFIG+=release + make -j$(nproc) + + - name: Remove source and object files + run: | + # Define the directory + buildDir="build/release" + + # Check if the directory exists + if [ -d "$buildDir" ]; then + # Remove .cpp, .h, .o files + find "$buildDir" -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.o" \) -exec rm -f {} + + else + echo "Directory not found: $buildDir" + fi + + - name: Zip binaries folder + run: | + zipFile="build/HeadsetControl-Qt_linux_64.zip" + folder="build/release" + zip -r "$zipFile" "$folder" + + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: HeadsetControl-Qt_linux_64 + path: build/HeadsetControl-Qt_linux_64.zip \ No newline at end of file diff --git a/HeadsetControl-Qt.pro b/HeadsetControl-Qt.pro index 238cdd7..9dfd904 100644 --- a/HeadsetControl-Qt.pro +++ b/HeadsetControl-Qt.pro @@ -50,6 +50,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin DEPENDENCIES_DIR = $$PWD/src/dependencies DEST_DIR = $$OUT_PWD/release/dependencies -QMAKE_POST_LINK += powershell -Command "New-Item -ItemType Directory -Path '$$DEST_DIR' -Force; Copy-Item -Path '$$DEPENDENCIES_DIR\*' -Destination '$$DEST_DIR' -Recurse -Force" -#mkdir $$DEST_DIR +win32 { + QMAKE_POST_LINK += powershell -Command "New-Item -ItemType Directory -Path '$$DEST_DIR' -Force; Copy-Item -Path '$$DEPENDENCIES_DIR\*' -Destination '$$DEST_DIR' -Recurse -Force" +} diff --git a/src/ShortcutManager/shortcutmanager.cpp b/src/ShortcutManager/shortcutmanager.cpp index f901bd2..5c50621 100644 --- a/src/ShortcutManager/shortcutmanager.cpp +++ b/src/ShortcutManager/shortcutmanager.cpp @@ -6,13 +6,16 @@ #include #include #include -#include -#include -#include -const QString desktopFile = QDir::homePath() + "/.config/autostart/headsetcontrol-qt.desktop"; +#ifdef _WIN32 + #include + #include + #include +#endif +const QString desktopFile = QDir::homePath() + "/.config/autostart/headsetcontrol-qt.desktop"; +#ifdef _WIN32 QString getStartupFolder() { QString path; @@ -104,6 +107,7 @@ void manageShortcut(bool state) } } } +#endif bool isDesktopfilePresent() {