Qt精简编译方法总结

别再折腾了!Win10下QT5.14.2与MSVC2017编译器环境一键配置保姆级教程 本文提供Win10下QT5.14.2与MSVC2017开发环境的一键配置保姆级教程,帮助开发者避开常见陷阱,实现快速配置。详细介绍了组件安装、环境配置、套件设置及性能优化等关键步骤,确保开发环境稳定高效运行。 阅读详情

Qt如果采取默认编译安装,一般都要占用上G的空间。当初自己不想涉及Qt的一个原因,就是嫌它太臃肿了。近期通过反复对比,发现Qt还是有着很大潜力的,于是,决定好好学习一下,就有了这篇精简编译的笔记。

 

修改编译选项(mkspecs/win32-msvc2010/qmake.conf):
QMAKE_CFLAGS_RELEASE = -O2 -Os -MD
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -Os -MD -Zi

修改链接选项:
QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO /OPT:REF /OPT:ICF
QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /INCREMENTAL:NO /DEBUG /OPT:REF /OPT:ICF

配置:
configure -prefix D:/DengYC/LoveDEV/qt -debug-and-release -platform win32-msvc2010 -fast -shared -opensource -no-qt3support -nomake demos -nomake examples -nomake translations

编译安装(先拷贝目录mkspecs至D:/DengYC/LoveDEV/qt):
nmake && nmake install

清理:
1. 清除重复的DLL(将qt/lib目录中的DLL全部删除)
2. 清除多余的PDB调试文件(搜索qt目录*.pdb,删除全部pdb文件)
3. 清除多余的帮助文档(首先要运行qt/bin/assistant.exe,以便更新qt/doc/pch;然后删除qt/doc/src和qt/doc/html)

经过清理,将Qt从920MB精简到231MB,务必注意:不可再改变Qt所在路径!!

 

版权所有,如需转载,敬请注明出处!

QT开发必备:5分钟搞定MSVC2017编译器安装(无需Visual Studio) 本文提供QT开发中独立安装MSVC2017编译器的精简方案,无需安装完整的Visual Studio,节省磁盘空间并保持环境纯净。详细介绍了组件下载、安装配置及与QT Creator的集成步骤,帮助开发者快速搭建高效的QT开发环境。 阅读详情

相关推荐

QT+opencv源码编译

欢迎入群共同学习交流 时间记录:2024/1/20QT5.12.7+cmake3.22.0+opencv4.5.4(1)下载opencv源码,然后安装,opencv的安装即对源码的解压过程,解压后的文件目录如下 (2)opencv安装解压后的目录介绍:(3)配置环境变量,将cmake和QT的mingw32编译器的路径添加到Path环境变量中(注意:QT两个路径) (4)QT的两个路径,一个是gcc和g++所在的路径,一个是qmake所在的路径 (5)打开cmake-gui界面,"Where is the

KINO32的博客 3741

Qt5 怎么最小化编译,只编译 qtbase

在 Qt 源码目录下运行下面语句,再按需裁减 ls -al | grep ^d | grep qt | awk '{ printf "-skip %s \\\n" , $9}' -skip qt3d \ -skip qtactiveqt \ -skip qtandroidextras \ -skip qtbase \ -skip qtcanvas3d \ -skip qtcharts \ -skip qtconnectivity \ -skip qtdatavis3d \ -skip qtdecl

jhkwei的专栏 2026

QT——C++开启-O编译优化

QMAKE_CXXFLAGS_RELEASE -= -O2 # O2优化

Williamcsj的博客 3007

QT打包成一个exe,并且将安装包打包到最小

在使用QT的Debug生成exe,然后对exe输入命令,重新打包为一个exe,发现exe竟然要500多M,整个程序也仅仅只有14M而已,发现有大量的非必要文件,故现在使用以下方法进行打包,目前是打包最小的一种方式。 1、使用Release编译出exe文件 首先选择构建套件下面的Release 然后重新编译运行打包,在程序目录下就能看到 build-包名-Desktop_Qt_5_12_9_MinGW_64_bit-Release 将其exe复制到一个新建文件夹中,然后打开 输入命令 cd /d ex

qq_40282557的博客 5953

开发环境 之六 Qt/Qt Lite 自编译详解(VS/MinGW/...)

