Monday, February 11, 2013

Building/Compiling my QtWeb...

過年期間心血來潮,想說來研究一下瀏覽器,下載了 Chromium 跟 QtWeb 兩包原始碼,看了看大小,決定還是從小的開始,就 QtWeb 吧。

解開 QtWeb 的原始碼,有給 VS 的專案檔,很好。再看了一下依存性,發現還要加上 Qt 跟 OpenSSL 才能動工。尤其 Build Qt 實在是相當花時間的一件事,檔案也不小,看來當初應該直接挑戰 Chromium 的,不應該看到 2 GB 的壓縮檔就退卻了。

不過還是紀錄一下 Build QtWeb 的過程吧。

1. Download source code package, QtWeb.
2. Download the dependency packages, including Qt & OpenSSL.
3. Install OpenSSL.

4. Install Qt and then build Qt first. // Update: No need to re-build it since the package contains the built binaries.
  • Launch "Qt 4.8.4 Command Prompt", could be found in Start Menu, after installing Qt Libraries.
  • Type 'configure -openssl -openssl-linked -I \include -L \lib\VC\static OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32 -lCrypt32" OPENSSL_LIBS_DEBUG="-lssleay32MDd -llibeay32MDd" OPENSSL_LIBS_RELEASE="-lssleay32MD -llibeay32MD" ' and press Enter.
  • Type 'nmake' and press Enter.
5. Change the language setting for Non-Unicode programs. (My system is Traditional Chinese)
6-a. Build QtWeb via command-line
  • Launch "Qt 4.8.4 Command Prompt" and cd to the QtWeb source folder, ex. cd D:\QtWb_src_3.7.5-101\QtWeb.
  • Type build.cmd and press Enter.
6-b. Build QtWeb via VS GUI
  • Launch VS 2008 via running "Visual Studio with Qt 4.8.4".
  • Open QtWeb project in VS 2008.
  • Build the project.

對了,Qt 編譯過後,Qt components 都是 Qtxxx4.lib/dll 的名稱,所以 QtWeb 在編譯時,順手改一下 Project settings,以免 link 時找不到檔案。研究一下 QtWeb 先,再來試試 Chromium。若是在 Compile Qt 有問題,也可以參考一下底下這篇。
How to compile Qt with Visual Studio