configure是一个命令行工具,用于配置Qt编译到指定平台。configure必须运行于Qt源码根目录。当运行configure时,编译源码使用的是所选工具链中的make工具。

一.源码目录、编译目录和安装目录

源码目录就是包含源码的目录。编译目录是包含Makefiles文件、object文件和其他中间文件的目录。安装目录是二进制文件和库文件安装的目录。

当编译目录和源码目录不一样时,称为影子编译(shadow build),比如说,Qt Creator默认是使用影子编译来编译工程的。这里也可以使用影子编译,方法就是新建一个目录,然后cd到该目录中运行configure,如下所示。

  1. mkdir ~/qt-build
  2. cd ~/qt-build
  3. ~/qt-source/configure

此时,configure时生成的Makefiles文件,以及编译时生成的中间文件都会拷贝到qt-build目录。不仅如此,通过影子编译,可以同时进行多个不同配置选项的编译过程,互不影响。
默认的安装目录和平台相关,但是在configure时,可以通过-prefix选项指定安装目录,比如./configure -prefix /opt/Qt-5.7。这样一来,在执行make install指令时,编译完成的bin、lib或者其他子目录就会拷贝到/opt/Qt-5.7目录中。

二.包含和排除Qt模块

通过configure,可以包含或排除指定的Qt模块。需要注意的是,许多模块依赖于其他的模块,不恰当的配置选项会导致依赖问题。

1.排除Qt模块

使用configure的-skip选项可以排除Qt模块,一般情况下模块名就是源码目录中对应的子目录名。有些子目录会包含多个模块,比如说qtconnectivity目录就包含了Qt NFC模块和Qt Bluetooth模块,排除这两个模块需要将-skip qtconnectivity作为配置参数,如下所示。

  1. ./configure -skip qtconnectivity

2.包含或排除特性
-feature-<feature> 和 -no-feature-<feature>选项用于包含和排除特性。可用的<feature>都被罗列在tbase/src/corelib/global/qfeatures.txt文件中。比如,要禁用accessibility特性,可用使用-no-feature-accessibility选项,如下所示。

  1. ./configure -no-feature-accessibility

三.第三方库

Qt源码中包含了一些第三方库,如果想使用Qt自带的第三方库,可用通过-qt配置;如果想使用系统中的第三方库,可用通过-system配置。下表中列出一些第三方库及其配置选项。

Library Name Bundled in Qt Installed in System
zlib -qt-zlib -system-zlib
libjpeg -qt-libjpeg -system-libjpeg
libpng -qt-libpng -system-libpng
xcb -qt-xcb -system-xcb
xkbcommon -qt-xkbcommon -system-xkbcommon
freetype -qt-freetype -system-freetype
PCRE -qt-pcre -system-pcre
HarfBuzz-NG -qt-harfbuzz -system-harfbuzz

当然,也可以禁用这些第三方库,用-no替换-qt就行,如下所示。

  1. ./configure -no-zlib -qt-libjpeg -qt-libpng -system-xcb

四.编译选项

-platform选项指定了目标平台和编译时使用的编译器,Qt支持的平台和编译器都在qtbase/mkspecs目录中。比如,在Ubuntu Linux系统中,Qt能被多种编译器编译,比如clang和g++,如下所示。

  1. ./configure -platform linux-clang
  2. ./configure -platform linux-g++
  3. ./configure -platform linux-g++-32

对于Windows系统,可以用MinGW或者Visual Studio工具链,如下所示。

  1. configure.bat -platform win32-g++
  2. configure.bat -platform win32-msvc2010

五.交叉编译选项

通用的选项如下所示。

-xplatform:指定目标平台,可用的xplatform与platform类似,也在qtbase/mkspecs目录中。

-device:指定特殊的设备或芯片,configure兼容的device在qtbase/mkspecs/devices目录中。

-device-option:设置额外的qmake参数,比如,-device-option CROSS_COMPILE=<path-to-toolchain>提供了特定设备交叉编译所需的环境变量。
六.Windows中使用OpenGL选项

