Skip to content

Commit c77f7d9

Browse files
author
Martin Rotter
committed
static
1 parent 28bdcc6 commit c77f7d9

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

msvc2019-build6.2.2-static.ps1

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# 1. Start Visual Studio x64 Native Tools command line.
2+
# 2. Run powershell.exe from Native Tools cmd.
3+
# 3. cd to path of qt5-minimalistic-builds repo.
4+
5+
$version_base = "6.2"
6+
$version = "6.2.2"
7+
8+
$qt_sources_url = "https://download.qt.io/official_releases/qt/" + $version_base + "/" + $version + "/single/qt-everywhere-src-" + $version + ".zip"
9+
$qt_archive_file = $pwd.Path + "\qt-" + $version + ".zip"
10+
$qt_src_base_folder = $pwd.Path + "\qt-everywhere-src-" + $version
11+
12+
$tools_folder = $pwd.Path + "\tools\"
13+
$type = "static"
14+
$prefix_base_folder = "qt-" + $version + "-" + $type + "-msvc2019-x86_64"
15+
$prefix_folder = $pwd.Path + "\" + $prefix_base_folder
16+
$build_folder = $pwd.Path + "\bld"
17+
18+
# OpenSSL
19+
# 1.1.1l
20+
# Install steps:
21+
# 1. Download, unpack openssl to folder "C:\openssl".
22+
# 2. Install system-wide perl, nasm.
23+
# 3. Run MVSC command prompt and navigate to openssl folder.
24+
# 4. Run "perl Configure VC-WIN64A --prefix=c:\openssl\bin --openssldir=c:\openssl\bin" and then run "nmake" and "make install".
25+
$openssl_base_folder = "c:\Programy\OpenSSL\bin-static"
26+
$openssl_include_folder = $openssl_base_folder + "\include"
27+
$openssl_libs_folder = $openssl_base_folder + "\lib"
28+
$openssl_bin_folder = $openssl_base_folder + "\bin"
29+
30+
# SQL.
31+
$mysql_include_folder = "c:\Programy\MariaDB\include\mysql"
32+
$mysql_lib_folder = "c:\Programy\MariaDB\lib"
33+
$mysql_lib = "$mysql_lib_folder\mariadbclient.lib"
34+
$zlib_base_folder = "c:\Programy\zlib\"
35+
36+
# Download Qt sources, unpack.
37+
$ProgressPreference = 'SilentlyContinue'
38+
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
39+
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
40+
41+
Invoke-WebRequest -Uri $qt_sources_url -OutFile $qt_archive_file
42+
& "$tools_folder\7za.exe" x $qt_archive_file
43+
44+
# Configure.
45+
mkdir $build_folder
46+
cd $build_folder
47+
48+
$env:ZLIB_ROOT = "$zlib_base_folder"
49+
$env:OPENSSL_LIBS = "-lUser32 -lAdvapi32 -lGdi32 -llibcrypto -llibssl"
50+
51+
& "$qt_src_base_folder\configure.bat" -debug-and-release -opensource -confirm-license -opengl desktop -no-dbus -no-icu -no-fontconfig -nomake examples -nomake tests -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtlocation -skip qtnetworkauth -skip qtpurchasing -skip qtremoteobjects -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtquick3d -skip qtvirtualkeyboard -skip qtwebview -skip qtscript -system-zlib -optimize-size -static -static-runtime -ltcg -prefix $prefix_folder -openssl-linked -- -DOPENSSL_ROOT_DIR="$openssl_base_folder" -DOPENSSL_INCLUDE_DIR="$openssl_include_folder" -DMySQL_INCLUDE_DIR="$mysql_include_folder" -DMySQL_LIBRARY="$mysql_lib"
52+
53+
# Compile.
54+
cmake --build .
55+
cmake --install . --config Release
56+
cmake --install . --config Debug
57+
58+
# Copy libs.
59+
cp "$openssl_bin_folder\*.exe" "$prefix_folder\bin\"
60+
cp "$openssl_bin_folder\*.pdb" "$prefix_folder\bin\"
61+
cp "$openssl_libs_folder\*" "$prefix_folder\lib\" -Recurse
62+
cp "$openssl_include_folder\openssl" "$prefix_folder\include\" -Recurse
63+
64+
cp "$mysql_lib_folder\mariadbclient.lib" "$prefix_folder\lib\"
65+
cp "$zlib_base_folder\zlib.lib" "$prefix_folder\lib\"
66+
67+
# Create final archive.
68+
& "$tools_folder\7za.exe" a -t7z "${prefix_base_folder}.7z" "$prefix_folder" -mmt -mx9

0 commit comments

Comments
 (0)