Qt 5.13.2版本静态库编译

本文介绍如何使用MSVC编译Qt 5.13.2版本的静态库.

1. 下载qt-everywhere-src-5.13.2

Qt离线下载地址:http://download.qt.io/archive/qt/
下载完成之后,解压到D:\Qt-5.13.2\qt-everywhere-src-5.13.2目录。

2. 配置环境变量

将如下内容保存到qtvars.cmd文件:

REM Set up \Microsoft Visual Studio 2017, where <arch> is \c amd64, \c x86, etc.
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
SET _ROOT=D:\Qt-5.13.2\qt-everywhere-src-5.13.2
SET PATH=%_ROOT%\qtbase;%_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=

以管理员权限打开命令提示符,运行qtvars.cmd文件,运行完之后,不要关闭命令提示符,后面的命令都要在该命令提示符下完成。

3. configure命令

在命令行中进入D:\Qt-5.13.2\qt-everywhere-src-5.13.2目录,执行如下configure命令:

configure -prefix D:\Qt-5.13.2\msvc2017_x86_static -static -static-runtime -debug-and-release -platform win32-msvc -opensource -confirm-license -force-debug-info -strip -qt-harfbuzz -qt-freetype -qt-zlib -qt-libpng -qt-libjpeg -qt-pcre -nomake examples -nomake tests -no-dbus -skip qtwebengine -openssl-linked -no-opengl -I C:\OpenSSL-Win32\include -L C:\OpenSSL-Win32\lib 

关于configure各个参数的含义可以查看帮助文档:configure --help

C:\OpenSSL-Win32中存放OpenSSL的头文件和静态库文件,目录结构如下:

C:\OpenSSL-Win32\
├─include
│  └─openssl
│          aes.h
│          asn1.h
│          .......
│          .......
└─lib
        libcrypto.lib
        libssl.lib

4. 编译、安装

configure完成以后,使用nmake命令编译,最后使用nmake install命令将生成文件安装到D:\Qt-5.13.2\msvc2017_x86_static目录。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

china_jeffery

你的鼓励是我前进的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值