在Windows中,Qt可以配置使用系统的OpenGL或者自带的ANGLE。默认情况下,Qt会配置使用ANGLE,ANGLE依赖于DirectX SDK。ANGLE使得依赖于OpenGL的Qt应用程序可以在没有安装OpenGL的机器上运行。

-opengl选项可以配置Qt使用目标机器上的OpenGL,如下所示。

  1. configure.bat -opengl desktop

desktop选项告知Qt使用Windows上的OpenGL,当然前提是要求Windows上的OpenGL与Qt兼容。

-opengl选项支持两个版本的OpenGL ES,一个是es2,一个是es1,如下所示。

  1. configure.bat -opengl es2

七.configure -h

configure -h与configure -help功能相同,显示所有配置选项。以下是Windows上Qt5.7.0的配置选项。

Installation options:
These are optional, but you may specify install directories.
    -prefix <dir> ...... The deployment directory, as seen on the target device.(default %CD%)                     
    -extprefix <dir> ... The installation directory, as seen on the host machine.(default SYSROOT/PREFIX)
   -hostprefix [dir] .. The installation directory for build tools running onthe host machine. If [dir] is not  given, 
                                the current builddirectory will be used. (default EXTPREFIX) 
You may use these to change the layout of the install. Note that all directories except -sysconfdir should be located under -prefix/-hostprefix:
    -bindir <dir> ...... User executables will be installed to <dir>.(default PREFIX/bin)                     
    -libdir <dir> ...... Libraries will be installed to <dir>.(default PREFIX/lib)                      
    -headerdir <dir> ... Headers will be installed to <dir>. (default PREFIX/include)                    
    -archdatadir <dir> . Architecture-dependent data used by Qt will be installed to <dir>.(default PREFIX)
    -libexecdir <dir> .. Program executables will be installed to <dir>.(default ARCHDATADIR/bin)
    -plugindir <dir> ... Plugins will be installed to <dir>.(default ARCHDATADIR/plugins)                      
    -importdir <dir> ... Imports for QML1 will be installed to <dir>.(default ARCHDATADIR/imports)
    -qmldir <dir> ...... Imports for QML2 will be installed to <dir>.(default ARCHDATADIR/qml)
    -datadir <dir> ..... Data used by Qt programs will be installed to <dir>.(default PREFIX)
    -docdir <dir> ...... Documentation will be installed to <dir>.(default DATADIR/doc)
    -translationdir <dir> Translations of Qt programs will be installed to <dir>.(default DATADIR/translations)
    -examplesdir <dir> . Examples will be installed to <dir>.(default PREFIX/examples)
    -testsdir <dir> .... Tests will be installed to <dir>.(default PREFIX/tests)
    -hostbindir <dir> .. Host executables will be installed to <dir>.(default HOSTPREFIX/bin)
    -hostlibdir <dir> .. Host libraries will be installed to <dir>.(default HOSTPREFIX/lib)
    -hostdatadir <dir> . Data used by qmake will be installed to <dir>.(default HOSTPREFIX)

