From 2fa9270442d1896a888ae8fbd45cbdc0557c3a42 Mon Sep 17 00:00:00 2001 From: kaniol-lck <375520360@qq.com> Date: Thu, 13 Jun 2024 17:36:31 +0800 Subject: [PATCH] pkg-config workaround --- .github/workflows/ci.yml | 13 ++++-- .gitignore | 2 + modmanager.pro | 82 +++++++++------------------------ src/download/qaria2.h | 3 +- src/download/qaria2downloader.h | 3 +- 5 files changed, 36 insertions(+), 67 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df63801a..e3222ff7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,7 @@ jobs: etc/usr/publish/** build-on-ubuntu: name: Build On Ubuntu - runs-on: ubuntu-latest # for libaria2-0 available + runs-on: ubuntu-24.04 # for libquazip1-qt5 available steps: - name: Install Qt uses: jurplel/install-qt-action@v4 @@ -70,7 +70,7 @@ jobs: run: | sudo apt update sudo apt-get install -y libglew-dev libglfw3-dev - sudo apt-get install -y libaria2-0-dev libquazip5-dev + sudo apt-get install -y libaria2-0-dev libquazip1-qt5-dev sudo apt install -y libgl-dev libx11-dev libxkbcommon-x11-dev libxcb-util1 libxcb-image0-dev libxcb-icccm4-dev libssl-dev libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 sudo apt install -y libprotobuf-dev protobuf-compiler protobuf-c-compiler libgrpc++-dev protobuf-compiler-grpc ninja-build fcitx-frontend-qt5 libcurl4-openssl-dev - uses: actions/checkout@v2 @@ -94,6 +94,7 @@ jobs: sed -i "s/$RAW_VERSION/$VERSION/" src/version.h - name: build ubuntu run: | + export PKG_CONFIG_PATH='/usr/lib/x86_64-linux-gnu/pkgconfig/' qmake make - name: package @@ -170,12 +171,15 @@ jobs: run: | C:/msys64/usr/bin/pacman -S mingw-w64-${{ matrix.msys_arch }}-aria2 --noconfirm C:/msys64/usr/bin/pacman -S mingw-w64-${{ matrix.msys_arch }}-quazip-qt5 --noconfirm + C:/msys64/usr/bin/pacman -S mingw-w64-${{ matrix.msys_arch }}-pkg-config --noconfirm + C:/msys64/usr/bin/pacman -Q - name: Install dependencies for Qt 6 if: ${{ startsWith( matrix.qt_ver, 6 ) }} shell: powershell run: | C:/msys64/usr/bin/pacman -S mingw-w64-${{ matrix.msys_arch }}-aria2 --noconfirm C:/msys64/usr/bin/pacman -S mingw-w64-${{ matrix.msys_arch }}-quazip-qt6 --noconfirm + C:/msys64/usr/bin/pacman -S mingw-w64-${{ matrix.msys_arch }}-pkg-config --noconfirm - name: environment configuration shell: pwsh run: | @@ -188,8 +192,11 @@ jobs: Get-Command -Name 'mingw32-make' | Format-List - name: mingw-build id: build - shell: cmd + shell: pwsh + env: + PKG_CONFIG_PATH: 'C:/msys64/mingw64/lib/pkgconfig' run: | + cp C:/msys64/mingw64/bin/pkg-config.exe ${{ env.QT_ROOT_DIR }}/bin/ qmake mingw32-make.exe qmake_all mingw32-make.exe diff --git a/.gitignore b/.gitignore index fab7372d..76c87c4b 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,5 @@ Thumbs.db *.dll *.exe +#Builds +build/ \ No newline at end of file diff --git a/modmanager.pro b/modmanager.pro index 7ec619c4..49c1daab 100644 --- a/modmanager.pro +++ b/modmanager.pro @@ -1,6 +1,7 @@ QT += core gui network concurrent greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat CONFIG += c++17 QMAKE_CXXFLAGS += -std=c++17 @@ -411,37 +412,6 @@ win32: RC_ICONS = package/modmanager.ico #dependencies unix { message("unix-like build") - equals(QT_MAJOR_VERSION,5){ - exists(/usr/lib/x86_64-linux-gnu/libquazip5.a) { - LIBS += -L$$quote(/usr/lib/x86_64-linux-gnu) -lquazip5 - } else { - LIBS += -lquazip1-qt5 - } - INCLUDEPATH += \ - /usr/include/QuaZip-Qt5-1.4/quazip \ - /usr/include/QuaZip-Qt5-1.3/quazip \ - /usr/include/QuaZip-Qt5-1.2/quazip \ - /usr/include/QuaZip-Qt5-1.1/quazip \ - /usr/include/quazip \ - /usr/include/quazip5 - } - equals(QT_MAJOR_VERSION,6){ - exists(/usr/lib/x86_64-linux-gnu/libquazip6.a) { - LIBS += -L$$quote(/usr/lib/x86_64-linux-gnu) -lquazip6 - } else { - LIBS += -lquazip1-qt6 - } - INCLUDEPATH += \ - /usr/include/QuaZip-Qt6-1.4/quazip \ - /usr/include/QuaZip-Qt6-1.3/quazip \ - /usr/include/QuaZip-Qt6-1.2/quazip \ - /usr/include/QuaZip-Qt6-1.1/quazip \ - /usr/include/quazip \ - /usr/include/quazip6 - } - - INCLUDEPATH += /usr/include/aria2 - LIBS += -L$$quote(/usr/local/lib) -laria2 message(HEADERS) exists(/usr/include/KF5/KWindowSystem){ @@ -450,39 +420,31 @@ unix { LIBS += -lKF5WindowSystem INCLUDEPATH += /usr/include/KF5/KWindowSystem } -} - -macx { - message("macos build") - INCLUDEPATH += /usr/include/aria2 - LIBS += -L$$quote(/usr/local/lib) -laria2 - equals(QT_MAJOR_VERSION,5):INCLUDEPATH += /usr/include/QuaZip-Qt5-1.4/quazip - equals(QT_MAJOR_VERSION,6):INCLUDEPATH += /usr/include/QuaZip-Qt6-1.4/quazip - INCLUDEPATH += /usr/include/quazip + message($$system(printenv PKG_CONFIG_PATH)) + message($$system($$pkgConfigExecutable() --libs libaria2 quazip1-qt5)) + message($$system($$pkgConfigExecutable() --cflags libaria2 quazip1-qt5)) + QMAKE_CXXFLAGS += $$system($$pkgConfigExecutable() --cflags libaria2 quazip1-qt5) + LIBS += -L/usr/lib/x86_64-linux-gnu -lquazip1-qt5 -L/usr/local/lib -laria2 + # CONFIG += link_pkgconfig + # equals(QT_MAJOR_VERSION, 5): PKGCONFIG += libaria2 quazip1-qt5 + # equals(QT_MAJOR_VERSION, 6): PKGCONFIG += libaria2 quazip1-qt6 } win32 { + #native blur LIBS += -ldwmapi - contains(QMAKE_HOST.arch, x86_64) { - message("win32 x86_64 build") - #For Qt5 - equals(QT_MAJOR_VERSION,5): INCLUDEPATH += \ - C:/msys64/mingw64/include/QuaZip-Qt5-1.4/quazip \ - C:/msys64/mingw64/include/aria2 - equals(QT_MAJOR_VERSION,5):LIBS += -L$$quote(C:/msys64/mingw64/bin) -laria2-0 -lquazip1-qt5 - - #For Qt6 - equals(QT_MAJOR_VERSION,6): INCLUDEPATH += \ - C:/msys64/mingw64/include/QuaZip-Qt6-1.4/quazip \ - C:/msys64/mingw64/include/aria2 - equals(QT_MAJOR_VERSION,6):LIBS += -L$$quote(C:/msys64/mingw64/bin) -laria2-0 -lquazip1-qt6 - - } else { - #Deprecated - message("win32 x86 build") - INCLUDEPATH += C:/msys64/mingw32/include - INCLUDEPATH += C:/msys64/mingw32/include/QuaZip-Qt5-1.4/quazip - LIBS += -L$$quote(C:/msys64/mingw32/bin) -laria2 -lquazip5 + message($$system(printenv PKG_CONFIG_PATH)) + message($$system($$pkgConfigExecutable() --cflags libaria2)) + message($$system($$pkgConfigExecutable() --libs libaria2)) + QMAKE_CXXFLAGS += $$system($$pkgConfigExecutable() --cflags libaria2) + LIBS += $$system($$pkgConfigExecutable() --libs libaria2 | sed 's/\/lib\b/\/bin/' | sed 's/-laria2/-laria2-0/') + equals(QT_MAJOR_VERSION, 5){ + QMAKE_CXXFLAGS += $$system($$pkgConfigExecutable() --cflags quazip1-qt5) + LIBS += $$system($$pkgConfigExecutable() --libs quazip1-qt5) + } + equals(QT_MAJOR_VERSION, 6){ + QMAKE_CXXFLAGS += $$system($$pkgConfigExecutable() --cflags quazip1-qt6) + LIBS += $$system($$pkgConfigExecutable() --libs quazip1-qt6) } } diff --git a/src/download/qaria2.h b/src/download/qaria2.h index 8c6c36b2..7eaa9551 100644 --- a/src/download/qaria2.h +++ b/src/download/qaria2.h @@ -5,8 +5,7 @@ #include #include #include -//#include -#include +#include class QAria2Downloader; diff --git a/src/download/qaria2downloader.h b/src/download/qaria2downloader.h index f86c6e2c..467dae06 100644 --- a/src/download/qaria2downloader.h +++ b/src/download/qaria2downloader.h @@ -3,8 +3,7 @@ #include "abstractdownloader.h" -//#include -#include +#include class QAria2Downloader : public AbstractDownloader {