Qt/Qt Lite 自编译详解 写在前面   现在,网上关于Qt编译的文章数不胜数。写这篇文章仅仅是对于自我学习的一个记录。主要是对实际学习中遇到的一些棘手问题做个备忘录。   编译工具使用 VS2017 和 MinGW5.3.0 为例,来进行说明。 Qt Configure   Qt 的配置系统可以说相当复杂。看完源码中的各...

技术干货 6669

Qt极限精简静态编译,生成的EXE只有2.2M(未压缩)

极限静态精简编译的Qt,使用VC6编译器,编译生成的EXE大小只有2.2M未压缩,Qt4.5.3的功能已基本够用,可用以制作小程序,安装包等

Qt configure 参数不完全说明 以及 精简系统 减少编译时间的一些方法

<br />最主要的简化手段应该是不编译examples和demos,这两个库里有将近300个程序,编译起来是沉重的负担,另外,调试阶段的话只开debug选项,可以缩短一半以上的编译时间。<br /> ./configure –nomake demos –nomake examples -debug -no-qt3support<br /><br /> 另外一种方法是直接修改pro文件:<br /> This is a part of projects.pro in Qt root

yacper的专栏 2469

CANoe_Demo_下载以及安装教程

CANoe Demo下载安装流程

Jar_Lee的博客 1万+

Qt极限精简静态编译的秘密,生成的EXE只有2.2M(未压缩)

Qt极限精简静态编译

knight 9951

物流系统集成实战:从零开始用Java对接国际快递(DHL/FedEx/UPS)

本文详细介绍了如何使用Java技术栈对接DHL、FedEx和UPS三大国际快递巨头的API,构建高效、稳定的物流集成解决方案。内容涵盖认证机制、报文标准、多语言支持等关键点,并提供实战代码示例和最佳实践,帮助开发者快速实现国际快递系统集成。

efc1234567的博客 693

维护测试监控LLM应用

LangFuse: 开源 + SaaS(免费/付费),LangSmith 平替,可集成 LangChain 也可直接对接 OpenAI API;LangSmith: LangChain 的官方平台,SaaS 服务(免费/付费),非开源,企业版支持私有部署;调试 Prompt 的 Playground测试/验证系统的相关指标数据集管理各种指标监控与统计:访问量、响应时长、Token 费等等。

SunnyRivers 1773

终极精简编译Qt5,精简OpenGL,QMainWindow,ICU,WebKit等

Qt5完整编译太大了,项目里有些东西根本不需要,所以动手精简编译。 工具:VC2013,Qt5.2.1(5.3,5.4)均可。 首先 先精简ICU,使用ICU4.6版本,高版本只会占用更多空间 icu数据选择 gb18030即可。本人编译完后icudt46.dll为973K,icuin46.dll为1.04M,icuuc46.dll为884K 后面提供下载地址 第一步:

knight 8526

Chronos时间序列预测实战:从零开始微调你的第一个大语言模型(附完整代码)

本文提供了一份详细的Chronos时间序列预测大语言模型微调实战指南。从环境搭建、数据预处理到模型配置与训练,手把手教你如何利用自己的数据微调Chronos模型,并完成评估与部署,助你快速掌握这一前沿技术。

zzz56的博客 300

QT库剪裁

编译一次Qt要耗费太多的时间,其实通过很简单的几招可以帮你节省编译的时间。第一招,编译之前确定哪些功能是不必要的,对编译树进行简单裁剪。比如最常见的,像demos, examples,虽然很有参考价值,但完全可以放在后面用到的时候再单独编译小工程,这样可以节省不少时间。经过实践,最简单的方法是修改configure文件,在该文件中有个指定编译目录的字段:QT_DEFAULT_BUILD_PAR...

lanxinyuchs的专栏 262

T型三电平关管顺序要求

摘要: T型三电平拓扑中,IGBT关断必须遵循“外管先关、内管后关”的时序,否则易导致器件损坏。正常导通时,外管与内管共同分担电压;正确关断时,外管先关使电流经内管续流至中点,避免电压过冲;若内管先关,电流路径被强制切断,杂散电感引发高压尖峰击穿器件。这一时序本质是为电流提供低应力续流路径,需通过硬件或软件严格保障。

yun0804的博客 2369

拖动无标题栏的cef3窗口