Configure options:
The defaults (*) are usually acceptable. A plus (+) denotes a default value that needs to be evaluated. If the evaluation succeeds, the feature is included. Here is a short explanation of each option:
    -release ........... Compile and link Qt with debugging turned off.
 *  -debug ............. Compile and link Qt with debugging turned on.
 +  -debug-and-release . Compile and link two Qt libraries, with and without debugging turned on.
    -force-debug-info .. Create symbol files for release builds.
    -separate-debug-info Strip debug information into a separate file.
    -developer-build ... Compile and link Qt with Qt developer options(including auto-tests exporting)                   
    -optimized-tools ... Build optimized host tools even in debug build.
 *  -no-optimized-tools Do not build optimized host tools even in debug build.
    -opensource ........ Compile and link the Open-Source Edition of Qt.
    -commercial ........ Compile and link the Commercial Edition of Qt.
    -C++std <edition> .. Compile Qt with C++ standard edition (c++11, c++14, c++1z)Default: highest supported. 
                                    This  option is notsupported for MSVC.                                  
    -use-gold-linker ... Link using the GNU gold linker (gcc only).
 *  -no-use-gold-linker Do not link using the GNU gold linker.
    -enable-new-dtags .. Use new DTAGS for RPATH (Linux only).
 *  -disable-new-dtags . Do not use new DTAGS for RPATH.
 *  -shared ............ Create and use shared Qt libraries.
    -static ............ Create and use static Qt libraries.
 *  -static-runtime .... Statically link the C/C++ runtime library.
    -ltcg .............. Use Link Time Code Generation. (Release builds only)
 *  -no-ltcg ........... Do not use Link Time Code Generation.
    -make <part> ....... Add part to the list of parts to be built at make time,list containslibs,tools,examples               
    -nomake <part> ..... Exclude part from the list of parts to be built.
    -skip <module> ..... Exclude an entire module from the build.
    -no-compile-examples Install only the sources of examples.
    -no-widgets ........ Disable Qt Widgets module.
    -no-gui ............ Disable Qt GUI module.
    -no-accessibility .. Disable accessibility support.Disabling accessibility is not recommended, as it willbreak 
                                  QStyle and may break other internal parts of Qt.With this switch you create a source 
                                  incompatibleversion of Qt,which is unsupported.        
 *  -accessibility ..... Enable accessibility support.
    -no-sql-<driver> ... Disable SQL <driver> entirely, by default none are turned on.          
    -qt-sql-<driver> ... Enable a SQL <driver> in the Qt Library.
    -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to at run time.Available values for <driver>: 
                                    MySQL
                                    psql
                                    oci
                                    odbc
                                    tds
                                    db2
 +                                 sqlite
                                    sqlite2
                                    ibase
                                    (drivers marked with a '+' have been detected asavailable on this system)                      
    -system-sqlite ..... Use sqlite from the operating system.
    -no-opengl ......... Do not support OpenGL.
    -opengl <api> ...... Enable OpenGL support with specified API version.Available values for <api>:
                                  desktop - Enable support for Desktop OpenGL
                                  dynamic - Enable support for dynamically loadedOpenGL (either desktop or ES)
 *                               es2 - Enable support for OpenGL ES 2.0
 *  -no-openvg ......... Disables OpenVG functionality.
    -openvg ............ Enables OpenVG functionality.
    -force-asserts ..... Activate asserts in release mode.
    -platform <spec> ... The operating system and compiler you are building on.(default %QMAKESPEC%)                
    -xplatform <spec> .. The operating system and compiler you are cross compiling to.See the README file for a 
                                     list of supported operatingsystems and compilers.
    -target ............ Set target OS version. Currently the only valid value is 'xp' for targeting Windows XP.MSVC >=2012
                             targets Windows Vista by default.                  
    -sysroot <dir> ..... Sets <dir> as the target compiler's and qmake's sysroot and also sets pkg-config paths.        
    -no-gcc-sysroot .... When using -sysroot, it disables the passing of --sysroot to the compiler.
    -qconfig <local> ... Use src/corelib/global/qconfig-<local>.h rather than the default 'full'.                    
 *  -no-nis ............ Do not compile NIS support.
    -nis ............... Compile NIS support.
    -no-iconv .......... Do not enable support for iconv(3).
 +  -iconv ............. Enable support for iconv(3).
 +  -sun-iconv ......... Enable support for iconv(3) using sun-iconv.
 +  -gnu-iconv ......... Enable support for iconv(3) using gnu-libiconv.
    -no-evdev .......... Do not enable support for evdev.
 +  -evdev ............. Enable support for evdev.
    -no-mtdev .......... Do not enable support for mtdev.
 +  -mtdev ............. Enable support for mtdev.
 +  -inotify ........... Explicitly enable Qt inotify(7) support.
    -no-inotify ........ Explicitly disable Qt inotify(7) support.
 +  -eventfd ........... Enable eventfd(7) support in the UNIX event loop.
    -no-eventfd ........ Disable eventfd(7) support in the UNIX event loop.
 *  -largefile ......... Enables Qt to access files larger than 4 GB.
    -posix-ipc ......... Enable POSIX IPC.
    -glib .............. Compile Glib support.
    -sysconfdir <dir> .. Settings used by Qt programs will be looked for in <dir>.             
    -system-proxies .... Use system network proxies by default.
 *  -no-system-proxies . Do not use system network proxies by default.
 +  -warnings-are-errors Make warnings be treated as errors.
    -no-warnings-are-errors Make warnings be treated normally.
    -qtnamespace <name> Wraps all Qt library code in 'namespace name {...}'.
    -qtlibinfix <infix> Renames all Qt* libs to Qt*<infix>.
    -D <define> ........ Add an explicit define to the preprocessor.
    -I <includepath> ... Add an explicit include path.
    -L <librarypath> ... Add an explicit library path.
    -l <libraryname> ... Add an explicit library name, residing in a librarypath.                
    -no-pch ............ Do not use precompiled header support.
 *  -pch ............... Use precopmiled header support.
    -help, -h, -? ...... Display this information.

