-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #858 from MediaArea/windows
Rework Windows Build Script
- Loading branch information
Showing
6 changed files
with
423 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
################################################################################################### | ||
# build.ps1 - Batch script for building the Windows version of QCTools # | ||
# # | ||
# Script requirements: # | ||
# - qctools_AllInclusive source # | ||
# - Microsoft Visual Studio environment # | ||
# - Qt bin directory in the PATH # | ||
# - Python3 binary in the PATH # | ||
# - pkg-config binary in the PATH # | ||
# - Meson binary in the PATH # | ||
# - Ninja binary in the PATH # | ||
# - Configured WSL2 Linux environment with pkgconf, make and nasm packages installed # | ||
################################################################################################### | ||
|
||
# helpers | ||
function Cmd-Result { | ||
if (-Not $?) { | ||
Exit(1) | ||
} | ||
} | ||
|
||
# setup environment | ||
$ErrorActionPreference="Stop" | ||
$Env:SUBDIR= # Prevent ffmpeg build error | ||
$Env:PKG_CONFIG_PATH="$Pwd\output\lib\pkgconfig" | ||
$FFmpeg_CmdLine=@( | ||
'--toolchain=msvc', | ||
'--prefix=.', | ||
'--enable-shared', | ||
'--disable-static', | ||
'--disable-doc', | ||
'--disable-debug', | ||
'--disable-programs', | ||
'--disable-autodetect', | ||
'--enable-gpl', | ||
'--enable-version3', | ||
'--enable-libfreetype', | ||
'--enable-libharfbuzz', | ||
'--extra-libs=msvcrt.lib' | ||
) | ||
|
||
# freetype | ||
Write-Output "Build FreeType" | ||
if (Test-Path -Path freetype\build) { | ||
Remove-Item -Recurse -Force -Path freetype\build | ||
} | ||
New-Item -ItemType directory -Name freetype\build | ||
Push-Location -Path freetype\build | ||
meson setup --prefix $Pwd\..\..\output --buildtype=release -Db_vscrt=md -Dbrotli=disabled -Dbzip2=disabled -Dharfbuzz=disabled -Dpng=disabled -Dzlib=internal .. ; Cmd-Result | ||
ninja install ; Cmd-Result | ||
Pop-Location | ||
|
||
# harfbuzz | ||
Write-Output "Build HarfBuzz" | ||
if (Test-Path -Path harfbuzz\build) { | ||
Remove-Item -Recurse -Force -Path harfbuzz\build | ||
} | ||
New-Item -ItemType directory -Name harfbuzz\build | ||
Push-Location -Path harfbuzz\build | ||
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 | ||
ninja install ; Cmd-Result | ||
Pop-Location | ||
|
||
# remove windows-style line endings from the pkgconf files generated by meson (not well supported by the ffmpeg's configure script) | ||
Write-Output "Fixes .pc files" | ||
Push-Location -Path output\lib\pkgconfig | ||
Get-ChildItem -Path *.pc | ForEach-Object { | ||
(Get-Content -Raw -Path $_.Name) -Replace "`r`n", "`n" | Set-Content -Path $_.Name | ||
} | ||
Pop-Location | ||
|
||
# ffmpeg | ||
Write-Output "Build FFmpeg" | ||
Push-Location ffmpeg | ||
if (Test-Path -Path Makefile) { | ||
wsl --shell-type standard -- make clean | ||
} | ||
wsl --shell-type standard -- PKG_CONFIG_PATH=`$PWD/../output/lib/pkgconfig ./configure @FFmpeg_CmdLine ; Cmd-Result | ||
wsl --shell-type standard -- make install ; Cmd-Result | ||
Pop-Location | ||
|
||
|
||
# qwt | ||
Write-Output "Build Qwt" | ||
Push-Location -Path qwt | ||
$Env:QWT_STATIC=1 | ||
$Env:QWT_NO_SVG=1 | ||
$Env:QWT_NO_OPENGL=1 | ||
$Env:QWT_NO_DESIGNER=1 | ||
if (Test-Path -Path Makefile) { | ||
nmake distclean | ||
} | ||
qmake -recursive ; Cmd-Result | ||
nmake Release ; Cmd-Result | ||
Pop-Location | ||
|
||
# qctools | ||
Write-Output "Build QCTools" | ||
if (Test-Path -Path qctools\Project\QtCreator\build) { | ||
Remove-Item -Recurse -Force -Path qctools\Project\QtCreator\build | ||
} | ||
New-Item -ItemType directory -Name qctools\Project\QtCreator\build | ||
Push-Location -Path qctools\Project\QtCreator\build | ||
qmake QMAKE_CXXFLAGS+=/Zi QMAKE_LFLAGS+=/INCREMENTAL:NO QMAKE_LFLAGS+=/Debug DEFINES+=QT_AVPLAYER_MULTIMEDIA .. ; Cmd-Result | ||
nmake Release ; Cmd-Result | ||
windeployqt qctools-gui/release/QCTools.exe ; Cmd-Result | ||
windeployqt qctools-cli/release/qcli.exe ; Cmd-Result | ||
Pop-Location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
################################################################################################### | ||
# Release_CLI_Windows_x64.ps1 - PowerShell script for creating Windows QCli packages (x64) # | ||
# # | ||
# Script requirements: # | ||
# - Built qctools_AllInclusive sources # | ||
# - Microsoft Visual Studio environment # | ||
################################################################################################### | ||
|
||
# setup environment | ||
$ErrorActionPreference="Stop" | ||
$build_path=$Pwd | ||
$version=Get-Content -Path $build_path\qctools\Project\version.txt | ||
|
||
# binary archive | ||
Write-Output "Create CLI archive" | ||
if (Test-Path -Path QCli_${version}_Windows_x64) { | ||
Remove-Item -Force -Recurse -Path QCli_${version}_Windows_x64 | ||
} | ||
New-Item -ItemType directory -Name QCli_${version}_Windows_x64 | ||
Push-Location -Path QCli_${version}_Windows_x64 | ||
Copy-Item -Path $build_path\qctools\History.txt | ||
Copy-Item -Path $build_path\qctools\License.html | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\qcli.exe | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\Qt6Core.dll | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\Qt6Gui.dll | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\Qt6Multimedia.dll | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\Qt6Network.dll | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\Qt6Svg.dll | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\d3dcompiler_47.dll | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\opengl32sw.dll | ||
New-Item -ItemType directory -Name iconengines | ||
Push-Location -Path iconengines | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\iconengines\qsvgicon.dll | ||
Pop-Location | ||
New-Item -ItemType directory -Name imageformats | ||
Push-Location -Path imageformats | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\imageformats\qjpeg.dll | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\imageformats\qsvg.dll | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\imageformats\qico.dll | ||
Pop-Location | ||
New-Item -ItemType directory -Name multimedia | ||
Push-Location -Path multimedia | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\multimedia\windowsmediaplugin.dll | ||
Pop-Location | ||
New-Item -ItemType directory -Name networkinformation | ||
Push-Location -Path networkinformation | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\networkinformation\qnetworklistmanager.dll | ||
Pop-Location | ||
New-Item -ItemType directory -Name platforms | ||
Push-Location -Path platforms | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\platforms\qwindows.dll | ||
Pop-Location | ||
New-Item -ItemType directory -Name tls | ||
Push-Location -Path tls | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\tls\qcertonlybackend.dll | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\tls\qopensslbackend.dll | ||
Copy-Item -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\tls\qschannelbackend.dll | ||
Pop-Location | ||
Copy-Item -Path $build_path\ffmpeg\bin\avdevice-*.dll | ||
Copy-Item -Path $build_path\ffmpeg\bin\avcodec-*.dll | ||
Copy-Item -Path $build_path\ffmpeg\bin\avfilter-*.dll | ||
Copy-Item -Path $build_path\ffmpeg\bin\avformat-*.dll | ||
Copy-Item -Path $build_path\ffmpeg\bin\avutil-*.dll | ||
Copy-Item -Path $build_path\ffmpeg\bin\postproc-*.dll | ||
Copy-Item -Path $build_path\ffmpeg\bin\swresample-*.dll | ||
Copy-Item -Path $build_path\ffmpeg\bin\swscale-*.dll | ||
Copy-Item -Path $build_path\output\bin\freetype-*.dll | ||
Copy-Item -Path $build_path\output\bin\harfbuzz.dll | ||
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\concrt140.dll | ||
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\msvcp140.dll | ||
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\msvcp140_1.dll | ||
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\msvcp140_2.dll | ||
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\msvcp140_atomic_wait.dll | ||
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\msvcp140_codecvt_ids.dll | ||
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\vccorlib140.dll | ||
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\vcruntime140.dll | ||
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\vcruntime140_1.dll | ||
Copy-Item -Path $Env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\vcruntime140_threads.dll | ||
Pop-Location | ||
if (Test-Path -Path QCli_${version}_Windows_x64.zip) { | ||
Remove-Item -Force -Path QCli_${version}_Windows_x64.zip | ||
} | ||
Compress-Archive -Path QCli_${version}_Windows_x64\* -DestinationPath QCli_${version}_Windows_x64.zip | ||
|
||
# debug symbols archive | ||
Write-Output "Create CLI debug symbols archive" | ||
if (Test-Path -Path QCli_${version}_Windows_x64_DebugInfo.zip) { | ||
Remove-Item -Force -Path QCli_${version}_Windows_x64_DebugInfo.zip | ||
} | ||
Compress-Archive -Path $build_path\qctools\Project\QtCreator\build\qctools-cli\release\QCli.pdb -DestinationPath QCli_${version}_Windows_x64_DebugInfo.zip |
Oops, something went wrong.