summaryrefslogtreecommitdiffstats
path: root/Utilities/Release
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-05-18 16:34:52 (GMT)
committerBrad King <brad.king@kitware.com>2022-05-19 19:25:54 (GMT)
commitdb48074d58a0cb76f63c1be88f01943ccd3f6c47 (patch)
treef69327f37a96e5e297a260dc3d2f6a609b7f9a32 /Utilities/Release
parent9daa244e9904e3d80afa149c927a01413e2a6cd0 (diff)
downloadCMake-db48074d58a0cb76f63c1be88f01943ccd3f6c47.zip
CMake-db48074d58a0cb76f63c1be88f01943ccd3f6c47.tar.gz
CMake-db48074d58a0cb76f63c1be88f01943ccd3f6c47.tar.bz2
Utilities/Release: Add script to build Qt 5.12.1 Windows binaries
These may be used to build CMake binaries for Windows `x86_64` and `i386`. Qt 5.12.1 supports Windows 7. Port the logic from `Utilities/Release/win/x86/deps/Dockerfile` and its helper scripts.
Diffstat (limited to 'Utilities/Release')
-rw-r--r--Utilities/Release/README.rst6
-rw-r--r--Utilities/Release/win/qt-5.12.1-win-x86-msvc-install.patch26
-rwxr-xr-xUtilities/Release/win/qt-5.12.1-win-x86-msvc.ps1118
3 files changed, 150 insertions, 0 deletions
diff --git a/Utilities/Release/README.rst b/Utilities/Release/README.rst
index dfaf831..770b579 100644
--- a/Utilities/Release/README.rst
+++ b/Utilities/Release/README.rst
@@ -91,3 +91,9 @@ macOS
The ``macos/`` directory contains scripts used to produce dependencies
for building CMake binaries on macOS.
+
+Windows
+-------
+
+The ``win/`` directory contains scripts used to produce dependencies
+for building CMake binaries on Windows.
diff --git a/Utilities/Release/win/qt-5.12.1-win-x86-msvc-install.patch b/Utilities/Release/win/qt-5.12.1-win-x86-msvc-install.patch
new file mode 100644
index 0000000..39a649e
--- /dev/null
+++ b/Utilities/Release/win/qt-5.12.1-win-x86-msvc-install.patch
@@ -0,0 +1,26 @@
+diff --git a/lib/cmake/Qt5Core/Qt5CoreConfig.cmake b/lib/cmake/Qt5Core/Qt5CoreConfig.cmake
+index 04ec302..75d5596 100644
+--- a/lib/cmake/Qt5Core/Qt5CoreConfig.cmake
++++ b/lib/cmake/Qt5Core/Qt5CoreConfig.cmake
+@@ -118,7 +118,7 @@ if (NOT TARGET Qt5::Core)
+ list(REMOVE_DUPLICATES Qt5Core_COMPILE_DEFINITIONS)
+ list(REMOVE_DUPLICATES Qt5Core_EXECUTABLE_COMPILE_FLAGS)
+
+- set(_Qt5Core_LIB_DEPENDENCIES "")
++ set(_Qt5Core_LIB_DEPENDENCIES "${_qt5Core_install_prefix}/lib/qtpcre2.lib;netapi32.lib;version.lib")
+
+
+ add_library(Qt5::Core STATIC IMPORTED)
+diff --git a/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake b/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake
+index a07b953..2e07371 100644
+--- a/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake
++++ b/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake
+@@ -118,7 +118,7 @@ if (NOT TARGET Qt5::Widgets)
+ list(REMOVE_DUPLICATES Qt5Widgets_COMPILE_DEFINITIONS)
+ list(REMOVE_DUPLICATES Qt5Widgets_EXECUTABLE_COMPILE_FLAGS)
+
+- set(_Qt5Widgets_LIB_DEPENDENCIES "Qt5::Gui;Qt5::Core")
++ set(_Qt5Widgets_LIB_DEPENDENCIES "Qt5::Gui;Qt5::Core;dwmapi.lib;uxtheme.lib")
+
+
+ add_library(Qt5::Widgets STATIC IMPORTED)
diff --git a/Utilities/Release/win/qt-5.12.1-win-x86-msvc.ps1 b/Utilities/Release/win/qt-5.12.1-win-x86-msvc.ps1
new file mode 100755
index 0000000..d9e9617
--- /dev/null
+++ b/Utilities/Release/win/qt-5.12.1-win-x86-msvc.ps1
@@ -0,0 +1,118 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+# Run this script on a Windows host to generate Qt binaries.
+# Set the PATH environment variable to contain the locations of cmake and git.
+
+param (
+ [string]$cmake = 'cmake',
+ [string]$git = 'git',
+ [switch]$trace
+)
+
+if ($trace -eq $true) {
+ Set-PSDebug -Trace 1
+}
+
+$ErrorActionPreference = 'Stop'
+$ProgressPreference = 'SilentlyContinue'
+
+if ($env:VSCMD_ARG_TGT_ARCH -eq "x64") {
+ $arch = "x86_64";
+} elseif ($env:VSCMD_ARG_TGT_ARCH -eq "x86") {
+ $arch = "i386";
+} else {
+ Write-Host "VSCMD_ARG_TGT_ARCH env var not recognized. Run this from a Visual Studio Command Prompt."
+ exit 1
+}
+
+if ($env:VCToolsVersion -match '^(?<version>[0-9][0-9]\.[0-9])') {
+ $toolset = "msvc_v" + $Matches.version -replace '\.', ''
+} else {
+ Write-Host "VCToolsVersion env var not set. Run this from a Visual Studio Command Prompt."
+}
+
+$srcname = "qt-everywhere-src-5.12.1"
+$pkgname = "qt-5.12.1-win-$arch-$toolset-1"
+$topdir = $pwd.Path
+$srcdir = Join-Path $topdir $srcname
+$blddir = Join-Path $topdir "$pkgname-build"
+$prefix = Join-Path $topdir $pkgname
+
+# JOM
+if ( -not (Test-Path -Path "jom")) {
+ Invoke-WebRequest -Uri "http://download.qt-project.org/official_releases/jom/unstable-jom.zip" -OutFile jom.zip
+ if ($(Get-FileHash "jom.zip").Hash -ne '128fdd846fe24f8594eed37d1d8929a0ea78df563537c0c1b1861a635013fff8') {
+ exit 1
+ }
+ Expand-Archive -Path jom.zip -DestinationPath jom
+ Remove-Item jom.zip
+}
+$jom = "$topdir\jom\jom.exe"
+
+# Qt Source
+if ( -not (Test-Path -Path $srcdir)) {
+ Invoke-WebRequest -Uri "https://download.qt.io/official_releases/qt/5.12/5.12.1/single/qt-everywhere-src-5.12.1.tar.xz" -OutFile qt.tar.xz
+ if ($(Get-FileHash "qt.tar.xz").Hash -ne 'caffbd625c7bc10ff8c5c7a27dbc7d84fa4de146975c0e1ffe904b514ccd6da4') {
+ exit 1
+ }
+ & $cmake -E tar xvf qt.tar.xz
+ Remove-Item qt.tar.xz
+}
+
+# Build Qt
+if ( -not (Test-Path -Path $blddir)) {
+ New-Item -ItemType Directory -Path $blddir
+ Set-Location -Path "$blddir"
+ & ..\$srcname\configure.bat `
+ -prefix $prefix `
+ -static `
+ -static-runtime `
+ -release `
+ -opensource -confirm-license `
+ -platform win32-msvc `
+ -mp `
+ -gui `
+ -widgets `
+ -qt-pcre `
+ -qt-zlib `
+ -qt-libpng `
+ -qt-libjpeg `
+ -no-gif `
+ -no-icu `
+ -no-pch `
+ -no-angle `
+ -no-opengl `
+ -no-dbus `
+ -no-harfbuzz `
+ -no-accessibility `
+ -skip declarative `
+ -skip multimedia `
+ -skip qtcanvas3d `
+ -skip qtconnectivity `
+ -skip qtdeclarative `
+ -skip qtlocation `
+ -skip qtmultimedia `
+ -skip qtsensors `
+ -skip qtserialport `
+ -skip qtsvg `
+ -skip qtwayland `
+ -skip qtwebchannel `
+ -skip qtwebengine `
+ -skip qtwebsockets `
+ -skip qtxmlpatterns `
+ -nomake examples -nomake tests
+ & $jom -J $env:NUMBER_OF_PROCESSORS
+}
+
+# Install Qt
+if ( -not (Test-Path -Path $prefix)) {
+ & $jom install
+ # Patch the installation.
+ Set-Location -Path $prefix
+ & $git apply -v (Join-Path $PSScriptRoot qt-5.12.1-win-x86-msvc-install.patch)
+}
+
+# Package Qt
+Set-Location -Path $topdir
+& $cmake -E tar cf "$pkgname.zip" "--format=zip" "$pkgname"