Third Party Libraries:
    -qt-zlib ........... Use the zlib bundled with Qt.
 +  -system-zlib ....... Use zlib from the operating system.See http://www.gzip.org/zlib   
    -qt-pcre ........... Use the PCRE library bundled with Qt.
 +  -system-pcre ....... Use the PCRE library from the operating system.See http://pcre.org/   
    -icu ............... Use the ICU library.
 *  -no-icu ............ Do not use the ICU library.See http://site.icu-project.org/
    -no-gif ............ Do not compile GIF reading support.
    -no-libpng ......... Do not compile PNG support.
    -qt-libpng ......... Use the libpng bundled with Qt.
 +  -system-libpng ..... Use libpng from the operating system.See http://www.libpng.org/pub/png
    -no-libjpeg ........ Do not compile JPEG support.
    -qt-libjpeg ........ Use the libjpeg bundled with Qt.
 +  -system-libjpeg .... Use libjpeg from the operating system.See http://www.ijg.org
    -no-doubleconversion Use sscanf_l and snprintf_l for (imprecise) double con version.
    -qt-doubleconversion Use the libdouble-conversion bundled with Qt.
    -system-doubleconversion Use the libdouble-conversion provided by the system.
    -no-freetype ....... Do not compile in Freetype2 support.
 *  -qt-freetype ....... Use the libfreetype bundled with Qt.
    -system-freetype ... Use the libfreetype provided by the system.
    -fontconfig ........ Build with FontConfig support.
 *  -no-fontconfig ..... Do not build with FontConfig support.
    -no-harfbuzz ....... Do not compile in HarfBuzz-NG support.
 *  -qt-harfbuzz ....... Use HarfBuzz-NG bundled with Qt to do text shaping.It can still be disabled by settingthe 
                                 QT_HARFBUZZ environment variable to "old".       
    -system-harfbuzz ... Use HarfBuzz-NG from the operating system to do text shaping. It can still be disabled by 
                                     setting the QT_HARFBUZZ environment variable to"old".See http://www.harfbuzz.org 
 +  -angle ............. Use the ANGLE implementation of OpenGL ES 2.0.
    -no-angle .......... Do not use ANGLE.See http://code.google.com/p/angleproject/
                         
