add, ci: enable Qv2ray QWidget, QML, CLI parallel builds

This commit is contained in:
QxQ 2020-12-08 15:24:07 +08:00
parent 285acb894f
commit 39c13b8e4b
5 changed files with 44 additions and 20 deletions

View File

@ -26,6 +26,7 @@ jobs:
qt_version: [5.15.0] qt_version: [5.15.0]
platform: [ubuntu-16.04, macos-latest, windows-latest] platform: [ubuntu-16.04, macos-latest, windows-latest]
build_type: [RelWithDebInfo, Release] build_type: [RelWithDebInfo, Release]
ui_type: [QWidget, QML, CLI]
arch: [x86, x64] arch: [x86, x64]
include: include:
- platform: windows-latest - platform: windows-latest
@ -128,6 +129,7 @@ jobs:
mkdir build mkdir build
cd build cd build
cmake .. -GNinja \ cmake .. -GNinja \
-DQV2RAY_UI_TYPE=${{ matrix.ui_type }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 \ -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 \
-DDS_STORE_SCRIPT=ON \ -DDS_STORE_SCRIPT=ON \
@ -147,6 +149,7 @@ jobs:
mkdir build mkdir build
cd build cd build
cmake .. -GNinja \ cmake .. -GNinja \
-DQV2RAY_UI_TYPE=${{ matrix.ui_type }} \
-DCMAKE_INSTALL_PREFIX=./deployment \ -DCMAKE_INSTALL_PREFIX=./deployment \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
cmake --build . --parallel $(nproc) cmake --build . --parallel $(nproc)
@ -163,6 +166,7 @@ jobs:
mkdir build mkdir build
cd build cd build
cmake .. -GNinja \ cmake .. -GNinja \
-DQV2RAY_UI_TYPE=${{ matrix.ui_type }} \
-DCMAKE_INSTALL_PREFIX=./AppDir/usr \ -DCMAKE_INSTALL_PREFIX=./AppDir/usr \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DQV2RAY_TRANSLATION_PATH=QApplication::applicationDirPath\(\)+"/../share/qv2ray/lang" -DQV2RAY_TRANSLATION_PATH=QApplication::applicationDirPath\(\)+"/../share/qv2ray/lang"
@ -195,11 +199,11 @@ jobs:
if: matrix.platform == 'ubuntu-16.04' if: matrix.platform == 'ubuntu-16.04'
uses: actions/upload-artifact@master uses: actions/upload-artifact@master
with: with:
name: Qv2ray-${{ github.sha }}.linux-${{ matrix.arch }}.qt${{ matrix.qt_version }}-${{ matrix.build_type }}.AppImage name: Qv2ray-${{ github.sha }}.linux-${{ matrix.arch }}-${{ matrix.ui_type }}.qt${{ matrix.qt_version }}-${{ matrix.build_type }}.AppImage
path: build/Qv2ray.AppImage path: build/Qv2ray.AppImage
- name: Linux - ${{ matrix.qt_version }} - Upload binaries to release - name: Linux - ${{ matrix.qt_version }} - Upload binaries to release
uses: svenstaro/upload-release-action@v1-release uses: svenstaro/upload-release-action@v1-release
if: github.event_name == 'release' && matrix.platform == 'ubuntu-16.04' && matrix.qt_version == '5.15.0' && matrix.build_type == 'Release' if: github.event_name == 'release' && matrix.platform == 'ubuntu-16.04' && matrix.ui_type == 'QWidget' && matrix.qt_version == '5.15.0' && matrix.build_type == 'Release'
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/Qv2ray.AppImage file: build/Qv2ray.AppImage
@ -211,11 +215,11 @@ jobs:
if: matrix.platform == 'macos-latest' if: matrix.platform == 'macos-latest'
uses: actions/upload-artifact@master uses: actions/upload-artifact@master
with: with:
name: Qv2ray-${{ github.sha }}.macOS-${{ matrix.arch }}.qt${{ matrix.qt_version }}-${{ matrix.build_type }}.dmg name: Qv2ray-${{ github.sha }}.macOS-${{ matrix.arch }}-${{ matrix.ui_type }}.qt${{ matrix.qt_version }}-${{ matrix.build_type }}.dmg
path: Qv2ray.dmg path: Qv2ray.dmg
- name: macOS - ${{ matrix.qt_version }} - Upload binaries to release - name: macOS - ${{ matrix.qt_version }} - Upload binaries to release
uses: svenstaro/upload-release-action@v1-release uses: svenstaro/upload-release-action@v1-release
if: github.event_name == 'release' && matrix.platform == 'macos-latest' && matrix.qt_version == '5.15.0' && matrix.build_type == 'Release' if: github.event_name == 'release' && matrix.platform == 'macos-latest' && matrix.ui_type == 'QWidget' && matrix.qt_version == '5.15.0' && matrix.build_type == 'Release'
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: Qv2ray.dmg file: Qv2ray.dmg
@ -233,11 +237,11 @@ jobs:
if: matrix.platform == 'windows-latest' if: matrix.platform == 'windows-latest'
uses: actions/upload-artifact@master uses: actions/upload-artifact@master
with: with:
name: Qv2ray-${{ github.sha }}.Windows-${{ matrix.arch }}.qt${{ matrix.qt_version }}-${{ matrix.build_type }}.7z name: Qv2ray-${{ github.sha }}.Windows-${{ matrix.arch }}-${{ matrix.ui_type }}.qt${{ matrix.qt_version }}-${{ matrix.build_type }}.7z
path: release.7z path: release.7z
- name: Win-${{ matrix.arch }} - ${{ matrix.qt_version }} - Upload binaries to release - name: Win-${{ matrix.arch }} - ${{ matrix.qt_version }} - Upload binaries to release
uses: svenstaro/upload-release-action@v1-release uses: svenstaro/upload-release-action@v1-release
if: github.event_name == 'release' && matrix.platform == 'windows-latest' && matrix.qt_version == '5.15.0' && matrix.build_type == 'Release' if: github.event_name == 'release' && matrix.platform == 'windows-latest' && matrix.ui_type == 'QWidget' && matrix.qt_version == '5.15.0' && matrix.build_type == 'Release'
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: release.7z file: release.7z

View File

@ -123,9 +123,24 @@ if(QV2RAY_HAS_BUILTIN_PLUGINS)
endif() endif()
option(QV2RAY_EMBED_TRANSLATIONS "Embed Translations" OFF) option(QV2RAY_EMBED_TRANSLATIONS "Embed Translations" OFF)
option(QV2RAY_USE_QML "Use QML as Qv2ray GUI" OFF)
option(QV2RAY_HAS_SINGLEAPPLICATION "Build With SingleApplication" ON) option(QV2RAY_HAS_SINGLEAPPLICATION "Build With SingleApplication" ON)
option(QV2RAY_USE_QWIDGET "Use QWidget as Qv2ray GUI" ON)
set(QV2RAY_UI_TYPE "QWidget" CACHE STRING "Qv2ray GUI Component")
QVLOG(QV2RAY_UI_TYPE)
if(QV2RAY_UI_TYPE STREQUAL "QWidget")
set(QV2RAY_USE_QWIDGET ON)
set(QV2RAY_USE_QML OFF)
elseif(QV2RAY_UI_TYPE STREQUAL "QML")
set(QV2RAY_USE_QWIDGET OFF)
set(QV2RAY_USE_QML ON)
elseif(QV2RAY_UI_TYPE STREQUAL "CLI")
set(QV2RAY_USE_QWIDGET OFF)
set(QV2RAY_USE_QML OFF)
else()
message(FATAL_ERROR "The given QV2RAY_UI_TYPE: ${QV2RAY_UI_TYPE} is invalid, expected: QWidget, QML, CLI")
endif()
if(ANDROID) if(ANDROID)
set(QV2RAY_EMBED_TRANSLATIONS ON) set(QV2RAY_EMBED_TRANSLATIONS ON)
set(QV2RAY_USE_QML ON) set(QV2RAY_USE_QML ON)

View File

@ -1 +1 @@
6062 6063

View File

@ -4,16 +4,21 @@ Qv2rayCliApplication::Qv2rayCliApplication(int &argc, char *argv[]) : Qv2rayPlat
{ {
} }
Qv2raySetupStatus Qv2rayCliApplication::Initialize() QStringList Qv2rayCliApplication::checkPrerequisitesInternal()
{ {
return InitializeInternal(); return {};
} }
Qv2rayExitCode Qv2rayCliApplication::RunQv2ray() Qv2rayExitReason Qv2rayCliApplication::runQv2rayInternal()
{ {
RunInternal(); return (Qv2rayExitReason) exec();
return Qv2rayExitCode::QVEXIT_NORMAL;
} }
void Qv2rayCliApplication::TerminateUI() void Qv2rayCliApplication::terminateUIInternal()
{ {
} }
#ifndef QV2RAY_NO_SINGLEAPPLICATON
void Qv2rayCliApplication::onMessageReceived(quint32 clientID, QByteArray msg)
{
}
#endif

View File

@ -8,14 +8,14 @@ namespace Qv2ray
Q_OBJECT Q_OBJECT
public: public:
explicit Qv2rayCliApplication(int &argc, char *argv[]); explicit Qv2rayCliApplication(int &argc, char *argv[]);
Qv2raySetupStatus Initialize() override; QStringList checkPrerequisitesInternal() override;
Qv2rayExitCode RunQv2ray() override; Qv2rayExitReason runQv2rayInternal() override;
public: public:
void MessageBoxWarn(QWidget *, const QString &, const QString &, MessageOpt = OK) override void MessageBoxWarn(QWidget *, const QString &, const QString &) override
{ {
} }
void MessageBoxInfo(QWidget *, const QString &, const QString &, MessageOpt = OK) override void MessageBoxInfo(QWidget *, const QString &, const QString &) override
{ {
} }
MessageOpt MessageBoxAsk(QWidget *, const QString &, const QString &, const QList<MessageOpt> &) override MessageOpt MessageBoxAsk(QWidget *, const QString &, const QString &, const QList<MessageOpt> &) override
@ -27,7 +27,7 @@ namespace Qv2ray
} }
private: private:
void TerminateUI() override; void terminateUIInternal() override;
#ifndef QV2RAY_NO_SINGLEAPPLICATON #ifndef QV2RAY_NO_SINGLEAPPLICATON
void onMessageReceived(quint32 clientID, QByteArray msg) override; void onMessageReceived(quint32 clientID, QByteArray msg) override;
#endif #endif