Skip to content

Commit

Permalink
pkg-config workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
kaniol-lck committed Jun 13, 2024
1 parent 67d6cfe commit 2fa9270
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 67 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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: |
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ Thumbs.db
*.dll
*.exe

#Builds
build/
82 changes: 22 additions & 60 deletions modmanager.pro
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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){
Expand All @@ -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)
}
}
3 changes: 1 addition & 2 deletions src/download/qaria2.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#include <QObject>
#include <QTimer>
#include <QUrl>
//#include <aria2/aria2.h>
#include<aria2.h>
#include <aria2/aria2.h>

class QAria2Downloader;

Expand Down
3 changes: 1 addition & 2 deletions src/download/qaria2downloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

#include "abstractdownloader.h"

//#include <aria2/aria2.h>
#include <aria2.h>
#include <aria2/aria2.h>

class QAria2Downloader : public AbstractDownloader
{
Expand Down

0 comments on commit 2fa9270

Please sign in to comment.