Qt for Windows only:
    -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 theINCREDIBUILD_XGE 
                              variable.(The IncrediBuild distribution commands are only addedto Visual Studio projects)
 *  -no-plugin-manifests Do not embed manifests in plugins.
    -plugin-manifests .. Embed manifests in plugins.
    -no-qmake .......... Do not compile qmake.
 *  -qmake ............. Compile qmake.
    -qreal [double|float] typedef qreal to the specified type. The default is double.Note that changing this flag affects binary compatibility.  
    -no-rtti ........... Do not compile runtime type information.
 *  -rtti .............. Compile runtime type information.
    -no-strip .......... Do not strip libraries and executables of debug info when installing.
 *  -strip ............. Strip libraries and executables of debug info when installing.
    -no-sse2 ........... Do not compile with use of SSE2 instructions.
 +  -sse2 .............. Compile with use of SSE2 instructions.
    -no-sse3 ........... Do not compile with use of SSE3 instructions.
 +  -sse3 .............. Compile with use of SSE3 instructions.
    -no-ssse3 .......... Do not compile with use of SSSE3 instructions.
 +  -ssse3 ............. Compile with use of SSSE3 instructions.
    -no-sse4.1 ......... Do not compile with use of SSE4.1 instructions.
 +  -sse4.1 ............ Compile with use of SSE4.1 instructions.
    -no-sse4.2 ......... Do not compile with use of SSE4.2 instructions.
 +  -sse4.2 ............ Compile with use of SSE4.2 instructions.
    -no-avx ............ Do not compile with use of AVX instructions.
 +  -avx ............... Compile with use of AVX instructions.
    -no-avx2 ........... Do not compile with use of AVX2 instructions.
 +  -avx2 .............. Compile with use of AVX2 instructions.
    -no-avx512 ......... Do not compile with use of AVX512 instructions.
 +  -avx512 ............ Compile with use of AVX512 instructions.
    -no-ssl ............ Do not compile support for SSL.
 +  -ssl ............... Enable run-time SSL support.
    -no-openssl ........ Do not compile support for OpenSSL.
 +  -openssl ........... Enable run-time OpenSSL support.
    -openssl-linked .... Enable linked OpenSSL support.
    -no-libproxy ....... Do not compile in libproxy support.
 +  -libproxy .......... Compile in libproxy support (for cross compilation targets).
    -no-dbus ........... Do not compile in D-Bus support.
    -dbus-linked ....... Compile in D-Bus support and link to libdbus-1.
    -dbus-runtime ...... Compile in D-Bus support and load libdbus-1 dynamically.
    -no-audio-backend .. Do not compile in the platform audio backend into Qt Multimedia.
 +  -audio-backend ..... Compile in the platform audio backend into Qt Qt Multimedia.
 *  -no-wmf-backend .... Do not compile in the windows media foundation backend into Qt Multimedia.
    -wmf-backend ....... Compile in the windows media foundation backend into Qt Multimedia.
    -no-qml-debug ...... Do not build the in-process QML debugging support.
 *  -qml-debug ......... Build the in-process QML debugging support.
    -no-directwrite .... Do not build support for DirectWrite font rendering.
 +  -directwrite ....... Build support for DirectWrite font rendering.
 *  -no-direct2d ....... Do not build the Direct2D platform plugin.
    -direct2d .......... Build the Direct2D platform plugin (experimental,requires Direct2D availability on target systems,
                              e.g. Windows 7 with Platform Update, Windows 8, etc.)
    -no-style-<style> .. Disable <style> entirely.
    -qt-style-<style> .. Enable <style> in the Qt Library.
                                  Available styles:
 *                               windows
 +                              windowsxp
 +                              windowsvista
 *                               fusion
    -no-native-gestures Do not use native gestures on Windows 7.
 *  -native-gestures ... Use native gestures on Windows 7.
 *  -no-mp ............. Do not use multiple processors for compiling with MSVC
    -mp ................ Use multiple processors for compiling with MSVC (-MP).
    -loadconfig <config> Run configure with the parameters from file configure_<config>.cache.                
    -saveconfig <config> Run configure and save the parameters in file configure_<config>.cache.
    -redo .............. Run configure with the same parameters as last time.
    -v, -verbose ....... Run configure tests with verbose output.

http://blog.csdn.net/caoshangpa/article/details/53706801

