Add section about statically building Qt

This commit is contained in:
BlackMark 2020-06-24 00:15:13 +02:00
parent ac05e30bfe
commit 78c4381026

View File

@ -14,7 +14,7 @@
Open the `sln` and build.
#### Deployment steps
#### Deployment steps for shared library
The example here is for deploying an x64 Release build, but other build work analogously.
@ -27,6 +27,35 @@ Start a `x64 Native Tools Command Prompt for VS 2019`:
> windeployqt --no-system-d3d-compiler ..\x64\Release\AdaptiveBrightness.exe
```
#### Deployment steps for statically linked library
Qt does not provide a statically built library, so this has to be built by hand. The Qt installer for Windows also installs the Qt sources which can be used to build the static library.
The following batch script sets up the build environment for an x64 build:
```batch
REM Set up Microsoft Visual Studio 2017, where <arch> is amd64, x86, etc.
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
SET _ROOT=%QTDIR%Src_x64
SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
REM Uncomment the below line when using a git checkout of the source repository
REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
SET _ROOT=
```
Then navigate to the source directory and configure the build system:
```console
> configure -opensource -confirm-license -nomake examples -nomake tests -static -static-runtime -debug-and-release -mp -prefix %QTDIR%\msvc2019_64_static
```
And build and install:
```console
> nmake
> nmake install
```
### Linux
#### Prerequisites