add qtbuild.
Some checks failed
Deploy Applications / PullDocker (push) Failing after 0s
Deploy Applications / Build (push) Failing after 7s
Windows CI / build (push) Failing after 52s

This commit is contained in:
amass 2024-08-10 12:32:28 +08:00
parent ba855b4c88
commit d21a956d6d
5 changed files with 207 additions and 2 deletions

View File

@ -11,4 +11,4 @@ jobs:
- name: Run a one-line script - name: Run a one-line script
run: | run: |
echo Hello, world! echo Hello, world!
resources/build.ps1 resources/build.ps1 build

42
QtDemo/CMakeLists.txt Normal file
View File

@ -0,0 +1,42 @@
cmake_minimum_required(VERSION 3.16)
project(QtDemo VERSION 0.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt6 6.5 REQUIRED COMPONENTS Quick)
qt_standard_project_setup(REQUIRES 6.5)
qt_add_executable(appQtDemo
main.cpp
)
qt_add_qml_module(appQtDemo
URI QtDemo
VERSION 1.0
QML_FILES
Main.qml
)
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
set_target_properties(appQtDemo PROPERTIES
# MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appQtDemo
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
target_link_libraries(appQtDemo
PRIVATE Qt6::Quick
)
include(GNUInstallDirs)
install(TARGETS appQtDemo
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

8
QtDemo/Main.qml Normal file
View File

@ -0,0 +1,8 @@
import QtQuick
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
}

18
QtDemo/main.cpp Normal file
View File

@ -0,0 +1,18 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
QObject::connect(
&engine,
&QQmlApplicationEngine::objectCreationFailed,
&app,
[]() { QCoreApplication::exit(-1); },
Qt::QueuedConnection);
engine.loadFromModule("QtDemo", "Main");
return app.exec();
}

View File

