zoukankan      html  css  js  c++  java
  • Qt configure 参数不完全说明

    只需要加个 -fast参数就ok了。其他参数视自己情况而定,比如你不需要qt3支持可以添加-no-qt3support,或者不需要webkit插件 -no-webkit
    配置参数选项:

    前面是*号的表示默认参数. +号表示该功能要求被评估,评估成功后才能被接受.

       -release ........... 调试关闭.没有调试库,自己的项目只能发布,不能调试(没有调试库的缘故),如果你硬要编译debug版本的话,会提示找不到xxxxxd.dll

    * -debug ............. 只有调试库,没有释放库,也就是说以后自己的项目只能调试,如果你硬要编译debug版本的话,会提示找不到xxxxx.dll

    + -debug-and-release . 编译后包含两种库。最好编译两种库

       -opensource ........ 编译开源版.

       -commercial ........ 编译商业版. 这两个参数一般不需指定,configure开始需要你选择版本。

       -developer-build ... 编译开发者选项。

    * -shared ............动态编译.

       -static ............ 静态链接库.貌似有插件不能用静态编译。

    * -no-fast ........... configure生成所有项目makefiles文件,并编译

       -fast .............. 只生成库目录及子目录下的项目的makefiles文件.

       -no-exceptions ..... 关闭异常支持

    * -exceptions ........ 开启异常支持.

       -no-accessibility .. 关闭对windows active控件支持.

    * -accessibility .....对windows active控件支持.

       -no-stl ............ 无c++标准库支持

    * -stl ............... 有标准库支持

    尖括号在blogger出问题了。。。。。

       -no-sql- ... Disable SQL entirely, by default none are turned on.

       -qt-sql- ... Enable a SQL in the Qt Library.

       -plugin-sql-   Enable SQL as a plugin to be linked to at runtime.

       Available values for :

       mysql

       psql

       oci

       odbc

       tds

       db2

    + sqlite

       sqlite2

       ibase

       (drivers marked with a '+' have been detected as available on this system)

       -system-sqlite ..... Use sqlite from the operating system.

       -no-qt3support ..... 不提供对qt3函数支持

       -no-opengl ......... 不提供OpenGL函数支持

       -platform ... The operating system and compiler you are building on.

       (default %QMAKESPEC%)

       -xplatform .. The operating system and compiler you are cross compiling to.

       See the README file for a list of supported operating systems and compilers.

       -qtnamespace Wraps all Qt library code in 'namespace name {...}

       -D ........ Add an explicit define to the preprocessor.

       -I ... Add an explicit include path.

       -L ... Add an explicit library path.

       -l ... Add an explicit library name, residing in a librarypath.

       -graphicssystem Specify which graphicssystem should be used.

       Available values for :

    * raster - Software rasterizer

       opengl - Using OpenGL accelleration, experimental!

       -help, -h, -? ...... Display this information.

    第三方库

       -qt-zlib ........... 使用zlib绑定到qt.

    + -system-zlib ....... 使用操作系统的zlib

       见 http://www.gzip.org/zlib

       -no-gif ............ 不编译gif文件读取支持插件

    + -qt-gif ............ 编译gif文件读取支持插件

       参见 src/plugins/imageformats/gif/qgifhandler.h

       -no-libpng ......... 不编译PNG支持插件.

       -qt-libpng ......... 编译PNG支持插件.

    + -system-libpng ..... 使用系统libpng库

       见 http://www.libpng.org/pub/png

       -no-libmng ......... 不编译MNG支持插件.

       -qt-libmng ......... 编译MNG支持插件.

    + -system-libmng ..... 使用系统的mng库

       参见 http://www.libmng.com

       -no-libtiff ........ 不编译tiff支持插件.

       -qt-libtiff ........ 编译tiff支持插件.

    + -system-libtiff .... 使用系统的libtiff库

       见 http://www.libtiff.org

       -no-libjpeg ........ 不编译jpeg支持插件库

       -qt-libjpeg ........ 编译jpeg支持插件库

    + -system-libjpeg .... 使用系统的jpeg支持库

       见 http://www.ijg.org

    以下参数仅对qt for windows有效

       -no-dsp ............ 不生成 VC++ .dsp 文档.

    * -dsp ...............生成 VC++ .dsp文档, 需要有平台标识符"win32-msvc".注意 qt4开始就不支持vc6.0了所以这两个参数无效。

       -no-vcproj ......... 不生成 VC++ .vcproj 文档

    * -vcproj ............ 生成 VC++ .vcproj 文档, 需要平台标识符"win32-msvc.net".也就是vs2003以上的编译环境

       -no-incredibuild-xge Do not add IncrediBuild XGE distribution commands to custom build steps.

    + -incredibuild-xge .. Add IncrediBuild XGE distribution commands to custom build steps. This will distribute MOC and UIC steps, and other custom buildsteps which are added to the INCREDIBUILD_XGE variable.

       (The IncrediBuild distribution commands are only added to Visual Studio projects)

       -no-plugin-manifests 插件不嵌入manifests.

    * -plugin-manifests .. 插件嵌入manifests.

       -no-qmake .......... 不编译qmake

    * -qmake ............. 编译 qmake. 不建议 不编译qmake

       -dont-process ...... 不生成makefiles和project文档. 比 -no-fast 参数优先级更高

    * -process ........... 生成makefiles和project文档.

       -no-rtti ........... 不编译运行时类型信息。

    * -rtti .............. 编译运行时类型信息。

    //下面是对指令的支持,不解释了

       -no-mmx ............ Do not compile with use of MMX instructions

    + -mmx ............... Compile with use of MMX instructions

       -no-3dnow .......... Do not compile

    with use of 3DNOW instructions

    + -3dnow ............. Compile with use of 3DNOW instructions

       -no-sse ............ Do not compile with use of SSE instructions

    + -sse ............... Compile with use of SSE instructions

       -no-sse2 ........... Do not compile with use of SSE2 instructions

    + -sse2 .............. Compile with use of SSE2 instructions

    + -direct3d .......... 将Direct3D支持编译进来。检测不到direct3d sdk 就不支持

       -no-openssl ........ Do not compile in OpenSSL support

    + -openssl ........... Compile in run-time OpenSSL support

       -openssl-linked .... Compile in linked OpenSSL support

       -no-dbus ........... Do not compile in D-Bus support

    + -dbus .............. Compile in D-Bus support and load libdbus-1 dynamically

       -dbus-linked ....... Compile in D-Bus support and link to libdbus-1

       -no-phonon ......... 不将 Phonon 模块 编译进来

    + -phonon ............ 将 Phonon 模块 编译进来   (若使用的规范的c++编译器则会自动编译Phonon模块)

       -no-phonon-backend . Do not compile the platform-specific Phonon backend-plu

    gin

    * -phonon-backend .... Compile in the platform-specific Phonon backend-plugin

       -no-webkit ......... 不将webkit模块编译进来,编译webkit非常耗时间。

    + -webkit ............ 将webkit模块编译进来 (若使用的规范的c++编译器则会自动编译WebKit模块)

       -no-scripttools .... Do not build the QtScriptTools module.

    * -scripttools ....... Build the QtScriptTools module.

       -arch ....... 外观样式.

       有以下几种 :

    * windows

       windowsce

       boundschecker

       generic

       -no-style-尖括号里包含上面的样式。

    编译一次Qt要耗费太多的时间,常常是越着急用它,编起来越慢。其实通过很简单的几招可以帮你节省编译的时间。下面就一一道来:

    第一招,编译之前确定哪些功能是不必要的,对编译树进行简单裁剪。
    比如最常见的,像demos, examples,虽然很有参考价值,但完全可以放在后面用到的时候再单独编译小工程,这样可以节省不少时间。经过实践,最简单的方法是修改configure文件,在该文件中有个指定编译目录的字段:
    QT_DEFAULT_BUILD_PARTS=”libs tools examples demos docs translations”
    可以把examples、demos和docs从这里去掉,但要注意,别的可不能随便去掉。
    如果在后面的使用中发现有些小工程需要编译了,可以采用一般编译Qt程序的方法,即用Qt安装目录bin下的qmake来生成Makefile,同样可以编译和测试例子代码,一点也不影响使用。

    第二招,裁剪Qt模块。
    Qt从4版本开始采用了模块化的形式,将独立的功能封装在独立的库里,所以可以很简单的去掉一些不需要的库,这样也能节省编译时间和对硬盘空间的占用。 Qt的configure配置提供了一些设置模块的方法,如它支持-no-svg和-no-webkit,通过configure的时候加这些选项就可以 去掉这部分支持。相应的还有很多小的功能可以通过configure参数的形式配置,具体的参考configure –help的输出。在查看configure帮助的时候特别要注意加*号的内容,也就是Qt默认的configure选项,有的时候默认选项可不一定是讨 人喜欢的哦。
    Qt桌面版本默认会尽量多的编译feature进去,这样有一定的好处,就是用户可以用到所有的Qt功能,但坏处也很明显,那就是编译出来的Qt超级大, 特别是编译debug版本,基本上要占1到2G的空间,所以个人感觉研究一下configure的选项还是很有必要的。另外, 默认状况下有些插件是不会编译的,比如数据库插件,往往需要用户自己根据需要编译,这一点也要注意。

    第三招,针对嵌入式版本的配置。
    Qt的嵌入式版本本身就支持feature裁剪,我们可以充分利用这一特性让Qt库尽量变小。具体的做法是要做一个自己的 qconfig-[myconfig].h特性文件,该文件中定义你要去掉Qt中的哪些feature。在configure的时候加“-qconfig myconfig” 选项, Qt就会根据你给出的配置文件来编译,以达到裁剪的目的。这里要强调一下,这种裁剪方式只适用于嵌入式版本。这里的myconfig可以用任何你喜欢的名 字来代替。
    在qt的代码中已经给出了一些qconfig头文件的例子,默认编译采用full config也就是
    不裁剪任何feature。所有Qt预定义好的qconfig文件,可以在src/corelib/global/下找到,包括qconfig- minimal.h, qconfig-small.h, qconfig.medium.h,qconfig-large.h和qconfig-dist.h,也就是从裁剪量由多到少都有据可依。如果要添加你自 己的配置文件,要在src/corelib/global下建立一个形如qconfig-xxx.h的文件,这个xxx也就是你要在configure的 时候传入的qconfig参数。笔者测试使用的Qt版本是4.4.1,这个版本的build system有个小毛病,就是如果你指定的qconfig参数实际上没有qconfig-xxx.h文件对应, build不会停止,它只会给出一个不起眼的提示,编译过程会继续, 这一点挺让人费解的。而且这种情况下Qt编译使用的配置基本上和fullconfig相同,鉴于它的让人迷惑的举动,个人觉得有必要提醒大家一下,使用自 定义qconfig的时候一定要确定配置文件放对了位置,而且qconfig参数给的正确。
    一般我们的建议是在桌面上测试阶段编译一个full的版本,再根据你的项目使用Qt feature的情况总结哪些可去掉的feature。 feature之间有千丝万缕的依赖关系,这个问题也是困扰很多人的难点所在。具体的依赖可以查阅src/corelib/global /qfeatures.h和src/corelib/global/qfeatures.txt(描述依赖关系的文档)。另外,Qt里还提供了一个可视化 的配置依赖的工具,叫做qconfig,在QTDIR/tools/qconfig目录。该工具需要基于Qt桌面版本编译。如在我的linux系统下可以 用下面的命令来编译:
    cdqtembeddedlinuxcommercial4.4.1/tools/qconfigcdqt−embedded−linux−commercial−4.4.1/tools/qconfig /usr/local/Trolltech/Qt-4.4.3/bin/qmake
    $ make
    编译成功后运行./qconfig,初始要打开qfeatures.txt. Qconfig读取该文件生成一个树状图,该图很清楚的显示出feature之间的依赖关系。如下图所示,如果你去掉了LINEEDIT这个 feature,用到该控件的combobox也就不能继续使用了。有了这个工具裁剪Qt变得简洁直观,方便了很多。

    选定了你要去掉的feature后点击菜单File->Save As..会弹出保存文件的页面,文件名字应该定义成qconfig-xxx.h的形式,这样你在configure的时候就可以传入相应的qconfig 参数了。你还可以通过选择File->Open打开现有的qconfig-xxx.h文件,通过修改已经有的文件更快的编辑配置。
    根据笔者测试,未经裁剪的qte4.4.1编译出来为:
    libQtCore.so是2.6M
    libQtGui.so是9.5M
    如果用small来编译,就能缩小为:
    libQtCore.so是2.0M
    libQtGui.so是5.7M
    差异还是比较明显的。

    http://www.cnblogs.com/elect-fans/archive/2012/03/28/2420647.html

  • 相关阅读:
    赠与今年的大学毕业生(胡适先生30年代的文章,仍不过时)
    统一管理磁盘上的开源代码
    生成sqlite导入库的做法
    提高二维矢量绘图效率之一般做法
    boost库命名规则的优点
    如何把腾讯微博挂到CSDN博客上
    fatal error C1902 Program database manager mismatch; please check your installation问题的解决
    智能指针变量做函数参数的一个值得注意的地方
    PC会消亡吗?
    软件制造问题的微软答案
  • 原文地址:https://www.cnblogs.com/findumars/p/5574386.html
Copyright © 2011-2022 走看看