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 } }