@ -1 +1,138 @@
ls param($type)
$DeployPath = "build\Younger-Release"
$PackagesPath = "resource\Installer\packages"
$QT_HOME= "D:\Qt\6.7.2\msvc2019_64"
$IfwHome = "D:\Qt\Tools\QtInstallerFramework\4.5"
$BoostRoot = "E:\Projects\Libraries\boost_1_80_0_msvc2022_64bit"
$OpenSSLRoot = "D:\Qt\Tools\OpenSSL\Win_x64"
Get-Location
$MsvcScript = 'D:\Program Files\Microsoft Visual Studio\2022\\Community\Common7\Tools\Launch-VsDevShell.ps1'
if (!(Test-Path $MsvcScript)) { $MsvcScript = 'D:\Program Files\Microsoft Visual Studio\2022\\Professional\Common7\Tools\Launch-VsDevShell.ps1' }
. $MsvcScript -SkipAutomaticLocation -Arch amd64
# $env:PATH
function Build() {
if (!(Test-Path build\QtDemo\CMakeCache.txt)) {
cmake.exe -G Ninja `
-S QtDemo -B build\QtDemo `
-DCMAKE_PREFIX_PATH=$QT_HOME `
-DQT_DIR="$QT_HOME\lib\cmake\Qt6" `
-DQt6_DIR="$QT_HOME\lib\cmake\Qt6" `
-DQt6QmlTools_DIR="$QT_HOME\lib\cmake\Qt6QmlTools" `
-DCMAKE_BUILD_TYPE=Release
}
cmake.exe --build build\QtDemo --target all
}
function Deploy() {
if (Test-Path $DeployPath) {
Remove-Item $DeployPath -Recurse
}
New-Item $DeployPath -ItemType Directory
Copy-Item .\build\Main\Younger.exe $DeployPath\Younger.exe
Copy-Item $OpenSSLRoot\bin\libssl-1_1-x64.dll $DeployPath
Copy-Item $OpenSSLRoot\bin\libcrypto-1_1-x64.dll $DeployPath
$boosts = "filesystem", "json", "log", "program_options", "thread", "locale"
foreach ($boost in $boosts) {
Copy-Item -Path $BoostRoot\lib\boost_$boost-vc143-mt-x64-1_80.dll -Destination $DeployPath
}
Copy-Item -Path .\build\Main\resource -Destination $DeployPath\resource -Recurse
Copy-Item -Path .\build\Main\lua -Destination $DeployPath\lua -Recurse
if (Test-Path .\build\Main\nes) {
Copy-Item -Path .\build\Main\nes -Destination $DeployPath\nes -Recurse
}
Copy-Item -Path .\build\Main\plugins -Destination $DeployPath\plugins -Recurse
New-Item $DeployPath\platforms -ItemType Directory
Copy-Item -Path $QtHome\plugins\platforms\qwindows.dll -Destination $DeployPath\platforms
New-Item $DeployPath\renderers -ItemType Directory
Copy-Item -Path $QtHome\plugins\renderers\openglrenderer.dll -Destination $DeployPath\renderers
New-Item $DeployPath\styles -ItemType Directory
Copy-Item -Path $QtHome\plugins\styles\qwindowsvistastyle.dll -Destination $DeployPath\styles
New-Item $DeployPath\iconengines -ItemType Directory
Copy-Item -Path $QtHome\plugins\iconengines\qsvgicon.dll -Destination $DeployPath\iconengines
New-Item $DeployPath\Qt\labs\platform -ItemType Directory
Copy-Item -Path $QtHome\qml\Qt\labs\platform\plugins.qmltypes -Destination $DeployPath\Qt\labs\platform
Copy-Item -Path $QtHome\qml\Qt\labs\platform\qmldir -Destination $DeployPath\Qt\labs\platform
Copy-Item -Path $QtHome\qml\Qt\labs\platform\qtlabsplatformplugin.dll -Destination $DeployPath\Qt\labs\platform
New-Item $DeployPath\QtCharts -ItemType Directory
Copy-Item -Path $QtHome\qml\QtCharts\plugins.qmltypes -Destination $DeployPath\QtCharts
Copy-Item -Path $QtHome\qml\QtCharts\qmldir -Destination $DeployPath\QtCharts
Copy-Item -Path $QtHome\qml\QtCharts\qtchartsqml2plugin.dll -Destination $DeployPath\QtCharts
Copy-Item -Path $QtHome\qml\Qt5Compat\GraphicalEffects $DeployPath\Qt5Compat\GraphicalEffects -Recurse
Remove-Item "$DeployPath\Qt5Compat\GraphicalEffects\*.pdb"
$modules = "Bluetooth", "Charts", "ChartsQml", "OpenGLWidgets", "Scxml", "SvgWidgets", "Test", "Widgets", "Xml"
foreach ($module in $modules) {
Copy-Item -Path $QtHome\bin\Qt6$module.dll -Destination $DeployPath
}
New-Item $DeployPath\imageformats -ItemType Directory
$formats = "qgif", "qicns", "qico", "qjpeg", "qsvg", "qtga", "qtiff", "qwbmp", "qwebp"
foreach ($format in $formats) {
Copy-Item -Path $QtHome\plugins\imageformats\$format.dll -Destination $DeployPath\imageformats
}
Invoke-Expression "$QtHome\bin\windeployqt.exe $DeployPath\Younger.exe --qmldir=$QtHome\qml --plugindir=$QtHome\plugins"
}
function Installer() {
Copy-Item -Path $DeployPath\resource -Destination $PackagesPath\Younger\data -Recurse -Force
Copy-Item -Path $DeployPath\lua -Destination $PackagesPath\Younger\data -Recurse -Force
if (Test-Path $DeployPath\nes) {
Copy-Item -Path $DeployPath\nes -Destination $PackagesPath\Younger\data -Recurse
}
Copy-Item -Path $DeployPath\Younger.exe -Destination $PackagesPath\Younger\data
Copy-Item -Path $DeployPath\*.dll -Destination $PackagesPath\Runtime\data -Force
$dirs = "iconengines", "imageformats", "platforms", "Qt", "QtCharts", "QtMultimedia", "QtQml", `
"QtQuick", "QtQuick3D", "Qt5Compat", "QtTest", "renderers", "styles", "translations"
foreach ($dir in $dirs) {
Copy-Item -Path $DeployPath\$dir -Destination $PackagesPath\Runtime\data -Recurse -Force
}
$plugins = "Bluetooth", "Calculator", "ElectronicTableCardManager", "FFmpegPlayer", "GameEmulator", "ScreenRecorder", "WebsocketAssistant"
foreach ($plugin in $plugins) {
if (!(Test-Path $PackagesPath\$plugin\data\plugins)) {
New-Item $PackagesPath\$plugin\data\plugins -ItemType Directory
}
Copy-Item -Path $DeployPath\plugins\$plugin.dll -Destination $PackagesPath\$plugin\data\plugins -Force
}
Invoke-Expression "$IfwHome\bin\repogen.exe -p resource\Installer\packages build\repository"
Invoke-Expression "$IfwHome\bin\binarycreator.exe -t $IfwHome\bin\installerbase.exe -p resource\Installer\packages -c resource\Installer\config\config.xml build\Younger_offline.exe -v"
Invoke-Expression "$IfwHome\bin\binarycreator.exe --online-only -t $IfwHome\bin\installerbase.exe -p resource\Installer\packages -c resource\Installer\config\config.xml build\YoungerInstaller.exe -v"
}
function UpdateServer(){
scp -r build\repository root@amass.fun:/root/http_server/InstallerRepository/Younger/repository
scp build\YoungerInstaller.exe root@amass.fun:/root/http_server/InstallerRepository/Younger
}
switch ($type) {
"build" {
Build
}
"deploy" {
Deploy
}
"installer" {
Installer
}
"update"{
UpdateServer
}
}