拖动嵌入了cef3的无标题栏win32窗口,本质上就是拖动子窗口移动父窗口这么个事情,这个在自己创建窗口的程序上处理非常简单,cef封装较多,想修改的完善点步骤较多。         cef所用版本3.2623。         就用cefclient来做测试工程,首先建议在cefclient_win.cc的RunMain函数中的app = new ClientAppRenderer();前面

loveyong1990的专栏 6160

减少Qt编译时间暨简单Qt裁剪

原文链接:减少Qt编译时间暨简单Qt裁剪 编译一次Qt要耗费太多的时间,常常是越着急用它,编起来越慢。其实通过很简单的几招可以帮你节省编译的时间。下面就一一道来: 第一招,编译之前确定哪些功能是不必要的,对编译树进行简单裁剪。 比如最常见的,像demos, examples,虽然很有参考价值,但完全可以放在后面用到的时候再单独编译小工程,这样可以节省不少时间。经过实践,最简单的方法是修

Liuqz2009的专栏 1728

华为OD机试真题 新系统【Skill执行链完整性检测】

华为OD机试 新系统真题【Skill执行链完整性检测】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题【Skill执行链完整性检测】

qq_45776114的博客 762

告别DLL依赖:用QT Creator静态编译打包你的第一个独立EXE(Windows 10 + QT5.12.9实战)

本文详细介绍了如何在Windows 10环境下使用QT Creator 5.12.9进行静态编译,生成不依赖DLL的独立EXE文件。通过对比MSVC和MinGW编译器的优缺点,提供完整的配置步骤和实战演示,帮助开发者解决部署时的依赖问题,并分享优化文件体积的高级技巧。

330

YOLOv11改进缝合FasterBlock | 一种新型轻量化卷积结构C3k2的设计与实证:兼顾精度与速度的改进方法(附代码)

YOLO系列一直是目标检测领域的明星算法,凭借其实时性和准确性在众多应用中占据一席之地。随着YOLO版本的不断迭代,网络架构逐渐变得更为复杂,尤其是在卷积模块的设计上。本文将介绍如何利用FasterNet的FasterBlock创新,并通过二次创新C3k2提出一种全新的卷积结构。该结构旨在提高YOLOv11的计算效率和准确性,特别是在视觉任务中的表现。我们的创新在保证高精度的前提下,有效降低了计算量和内存需求,特别适合在资源受限的设备上运行。

一键难忘的博客 906

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

启动qt_Qt源码编译

Qt源码编译eryar@163.comKey words. Qt, 源码编译1.Introduction随着Qt版本升级,源码编译出来的库体积越来越大。如果只是用Qt来做GUI,Qt提供的预编译库中有很多很功能不会用到,所以如果自己从源码编译Qt,一是可以只使用自己程序用到的功能,使自己发布程序的体积尽量小;还有如果对GUI开发感兴趣,就可以自己对源码进行Debug。本文记录一下从源码编...

weixin_30699957的博客 268

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

ubuntu qt 我想让我的程序编译后更小,没有用的链接不用链接到程序里,要如何做

ubuntu qt 我想让我的程序编译后更小,没有用的链接不用链接到程序里,要如何做

xie__jin__cheng的博客 579

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

QT交叉编译

本文总结了在 Ubuntu(Linux x86_64)主机上交叉编译 Qt5.12.3 到 aarch64-linux-gnu(ARM64)平台的完整步骤,涵盖环境准备、工具链校验、源码下载、影子编译目录创建、mkspec 修改、configure 配置、编译安装与成果验证,并补充了 Windows 本地交叉编译的流程说明,帮助读者在 Linux 或 Windows 上构建可直接用于 ARM64 开发板的 Qt 套件。

weixin_52938172的博客 217

从30分钟到8分钟:我是如何精简RV1126 Buildroot配置,让编译飞起来的

本文详细介绍了如何精简RV1126 Buildroot配置,将编译时间从30分钟缩短至8分钟。通过分析默认配置问题、创建精简板级配置文件、优化依赖关系,并保留WiFi、蓝牙和Qt等核心功能,显著提升了开发效率。文章还提供了RV1126 SDK的特殊处理技巧和常见问题解决方案,适合嵌入式开发者参考。

weixin_30892763的博客 329
上一篇: Qt Creator编译方法总结(Windows平台)
下一篇: 用CMake写一个简单的交叉编译测试工程
「已注销」
博客等级 码龄19年 1013粉丝 6原创
评论 6
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值