2020-05-01 18:16:41 +00:00
|
|
|
#!/usr/bin/env pwsh
|
|
|
|
|
2024-03-04 22:59:51 +00:00
|
|
|
$global:Qt6Version = '6.6.2'
|
2020-05-01 18:16:41 +00:00
|
|
|
|
2023-02-12 22:12:09 +00:00
|
|
|
$global:Qt6Deps = @(
|
2020-05-01 18:16:41 +00:00
|
|
|
'DBus'
|
|
|
|
'OpenSsl'
|
|
|
|
'Zlib'
|
|
|
|
)
|
|
|
|
|
2023-02-12 22:12:09 +00:00
|
|
|
function global:Build-Qt6([string] $PrefixDir, [string] $Arch, [string] $DepsPrefixDir) {
|
|
|
|
$Filename = "qt-everywhere-src-${Qt6Version}.zip" # tar.xz has some names truncated (e.g. .../double-conversion.h -> .../double-conv)
|
|
|
|
$Url = "http://qt.mirror.constant.com/archive/qt/$($Qt6Version -replace '\.\d+$', '')/${Qt6Version}/single/${Filename}"
|
2020-05-01 18:16:41 +00:00
|
|
|
|
2023-02-12 22:12:09 +00:00
|
|
|
$ArchiveBase = "qt-everywhere-src-${Qt6Version}"
|
2020-05-01 18:16:41 +00:00
|
|
|
$UnpackFlags = @(
|
|
|
|
(Join-Path $ArchiveBase qtactiveqt '*')
|
|
|
|
(Join-Path $ArchiveBase qtbase '*')
|
2021-12-06 21:39:16 +00:00
|
|
|
(Join-Path $ArchiveBase qtsvg '*')
|
2020-05-01 18:16:41 +00:00
|
|
|
(Join-Path $ArchiveBase qttools '*')
|
|
|
|
(Join-Path $ArchiveBase qttranslations '*')
|
|
|
|
(Join-Path $ArchiveBase qtwinextras '*')
|
|
|
|
(Join-Path $ArchiveBase .gitmodules)
|
2022-11-04 18:38:28 +00:00
|
|
|
(Join-Path $ArchiveBase cmake)
|
|
|
|
(Join-Path $ArchiveBase CMakeLists.txt)
|
2020-05-01 18:16:41 +00:00
|
|
|
(Join-Path $ArchiveBase configure.bat)
|
|
|
|
(Join-Path $ArchiveBase configure.json)
|
|
|
|
(Join-Path $ArchiveBase qt.pro)
|
|
|
|
)
|
|
|
|
|
|
|
|
$SourceDir = Invoke-DownloadAndUnpack $Url $Filename $UnpackFlags
|
|
|
|
$BuildDir = Join-Path $SourceDir .build
|
|
|
|
|
|
|
|
$ConfigOptions = @(
|
|
|
|
'-platform'; 'win32-msvc'
|
|
|
|
'-opensource'
|
|
|
|
'-confirm-license'
|
|
|
|
'-prefix'; $PrefixDir
|
|
|
|
'-release'
|
|
|
|
'-force-debug-info'
|
|
|
|
'-dbus'
|
|
|
|
'-ssl'
|
|
|
|
'-openssl'
|
|
|
|
'-system-zlib'
|
|
|
|
'-qt-pcre'
|
|
|
|
'-qt-libpng'
|
|
|
|
'-qt-libjpeg'
|
|
|
|
'-no-opengl'
|
|
|
|
'-no-freetype'
|
|
|
|
'-no-harfbuzz'
|
2022-11-04 18:38:28 +00:00
|
|
|
'-no-feature-androiddeployqt'
|
2023-11-01 12:09:45 +00:00
|
|
|
'-no-feature-assistant'
|
2022-11-04 18:38:28 +00:00
|
|
|
'-no-feature-clang'
|
|
|
|
'-no-feature-clangcpp'
|
2023-11-01 12:09:45 +00:00
|
|
|
'-no-feature-commandlinkbutton'
|
|
|
|
'-no-feature-concurrent'
|
|
|
|
'-no-feature-designer'
|
|
|
|
'-no-feature-dial'
|
|
|
|
'-no-feature-distancefieldgenerator'
|
|
|
|
'-no-feature-dockwidget'
|
|
|
|
'-no-feature-fontcombobox'
|
|
|
|
'-no-feature-gestures'
|
|
|
|
'-no-feature-graphicsview'
|
|
|
|
'-no-feature-keysequenceedit'
|
|
|
|
'-no-feature-lcdnumber'
|
|
|
|
'-no-feature-mdiarea'
|
|
|
|
'-no-feature-networklistmanager'
|
|
|
|
'-no-feature-opengl'
|
|
|
|
'-no-feature-pdf'
|
|
|
|
'-no-feature-pixeltool'
|
|
|
|
'-no-feature-printsupport'
|
|
|
|
'-no-feature-qtattributionsscanner'
|
|
|
|
'-no-feature-raster-64bit'
|
2022-11-04 18:38:28 +00:00
|
|
|
'-no-feature-schannel'
|
2023-11-01 12:09:45 +00:00
|
|
|
'-no-feature-scroller'
|
|
|
|
'-no-feature-sharedmemory'
|
|
|
|
'-no-feature-splashscreen'
|
2022-11-04 18:38:28 +00:00
|
|
|
'-no-feature-sql'
|
2023-11-01 12:09:45 +00:00
|
|
|
'-no-feature-syntaxhighlighter'
|
|
|
|
'-no-feature-systemsemaphore'
|
2022-11-04 18:38:28 +00:00
|
|
|
'-no-feature-testlib'
|
2023-11-01 12:09:45 +00:00
|
|
|
'-no-feature-textmarkdownreader'
|
|
|
|
'-no-feature-textmarkdownwriter'
|
|
|
|
'-no-feature-textodfwriter'
|
|
|
|
'-no-feature-tuiotouch'
|
|
|
|
'-no-feature-undocommand'
|
|
|
|
'-no-feature-whatsthis'
|
|
|
|
'-no-feature-windeployqt'
|
|
|
|
'-no-feature-wizard'
|
2020-05-01 18:16:41 +00:00
|
|
|
'-nomake'; 'examples'
|
|
|
|
'-nomake'; 'tests'
|
2022-11-04 18:38:28 +00:00
|
|
|
'-I'; (Join-Path $DepsPrefixDir include).Replace('\', '/')
|
|
|
|
'-L'; (Join-Path $DepsPrefixDir lib).Replace('\', '/')
|
2024-03-05 02:53:59 +00:00
|
|
|
'--'
|
|
|
|
"-DCMAKE_PREFIX_PATH=${DepsPrefixDir}"
|
2020-05-01 18:16:41 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if ($env:LDFLAGS) {
|
|
|
|
# Patch to add our linker flags, mainly /PDBALTPATH
|
|
|
|
Edit-TextFile (Join-Path $SourceDir qtbase mkspecs win32-msvc qmake.conf) '(^QMAKE_CXXFLAGS\b.*)' "`$1`nQMAKE_LFLAGS += ${env:LDFLAGS}"
|
|
|
|
}
|
|
|
|
|
|
|
|
# No need in GUI tools
|
2023-11-01 12:09:45 +00:00
|
|
|
Edit-TextFile (Join-Path $SourceDir qttools src CMakeLists.txt) 'TARGET Qt::Widgets' 'QT_FEATURE_designer'
|
2022-11-04 18:38:28 +00:00
|
|
|
Edit-TextFile (Join-Path $SourceDir qttools src linguist CMakeLists.txt) 'add_subdirectory[(]linguist[)]' ''
|
2020-05-01 18:16:41 +00:00
|
|
|
|
|
|
|
Invoke-NativeCommand cmake -E remove_directory $BuildDir
|
|
|
|
$env:PATH = @(
|
|
|
|
(Join-Path $PrefixDir bin)
|
|
|
|
(Join-Path $DepsPrefixDir bin)
|
|
|
|
(Join-Path $BuildDir qtbase lib)
|
|
|
|
$env:PATH
|
|
|
|
) -join [System.IO.Path]::PathSeparator
|
|
|
|
|
|
|
|
New-Item -Path $BuildDir -ItemType Directory -ErrorAction Ignore | Out-Null
|
|
|
|
Push-Location -Path $BuildDir
|
|
|
|
Invoke-VcEnvCommand (Join-Path $SourceDir configure) @ConfigOptions
|
2022-11-04 18:38:28 +00:00
|
|
|
Invoke-VcEnvCommand cmake --build . --parallel
|
|
|
|
Invoke-VcEnvCommand cmake --install .
|
2020-05-01 18:16:41 +00:00
|
|
|
Pop-Location
|
|
|
|
|
|
|
|
# install target doesn't copy PDBs for release DLLs
|
|
|
|
Get-Childitem -Path (Join-Path $BuildDir qtbase lib) | `
|
|
|
|
ForEach-Object { if ($_ -is [System.IO.DirectoryInfo] -or $_.Name -like '*.pdb') { Copy-Item -Path $_.FullName -Destination (Join-Path $PrefixDir lib) -Filter '*.pdb' -Recurse -Force } }
|
|
|
|
Get-Childitem -Path (Join-Path $BuildDir qtbase plugins) | `
|
|
|
|
ForEach-Object { if ($_ -is [System.IO.DirectoryInfo] -or $_.Name -like '*.pdb') { Copy-Item -Path $_.FullName -Destination (Join-Path $PrefixDir plugins) -Filter '*.pdb' -Recurse -Force } }
|
|
|
|
}
|