qt5的configure選項說明(2)

要編譯qt源碼,知道configure的配置選項含義則十分重要。


一、配置選項查看及初步解釋

通過下面命令查看都有哪一些編譯配置選項。

./configure -help

有一些選項的後面有中括號[]括起來的值,有以下三種情況,分別舉例。

  • yes,表示該選項默認選中。
  • no,表示該選項默認不選中。
  • auto,應當是系統會自動檢測是否添加該選項吧。那可以通過 -xxx=no或者-xxx=yes來進行手動配置。

變量配置方法: -VAR=VALUE的形式。

1、安裝選項

  • -prefix: 指定部署目錄,默認路徑爲 /usr/local/Qt-$QT_VERSION
  • -extprefix: 指定安裝目錄,如主機上所示,[SYSROOT/PREFIX]。
  • -hostprefix: 指定運行在本主機上的構建工具的安裝目錄,如果不指定則使用當前目錄。
  • -external-hostbindir: 指定爲這臺機器構建的Qt工具路徑,當-platform和當前系統不匹配時使用,例如:創建交叉編譯。

可以使用下面選項來對安裝目錄進行微調,請注意,所有目錄除-sysconfdir外,其他的應位於-prefix和-hostprefix下。

  • -bindir: 可執行文件安裝目錄,[PREFIX/bin]。
  • -headerdir: 頭文件安裝目錄,[PREFIX/include]。
  • -libdir: 庫文件安裝目錄,[PREFIX/lib]。
  • -archdatadir: Arch-dependent 數據安裝目錄,[PREFIX]。
  • -plugindir: 插件安裝目錄,[ARCHDATADIR/plugins]。
  • -libexecdir: 輔助程序安裝目錄,[ARCHDATADIR/bin on Windows, ARCHDATADIR/libexec otherwise]
  • -importdir: QML1 導入安裝目錄,[ARCHDATADIR/imports]。
  • -qmldir: QML2 導入安裝目錄,[ARCHDATADIR/qml]。
  • -datadir: Arch-independent 數據安裝目錄,[PREFIX]。
  • -docdir: 文檔安裝目錄,[DATADIR/doc]。
  • -translationdir: 翻譯數據安裝目錄,DATADIR/translations]。
  • -sysconfdir: QT 程序使用的設置目錄,[PREFIX/etc/xdg]。
  • -examplesdir: 示例安裝目錄,[PREFIX/examples]。
  • -testsdir: 測試安裝目錄,[PREFIX/tests]。
  • -hostbindir: 主機可執行文件安裝目錄,[HOSTPREFIX/bin]。
  • -hostlibdir: 主機庫文件安裝目錄,[HOSTPREFIX/lib]。
  • -hostdatadir: qmake 所使用的數據目錄,[HOSTPREFIX]。

2、配置選項

  • -help: -h 顯示幫助信息。
  • -verbose: -v 配置過程中打印每個步驟的的詳細信息。
  • -continue: 如果發生錯誤,儘管繼續。
  • -redo: 重新配置以前使用的選項,可能會傳遞其他額外的選項,但不會保存供稍後的-redo選項使用。
  • -recheck [test,…]: 丟棄緩存的無用的配置測試結果,在安裝完丟失的依賴項後使用該選項,或者,如果指定了 tests,只有它們的結果會被丟棄。
  • -recheck-all: 丟棄所有緩存的配置測試結果。
  • -feature-<feature>: 啓用<feature>。
  • -no-feature-<feature>: 禁止<feature>,[none]。
  • -list-features: 列出可用的特性,請注意,一些特性還有專用的命令行選項。
  • -list-libraries: 列出可能的外部依賴項。

3、編譯選項

  • -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 LIBDIR。在Apple平臺上,禁用它意味着對動態庫和框架使用絕對安裝名稱(基於LIBDIR),[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: 減少編譯輸出,以便更容易地看到警告和錯誤。

4、編譯環境

  • -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]。

5、組件選擇

  • -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 附帶了一些第三方庫的捆綁拷貝,如果各自系統庫的自動檢測失敗,下面這些會被默認使用。

6、核心選項

  • -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]。

後端日誌:

  • -journald: 啓用對 journald 的支持,[no] (Unix only)。
  • -syslog: 啓用對 syslog 的支持,[no] (Unix only)。
  • -slog2: 啓用對 slog2 的支持,[auto] (QNX only)。

7、網絡選項

  • -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]。

8、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)。

後端輸入:

  • -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]。

圖片格式:

  • -gif: 啓用對 GIF 的讀取支持,[auto]。
  • -ico: 啓用對 ICO 的支持,[yes]。
  • -libpng: 選擇使用 libpng,[system/qt/no]。
  • -libjpeg: 選擇使用 libjpeg,[system/qt/no]。

9、數據庫選項

  • -sql-<driver>: 啓用 SQL <driver> 插件,支持的驅動程序有: db2、ibase、mysql、oci、odbc、 psql、sqlite2、sqlite、tds,[all auto]。
  • -sqlite: 選擇使用 sqlite3,[system/qt]。

10、Qt 3D選項

  • -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]。

11、進一步圖片格式選項

  • -jasper: 啓用 JPEG-2000 中對 JasPer 庫的支持,[no]。
  • -mng: 啓用對 MNG 的支持,[no]。
  • -tiff: 啓用對 TIFF 的支持,[system/qt/no]。
  • -webp: 啓用對 WEBP 的支持,[system/qt/no]。

12、多媒體選項

  • -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]。

13、QtQuick 3D選項

  • -assimp: 選擇使用assimp庫,[system/qt/no]。

14、文字轉音頻選項

  • -flite: 啓用對 Flite 的持之,[auto] (Unix only)。
  • -flite-alsa: 啓用 Flite 與 ALSA 的支持,[auto] (Unix only)。
  • -speechd: 啓用語音分配器支持,[auto] (Unix only)。

15、Web引擎選項

  • -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]。

參考1:https://blog.csdn.net/hezhanran/article/details/101512974

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章