Qt5.7.0配置选项(configure非常详细的参数)的更多相关文章

  1. linux下编译qt5.6.0静态库——configure配置(超详细,有每一个模块的说明)(乌合之众)

    linux下编译qt5.6.0静态库 linux下编译qt5.6.0静态库 configure生成makefile 安装选项 Configure选项 第三方库: 附加选项: QNX/Blackberr ...

  2. linux下编译qt5.6.0静态库——configure配置

    linux下编译qt5.6.0静态库 linux下编译qt5.6.0静态库 configure生成makefile 安装选项 Configure选项 第三方库: 附加选项: QNX/Blackberr ...

  3. windows下Qt5.1.0配置android环境搭建 good

    1.首先下载好需要配置的软件: 1>Qt 5.1.0 for Android (Windows 32-bit, 716 MB)(Info)下载地址: http://qt-project.org/ ...

  4. vue2.0 配置 选项 属性 方法 事件 ——速查

    全局配置 silent  设置日志与警告  optionMergeStrategies   合并策略  devtools  配置是否允许vue-devtools  errorHandler    错误 ...

  5. VS2015编译Qt5.7.0生成支持XP的静态库(很不错)

    一.编译工具 1.VS2015 编译Qt5.7.0的所需VS版本:Visual Studio 2013 (Update1)或Visual Studio 2015 (Update2).因为Update补 ...

  6. linux下编译qt5.6.0静态库(使用./configure --help来看看都有哪些参数。超详细,有每一个模块的说明。如果改变了安装的目录,需要到安装目录下的bin目录下创建文件qt.conf)(乌合之众)good

    linux下编译qt5.6.0静态库 linux下编译qt5.6.0静态库 configure生成makefile 安装选项 Configure选项 第三方库: 附加选项: QNX/Blackberr ...

  7. 详解QT5.10.0搭载OpenCV3.4.0环境配置步骤说明

    一.准备工作: 1下载Qt5.10.0 和 Qt Creator 4.5.0软件(http://download.qt.io/official_releases/qt/) 2.下载opencv3.40 ...

  8. qt-5.6.0 移植之tslib 配置及编译

    tslib 是qt启动时的一个触屏校正检验程序. 它的配置以及编译比较简单. 第一步, 下载tslib源码包: http://download.csdn.net/detail/MKNDG/329156 ...

  9. Highcharts 配置选项详细说明

    Highcharts 配置选项详细说明 Highcharts 提供大量的配置选项参数,您可以轻松定制符合用户要求的图表,本章节为大家详细介绍Highcharts 配置选项使用说明: 参数配置(属性+事 ...

随机推荐

  1. css3之3d导航

    css3的新属性非常不错,目前IE除外其他浏览器都已支持 实现原理:比如元素a在hover时候可以改变元素b的状态. 效果如本农导航,欢迎采用和建议~ a:hover b{ 执行简单动画效果 } HT ...

  2. inline-block 空白间距问题

    一. 问题 元素是inline-block属性时,会有空白间隙 二. 解决方案 1. html方式 1)将元素之间的空隙去除 <div class="space"> & ...

  3. Windows8.1系统下让VS2012编译运行IIS Express 64位 调试器

    有时候在window8以上系统中对C#系统进行调试 提示不能使用32位IIS Express,如果每次都采用IIS 在vs代码进行调试的时候很麻烦 下面我们就介绍一下怎么用编译调试64位代码: 网上方 ...

  4. Android Fragment使用(三) Activity, Fragment, WebView的状态保存和恢复

    Android中的状态保存和恢复 Android中的状态保存和恢复, 包括Activity和Fragment以及其中View的状态处理. Activity的状态除了其中的View和Fragment的状 ...

  5. Android项目实战(二十八):Zxing二维码实现及优化

    前言: 多年之前接触过zxing实现二维码,没想到今日项目中再此使用竟然使用的还是zxing,百度之,竟是如此牛的玩意. 当然,项目中我们也许只会用到二维码的扫描和生成两个功能,所以不必下载完整的ja ...

  6. MD5工具类

    package com.liu.hellomavenweb.util; import java.security.MessageDigest; /** * * @author 刘楠 * */ publ ...

  7. 进新公司用cornerstone-checkout后遇到的奇葩bug,及解决方法

    从cornerstone中checkout下新的工程,运行报错. 1.开始错误原因是找不到相对应的某个.m文件的路径 解决方案:将缺少的.m文件重新从项目文件夹中导入 2.后来显示 造成的原因是在下面 ...

  8. SDK的制作详解

    一个简单的SDK制作是很容易的,复杂的sdk其实就和复杂化的应用一样,都是从简单开始的,这里介绍一下sdk的简单制作 步骤: 1.创建sdk,公开文件 2.编译.获取sdk文件 3.导入工程,配置文件 ...

  9. 页面以base64输出图片

    <% //读取文件路径,输出base64 编码 System.IO.FileStream stream = System.IO.File.OpenRead(ViewBag.FilePath); ...

  10. ORA-00600: internal error code, arguments: [LibraryCacheNotEmptyOnClose]

      案例环境: 操作系统版本: Red Hat Enterprise Linux ES release 4 数据库版本  : 10.2.0.4.0 32 bit 案例介绍: 今天我执行stop_ora ...