Skip to content

Commit 0cfbace

Browse files
committed
Rework Windows Build Script
- Publish Windows package creation scripts - Use PowerShell and wsl2, as it's common now Signed-off-by: Maxime Gervais <[email protected]>
1 parent 9826192 commit 0cfbace

File tree

5 files changed

+419
-210
lines changed

5 files changed

+419
-210
lines changed

Project/BuildAllFromSource/build.bat

Lines changed: 0 additions & 132 deletions
This file was deleted.

Project/BuildAllFromSource/build.ps1

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
###################################################################################################
2+
# build.ps1 - Batch script for building the Windows version of QCTools #
3+
# #
4+
# Script requirements: #
5+
# - qctools_AllInclusive source #
6+
# - Microsoft Visual Studio environment #
7+
# - Qt bin directory in the PATH #
8+
# - Python3 binary in the PATH #
9+
# - pkg-config binary in the PATH #
10+
# - Meson binary in the PATH #
11+
# - Ninja binary in the PATH #
12+
# - Configured WSL2 Linux environment with pkgconf, make and nasm packages installed #
13+
###################################################################################################
14+
15+
# helpers
16+
function Cmd-Result {
17+
if (-Not $?) {
18+
Exit(1)
19+
}
20+
}
21+
22+
# setup environment
23+
$ErrorActionPreference="Stop"
24+
$Env:SUBDIR= # Prevent ffmpeg build error
25+
$Env:PKG_CONFIG_PATH="$Pwd\output\lib\pkgconfig"
26+
$FFmpeg_CmdLine=@(
27+
'--toolchain=msvc',
28+
'--prefix=.',
29+
'--enable-shared',
30+
'--disable-static',
31+
'--disable-doc',
32+
'--disable-debug',
33+
'--disable-programs',
34+
'--disable-autodetect',
35+
'--enable-gpl',
36+
'--enable-version3',
37+
'--enable-libfreetype',
38+
'--enable-libharfbuzz',
39+
'--extra-libs=msvcrt.lib'
40+
)
41+
42+
# freetype
43+
Write-Output "Build FreeType"
44+
if (Test-Path -Path freetype\build) {
45+
Remove-Item -Recurse -Force -Path freetype\build
46+
}
47+
New-Item -ItemType directory -Name freetype\build
48+
Push-Location -Path freetype\build
49+
meson setup --prefix $Pwd\..\..\output --buildtype=release -Db_vscrt=md -Dbrotli=disabled -Dbzip2=disabled -Dharfbuzz=disabled -Dpng=disabled -Dzlib=internal .. ; Cmd-Result
50+
ninja install ; Cmd-Result
51+
Pop-Location
52+
53+
# harfbuzz
54+
Write-Output "Build HarfBuzz"
55+
if (Test-Path -Path harfbuzz\build) {
56+
Remove-Item -Recurse -Force -Path harfbuzz\build
57+
}
58+
New-Item -ItemType directory -Name harfbuzz\build
59+
Push-Location -Path harfbuzz\build
60+
meson setup --prefix $Pwd\..\..\output --buildtype=release -Db_vscrt=md -Dglib=disabled -Dgobject=disabled -Dcairo=disabled -Dchafa=disabled -Dicu=disabled -Dgraphite=disabled -Dgraphite2=disabled -Dgdi=disabled -Ddirectwrite=disabled -Dcoretext=disabled -Dwasm=disabled -Dtests=disabled -Dintrospection=disabled -Ddocs=disabled -Ddoc_tests=false -Dutilities=disabled .. ; Cmd-Result
61+
ninja install ; Cmd-Result
62+
Pop-Location
63+
64+
# remove windows-style line endings from the pkgconf files generated by meson (not well supported by the ffmpeg's configure script)
65+
Write-Output "Fixes .pc files"
66+
Push-Location -Path output\lib\pkgconfig
67+
Get-ChildItem -Path *.pc | ForEach-Object {
68+
(Get-Content -Raw -Path $_.Name) -Replace "`r`n", "`n" | Set-Content -Path $_.Name
69+
}
70+
Pop-Location
71+
72+
# ffmpeg
73+
Write-Output "Build FFmpeg"
74+
Push-Location ffmpeg
75+
if (Test-Path -Path Makefile) {
76+
wsl --shell-type standard -- make clean
77+
}
78+
wsl --shell-type standard -- PKG_CONFIG_PATH=`$PWD/../output/lib/pkgconfig ./configure @FFmpeg_CmdLine ; Cmd-Result
79+
wsl --shell-type standard -- make install ; Cmd-Result
80+
Pop-Location
81+
82+
83+
# qwt
84+
Write-Output "Build Qwt"
85+
Push-Location -Path qwt
86+
$Env:QWT_STATIC=1
87+
$Env:QWT_NO_SVG=1
88+
$Env:QWT_NO_OPENGL=1
89+
$Env:QWT_NO_DESIGNER=1
90+
if (Test-Path -Path Makefile) {
91+
nmake distclean
92+
}
93+
qmake -recursive ; Cmd-Result
94+
nmake Release ; Cmd-Result
95+
Pop-Location
96+
97+
# qctools
98+
Write-Output "Build QCTools"
99+
if (Test-Path -Path qctools\Project\QtCreator\build) {
100+
Remove-Item -Recurse -Force -Path qctools\Project\QtCreator\build
101+
}
102+
New-Item -ItemType directory -Name qctools\Project\QtCreator\build
103+
Push-Location -Path qctools\Project\QtCreator\build
104+
qmake QMAKE_CXXFLAGS+=/Zi QMAKE_LFLAGS+=/INCREMENTAL:NO QMAKE_LFLAGS+=/Debug DEFINES+=QT_AVPLAYER_MULTIMEDIA .. ; Cmd-Result
105+
nmake Release ; Cmd-Result
106+
windeployqt qctools-gui/release/QCTools.exe ; Cmd-Result
107+
windeployqt qctools-cli/release/qcli.exe ; Cmd-Result
108+
Pop-Location

Release/Release_CLI_Windows_x64.ps1

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
###################################################################################################
2+
# Release_CLI_Windows_x64.ps1 - PowerShell script for creating Windows QCli packages (x64) #
3+
# #
4+
# Script requirements: #
5+
# - Built qctools_AllInclusive sources #
6+
# - Microsoft Visual Studio environment #
7+
###################################################################################################
8+
9+
# setup environment
10+
$ErrorActionPreference="Stop"
11+
$build_path=$Pwd
12+
$version=Get-Content -Path $build_path\qctools\Project\version.txt
13+
14+
# binary archive
15+
Write-Output "Create CLI archive"
16+
if (Test-Path -Path QCli_${version}_Windows_x64) {
17+
Remove-Item -Force -Recurse -Path QCli_${version}_Windows_x64
18+
}
19+
New-Item -ItemType directory -Name QCli_${version}_Windows_x64
20+
Push-Location -Path QCli_${version}_Windows_x64
21+
Copy-Item -Path $build_path\qctools\History.txt
22+
Copy-Item -Path $build_path\qctools\License.html
23+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\qcli.exe
24+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\Qt6Core.dll
25+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\Qt6Gui.dll
26+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\Qt6Multimedia.dll
27+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\Qt6Network.dll
28+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\Qt6Svg.dll
29+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\d3dcompiler_47.dll
30+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\opengl32sw.dll
31+
New-Item -ItemType directory -Name iconengines
32+
Push-Location -Path iconengines
33+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\iconengines\qsvgicon.dll
34+
Pop-Location
35+
New-Item -ItemType directory -Name imageformats
36+
Push-Location -Path imageformats
37+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\imageformats\qjpeg.dll
38+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\imageformats\qsvg.dll
39+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\imageformats\qico.dll
40+
Pop-Location
41+
New-Item -ItemType directory -Name multimedia
42+
Push-Location -Path multimedia
43+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\multimedia\windowsmediaplugin.dll
44+
Pop-Location
45+
New-Item -ItemType directory -Name networkinformation
46+
Push-Location -Path networkinformation
47+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\networkinformation\qnetworklistmanager.dll
48+
Pop-Location
49+
New-Item -ItemType directory -Name platforms
50+
Push-Location -Path platforms
51+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\platforms\qwindows.dll
52+
Pop-Location
53+
New-Item -ItemType directory -Name tls
54+
Push-Location -Path tls
55+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\tls\qcertonlybackend.dll
56+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\tls\qopensslbackend.dll
57+
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\tls\qschannelbackend.dll
58+
Pop-Location
59+
Copy-Item -Path $build_path\ffmpeg\bin\avdevice-*.dll
60+
Copy-Item -Path $build_path\ffmpeg\bin\avcodec-*.dll
61+
Copy-Item -Path $build_path\ffmpeg\bin\avfilter-*.dll
62+
Copy-Item -Path $build_path\ffmpeg\bin\avformat-*.dll
63+
Copy-Item -Path $build_path\ffmpeg\bin\avutil-*.dll
64+
Copy-Item -Path $build_path\ffmpeg\bin\postproc-*.dll
65+
Copy-Item -Path $build_path\ffmpeg\bin\swresample-*.dll
66+
Copy-Item -Path $build_path\ffmpeg\bin\swscale-*.dll
67+
Copy-Item -Path $build_path\output\bin\freetype-*.dll
68+
Copy-Item -Path $build_path\output\bin\harfbuzz.dll
69+
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\concrt140.dll
70+
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\msvcp140.dll
71+
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\msvcp140_1.dll
72+
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\msvcp140_2.dll
73+
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\msvcp140_atomic_wait.dll
74+
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\msvcp140_codecvt_ids.dll
75+
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\vccorlib140.dll
76+
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\vcruntime140.dll
77+
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\vcruntime140_1.dll
78+
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\vcruntime140_threads.dll
79+
Pop-Location
80+
if (Test-Path -Path QCli_${version}_Windows_x64.zip) {
81+
Remove-Item -Force -Path QCli_${version}_Windows_x64.zip
82+
}
83+
Compress-Archive -Path QCli_${version}_Windows_x64\* -DestinationPath QCli_${version}_Windows_x64.zip
84+
85+
# debug symbols archive
86+
Write-Output "Create CLI debug symbols archive"
87+
if (Test-Path -Path QCli_${version}_Windows_x64_DebugInfo.zip) {
88+
Remove-Item -Force -Path QCli_${version}_Windows_x64_DebugInfo.zip
89+
}
90+
Compress-Archive -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\QCli.pdb -DestinationPath QCli_${version}_Windows_x64_DebugInfo.zip

0 commit comments

Comments
 (0)