先使用./configure -h
来看看都有哪些参数。当选项描述后面跟着由中括号[]
括起来的值列表时,它们的解释为:yes
代表最基本的选择,其他值可以作为选项的前缀(如:-no-gui
),另外,值也可以用声明的方式(如:--gui=yes
),如果没有特别说明,列表中的值是按顺序被自动使用,auto
是yes/no
的缩写,单独的yes
和no
表示选项无法被自动检测。
安装选项
-prefix <dir>
指定部署目录,如目标设备上所示,[/usr/local/Qt-$QT_VERSION; qtbase build directory if -developer-build]。
-extprefix <dir>
指定安装目录,如主机上所示,[SYSROOT/PREFIX]。
-hostprefix <dir>
指定运行在本主机上的构建工具的安装目录,如果不指定<dir>
则使用当前目录,[EXTPREFIX]。
-external-hostbindir <path>
指定为这台机器构建的Qt工具路径,当-platform
和当前系统不匹配时使用,例如:创建交叉编译。
可以使用下面选项来对安装目录进行微调,请注意,所有目录除-sysconfdir
外,其他的应位于-prefix
和-hostprefix
下。
-bindir <dir>
可执行文件安装目录,[PREFIX/bin]。
-headerdir <dir>
头文件安装目录,[PREFIX/include]。
-libdir <dir>
库文件安装目录,[PREFIX/lib]。
-archdatadir <dir>
Arch-dependent 数据安装目录,[PREFIX]。
-plugindir <dir>
插件安装目录,[ARCHDATADIR/plugins]。
-libexecdir <dir>
辅助程序安装目录,[ARCHDATADIR/bin on Windows, ARCHDATADIR/libexec otherwise]
-importdir <dir>
QML1 导入安装目录,[ARCHDATADIR/imports]。
-qmldir <dir>
QML2 导入安装目录,[ARCHDATADIR/qml]。
-datadir <dir>
Arch-independent 数据安装目录,[PREFIX]。
-docdir <dir>
文档安装目录,[DATADIR/doc]。
-translationdir <dir>
翻译数据安装目录,DATADIR/translations]。
-sysconfdir <dir>
QT 程序使用的设置目录,[PREFIX/etc/xdg]。
-examplesdir <dir>
示例安装目录,[PREFIX/examples]。
-testsdir <dir>
测试安装目录,[PREFIX/tests]。
-hostbindir <dir>
主机可执行文件安装目录,[HOSTPREFIX/bin]。
-hostlibdir <dir>
主机库文件安装目录,[HOSTPREFIX/lib]。
-hostdatadir <dir>
qmake 所使用的数据目录,[HOSTPREFIX]。
Configure选项
-help
, -h
显示帮助信息。
-verbose
,-v
配置过程中打印每个步骤的的详细信息。
-continue
如果发生错误,尽管继续。
-redo
重新配置以前使用的选项,可能会传递其他额外的选项,但不会保存供稍后的-redo
选项使用。
-recheck [test,...]
丢弃缓存的无用的配置测试结果,在安装完丢失的依赖项后使用该选项,或者,如果指定了 tests,只有它们的结果会被丢弃。
-recheck-all
丢弃所有缓存的配置测试结果。
-feature-<feature>
启用<feature>
。
-no-feature-<feature>
禁止<feature>
,[none]。
-list-features
列出可用的特性,请注意,一些特性还有专用的命令行选项。
-list-libraries
列出可能的外部依赖项。
Build选项
-opensource
编译Qt的开源版本。
-commercial
编译Qt的商业版。
-confirm-license
自动确认许可。
-release
编译Qt的release版本,关闭调试,[yes]。
-debug
编译Qt的debug版本,开启调试,[no]。
-debug-and-release
编译Qt的release和debug两个版本,[yes] (Apple and Windows only)。
-optimize-debug
在调试构建中启用调试友好的优化,[auto] (Not supported with MSVC or Clang toolchains)。
-optimize-size
优化发布版本的大小而不是速度,[no]。
-optimized-tools
构建优化的主机工具,即使在调试构建,[no]。
-force-debug-info
强制为release构建输出调试信息,[no]。
-separate-debug-info
将调试信息到一个单独的文件,[no]。
-gdb-index
将调试信息索引到加速 GDB, [no; auto if -developer-build with debug info]。
-strip
使用 strip 去除不需要符号的二进制文件,[yes]。
-gc-binaries
将每个函数或数据项放入各自的分区中,启用未使用分区的链接器垃圾回收,[auto for static builds, otherwise no]。
-force-asserts
启用 Q_ASSERT 即使在 release 版本中,[no]。
-developer-build
编译和链接 Qt 用以开发 Qt 本身,(exports for auto-tests, extra checks, etc.) [no]。
*-shared
构建 Qt 共享库,[yes] (no for UIKit)。
-static
构建 QT 静态库,[no] (yes for UIKit)。
-framework
构建 Qt 框架包,[yes] (Apple only)。
-platform <target>
选择要构建的主机 mkspec,[detected]。
-xplatform <target>
选择交叉编译时的目标 mkspec,[PLATFORM]
-device <name>
交叉编译<name>
设备。
-device-option <key=value>
添加选项到设备的 mkspec。
-appstore-compliant
禁用平台应用程序商店中不允许的代码,对于需要通过 app store 进行分发的平台,这是默认打开的,特别是: Android, iOS, tvOS, watchOS, and Universal Windows Platform,[auto]。
-qtnamespace <name>
把所有的 Qt 库代码放入namespace
{...}
中。
-qtlibinfix <infix>
重命名所有libQt*.so
为libQt*<infix>.so
。
-qtlibinfix-plugins
通过-qtlibinfix
重命名 Qt 插件,[no]。
-testcocoon
Instrument with the TestCocoon code coverage tool,[no]。
-gcov
Instrument with the GCov code coverage tool,[no]。
-trace [backend]
Enable instrumentation with tracepoints,目前支持的后端有:‘etw’ (Windows) and ‘lttng’ (Linux), or ‘yes’ for auto-detection,[no]。
-sanitize [address/thread/memory/undefined]
Instrument with the specified compiler sanitizer,请注意,一些 sanitizers 是不能混合使用,例如:-sanitize address
不能和-sanitize thread
一起使用。
-coverage {trace-pc-guard}
添加代码覆盖工具, (Clang only)。
-c++std <edition>
选择 C++ 标准<edition>
,[c++2a/c++17/c++14/c++11] (Not supported with MSVC 2015)。
-sse2
使用 SSE2 指令,[auto]。
-sse3/-ssse3/-sse4.1/-sse4.2/-avx/-avx2/-avx512
启用对特定 x86 指令的使用,启用的仍然会受到运行时检测的影响,[auto]。
-mips_dsp/-mips_dspr2
使用 MIPS DSP/rev2 指令,[auto]。
-qreal <type>
将 qreal 类型定义为指定的类型,请注意,这会影响二进制兼容性,[double]。
-R <string>
向 Qt 库添加显式运行时库路径,支持相对于 LIBDIR 的路径。
+-rpath
链接 Qt 库和可执行文件使用库安装路径作为运行时库路径,相当于-R install_libpath
,在 Apple 平台上,disabling this impliesusing absolute install names (based in LIBDIR) for dynamic libraries and frameworks,[auto]。
-reduce-exports
减少输出符号的数量,[auto]。
-reduce-relocations
Reduce amount of relocations,[auto] (Unix only)。
-relocatable
允许重新安装Qt,[auto]。
-plugin-manifests
Embed manifests into plugins,[no] (Windows only)。
-static-runtime
With -static, use static runtime,[no] (Windows only)。
-pch
使用预编译头文件,[auto]。
-ltcg
使用链接时代码生成,[no]。
-linker [bfd,gold,lld]
强制使用 GNU ld,GNU gold or LLVM/LLD 链接器而不是默认值,(GCC only)。
-incredibuild-xge
使用 IncrediBuild XGE,[no] (Windows only)。
-ccache
使用 ccache 编译器缓存,[no] (Unix only)。
-make-tool <tool>
使用<tool>
来构建 qmake,[nmake] (Windows only)。
-mp
使用多个处理器进行编译,(MSVC only)。
-warnings-are-errors
将警告视为错误,[no; yes if -developer-build]。
-silent
减少编译输出,以便更容易地看到警告和错误。
Build环境
-sysroot <dir>
将 <dir>
设置为目标 sysroot。
-gcc-sysroot
使用 -sysroot
,将 --sysroot
传给编译器,[yes]。
-pkg-config
使用 pkg-config,[auto] (Unix only)。
-D <string>
传递额外的预处理定义。
-I <string>
传递额外的包含路径。
-L <string>
传递额外的库路径。
-F <string>
传递额外的框架路径, (Apple only)。
-sdk <sdk>
使用 Apple 提供的 SDK 构建 Qt,参数应该是由xcodebuild -showsdks
所列出的有效的 SDK 列表中的一个,请注意,这个参数只适用于使用目标 mkspec 构建的 Qt 库和应用程序,而不是像 qmake,moc,rcc 等主机工具。
-android-sdk path
设置 Android SDK 根目录,[$ANDROID_SDK_ROOT]
。
-android-ndk path
设置 Android NDK 根目录,[$ANDROID_NDK_ROOT]
。
-android-ndk-platform
设置 android 平台。
-android-ndk-host
设置 Android NDK 主机,(linux-x86, linux-x86_64, etc.) [$ANDROID_NDK_HOST]
。
-android-abis
逗号分隔 Android abis,默认有:armeabi-v7a,arm64-v8a,x86,x86_64。
-android-style-assets
运行时自动从设备提取 style assets,这个选项可以确保正确的 Android style,但也会使得 Android 平台插件与 LGPL2.1 不兼容,[yes]。
组件选择
-skip <repo>
从构建中排除整个存储库。
-make <part>
在 make 时添加要构建的<part>
组件,[libs and examples, also tools if not cross-building, also tests if -developer-build]。
-nomake <part>
在 make 时排除不构建的<part>
组件。
-compile-examples
构建和安装 examples 源码,[no on WebAssembly,otherwise yes]。
-gui
构建 Qt GUI 模块和依赖项,[yes]。
-widgets
构建 Qt Widgets 模块和依赖项,[yes]。
-no-dbus
不编译 Qt D-Bus 模块,[default on Android and Windows]。
-dbus-linked
构建 Qt D-Bus 模块并链接到 libdbus-1,[auto]。
-dbus-runtime
构建 Qt D-Bus 模块并动态加载 libdbus-1,[no]。
-accessibility
启用可访问性支持(注意:不建议禁用可访问性),[yes]。
Qt 附带了一些第三方库的捆绑拷贝,如果各自系统库的自动检测失败,下面这些会被默认使用。
Core选项
-doubleconversion
选择使用双转换库,no 意味着使用 sscanf_l 和 snprintf_l(不精确),[system/qt/no]。
-glib
启用对 Glib 支持,[no; auto on Unix]。
-eventfd
启用对 eventfd 的支持。
-inotify
启用对 inotify 的支持。
-iconv
启用对 iconv(3) 的支持,[posix/sun/gnu/no] (Unix only)。
-icu
启用对 ICU 库的支持,这是 IBM 发布的字符集编码转换库,[auto]。
-pcre
选择使用 libpcre2,[system/qt/no]。
-pps
启用对 PPS 的支持,[auto] (QNX only)。
-zlib
选择使用 zlib,[system/qt]。
Logging backends:
-journald
启用对 journald 的支持,[no] (Unix only)。
-syslog
启用对 syslog 的支持,[no] (Unix only)。
-slog2
启用对 slog2 的支持,[auto] (QNX only)。
Network选项
-ssl
启用对任何一种SSL方法的支持,[auto]。
-no-openssl
不适用 OpenSSL,[default on Apple and WinRT]。
-openssl-linked
使用 OpenSSL 并链接到 libssl,[no]。
-openssl-runtime
使用 OpenSSL 并动态加载 libssl,[auto]。
-schannel
使用安全通道,[no] (Windows only)。
-securetransport
使用安全传输,[auto] (Apple only)。
-sctp
启用对 SCTP 的支持,[no]。
-libproxy
启用对 libproxy 的使用,[no]。
-system-proxies
默认使用系统网络代理,[yes]。
Gui, printing, widget选项
-cups
启用对 CUPS 的支持,[auto] (Unix only)。
-fontconfig
启用对 Fontconfig 的支持,[auto] (Unix only)。
-freetype
选择使用 FreeType,[system/qt/no]。
-harfbuzz
选择使用 HarfBuzz-NG,[system/qt/no] (Not auto-detected on Apple and Windows)。
-gtk
启用对 GTK 平台主题的支持,[auto]。
-lgmon
启用对 lgmon 的支持,[auto] (QNX only)。
-no-opengl
禁止对 OpenGL 的支持。
-opengl <api>
启用对 OpenGL 的支持,支持的 APIs:es2 (default on Windows),desktop (default on Unix),dynamic (Windows only)。
-opengles3
启用对 OpenGL ES 3.x 替换 ES 2.x 的支持,[auto]。
-egl
启用对 EGL 的支持,[auto]。
-angle
使用绑定的 ANGLE 来支持 OpenGL ES 2.0,[auto] (Windows only)。
-combined-angle-lib
将 LibEGL 和 LibGLESv2 合并到 LibANGLE 中,(Windows only)。
-qpa <name>
选择默认的 QPA 后端,用分号分隔的优先级列表,(e.g., xcb, cocoa, windows)。
-xcb-xlib
启用对 Xcb-Xlib 的支持,[auto]。
Platform backends:
-direct2d
启用对 Direct2D 的支持,[auto] (Windows only)。
-directfb
启用对 DirectFB 的支持,[no] (Unix only)。
-eglfs
启用对 EGLFS 的支持,[auto; no on Android and Windows]。
-gbm
为 GBM 启用后端,[auto] (Linux only)。
-kms
为 KMS 启用后端,[auto] (Linux only)。
-linuxfb
启用 Linux Framebuffer 的支持,[auto] (Linux only)。
-xcb
启用 X11 的支持,选择使用 xcb-* 库,[system/qt/no] (-qt-xcb still uses system version of libxcb itself)。
Input backends:
-libudev
启用对 udev 的支持,[auto]。
-evdev
启用对 evdev 的持之,[auto]。
-imf
启用对 IMF 的支持,[auto] (QNX only)。
-libinput
启用对 libinput 的支持,[auto]。
-mtdev
启用对 mtdev 的支持,[auto]。
-tslib
启用对 tslib 的支持,[auto]。
-xcb-xinput
启用对 XInput2 的支持,[auto]。
-xkbcommon
启用对键映射的支持,[auto]。
Image formats:
-gif
启用对 GIF 的读取支持,[auto]。
-ico
启用对 ICO 的支持,[yes]。
-libpng
选择使用 libpng,[system/qt/no]。
-libjpeg
选择使用 libjpeg,[system/qt/no]。
Database选项
-sql-<driver>
启用 SQL <driver>
插件,支持的驱动程序有:db2、ibase、mysql、oci、odbc、 psql、sqlite2、sqlite、tds,[all auto]。
-sqlite
选择使用 sqlite3,[system/qt]。
Qt3D选项
-assimp
选择使用 assimp 库,[system/qt/no]。
-qt3d-profile-jobs
启用工作分析,[no]。
-qt3d-profile-gl
启用 OpenGL 分析,[no]。
-qt3d-simd
选择 SIMD 的支持级别,[no/sse2/avx2]。
-qt3d-render
启用 Qt3D 的渲染功能,[yes]。
-qt3d-input
启用 Qt3D 的输入功能,[yes]。
-qt3d-logic
启用 Qt3D 的逻辑功能,[yes]。
-qt3d-extras
启用 Qt3D 的额外功能,[yes]。
-qt3d-animation
启用 Qt3D 的动画功能,[yes]。
Further image format选项
-jasper
启用 JPEG-2000 中对 JasPer 库的支持,[no]。
-mng
启用对 MNG 的支持,[no]。
-tiff
启用对 TIFF 的支持,[system/qt/no]。
-webp
启用对 WEBP 的支持,[system/qt/no]。
Multimedia选项
-pulseaudio
启用对 PulseAudio 的支持,[auto] (Unix only)。
-alsa
启用对 ALSA 的支持,[auto] (Unix only)。
-no-gstreamer
禁止对 GStreamer 的支持。
-gstreamer <version>
启用对 GStreamer 的支持,在没有版本参数的情况下先尝试1.0,然后尝试0.10,[auto]。
-evr
在 DirectShow 和 WMF 中启用对 EVR 的支持,[auto]。
QtQuick3D选项
-assimp
选择使用assimp库,[system/qt/no]。
TextToSpeech选项
-flite
启用对 Flite 的持之,[auto] (Unix only)。
-flite-alsa
启用 Flite 与 ALSA 的支持,[auto] (Unix only)。
-speechd
启用语音分配器支持,[auto] (Unix only)。
WebEngine选项
-webengine-alsa
启用 对ALSA 的支持,[auto] (Linux only)。
-webengine-pulseaudio
启用对 PulseAudio 的支持,[auto] (Linux only)。
-webengine-embedded-build
启用 Linux 嵌入式构建,[auto] (Linux only)。
-webengine-icu
使用系统 ICU 库,[system/qt] (Linux only)。
-webengine-ffmpeg
使用系统 FFmpeg 库,[system/qt] (Linux only)。
-webengine-opus
使用系统 Opus 库,[system/qt] (Linux only)。
-webengine-webp
使用系统 WebP 库,[system/qt] (Linux only)。
-webengine-pepper-plugins
使用 Pepper Flash 和Widevine 插件,[auto]。
-webengine-printing-and-pdf
允许打印和输出到 PDF,[auto]。
-webengine-proprietary-codecs
启用对专有编解码器的支持,[no]。
-webengine-spellchecker
启用对拼写检查程序的支持,[yes]。
-webengine-native-spellchecker
启用对本机拼写检查程序的支持,[no] (macOS only)。
-webengine-webrtc
启用对 WebRTC 的支持,[auto]。