一、 編譯環境準備
Chromiumbb:git clone https://github.com/bloomberg/chromium.bb.git
Python2.7: https://www.python.org/downloads/release/python-2715/
VS2015: https://my.visualstudio.com/Downloads?PId=2226
depot_tools: https://storage.googleapis.com/chrome-infra/depot_tools.zip
電腦:
(這些代碼和工具不用梯子下載比較慢,可以考慮國內網站找找)
參考Chromiumbb readme:
Branch Structure
The
master
branch contains the code that is used to make the
official Chromium builds used by Bloomberg. It is not used for
development. Actual development happens in one of thebugfix/*
or
feature/*
branches.Each
bugfix/*
orfeature/*
branch is based on the
upstream/latest
branch, which contains a snapshot of the code we get
from the upstream Chromium project.The
release/candidate
branch contains changes that are scheduled to
be included in the next release.Cloning the repository
By default, Git for Windows has a very small limit on the maximum
filename length. Some files in this repository exceed this 260
character limit so it’s important to configure Git to allow long
filenames.git config --global core.longpaths true git clone https://github.com/bloomberg/chromium.bb.git git checkout master
If you don’t want to set this configuration at the global level, you
can do the following instead:git init git config core.longpaths true git remote add origin https://github.com/bloomberg/chromium.bb.git git fetch origin master git checkout master
Build Instructions
Bloomberg Employees: Build steps
If you are not a Bloomberg employee, the following instructions
should still work:
Download the dependencies:
- Python 2.7
- Visual Studio 2015 Update 3
- Windows 10 SDK 10.0.14393
- Depot Tools
Setup your build environment:
export PATH="${DEPOT_TOOLS_PATH}:${PATH}" export DEPOT_TOOLS_WIN_TOOLCHAIN=0
Please replace ${DEPOT_TOOLS_PATH} with the path to your
depot_tools.Run the following command from inside the top-level directory:
cd src build/runhooks.py build/blpwtk2.py
This will generate the necessary ninja makefiles needed for the
build.Run the following commands to start the build:
ninja -C out/shared/Debug blpwtk2_all # for component Debug builds ninja -C out/shared/Release blpwtk2_all # for component Release builds ninja -C out/static/Debug blpwtk2_all # for non-component Debug builds ninja -C out/static/Release blpwtk2_all # for non-component Release builds
Microsoft, Windows, Visual Studio and ClearType are registered trademarks of Microsoft Corp.
Firefox is a registered trademark of Mozilla Corp.
Chrome is a registered trademark of Google Inc.
二、 安裝
1、vs2015安裝
關鍵是要選擇Win10 SDK
2,,python2.7
一路默認就行,安裝好後添加環境變量
3,depot_tools
下載後解壓,再添加路徑到環境變量,然後添加新環境變量DEPOT_TOOLS_WIN_TOOLCHAIN爲0
最後環境變量如下:
三、 編譯
1、打開命令行,進入chromiumbb文件所目錄,執行
python src\build\runhooks.py
2、進入src,執行
ninja -C out\static\Debug blpwtk2_all
3、正常情況應該可以編譯出可執行文件了,在\out\static\Debug\content_shell.exe路徑,可以輸入下面進行測試:
.\out\static\Debug\content_shell.exe https://www.baidu.com/
能看到如下畫面:
4、編譯相關問題
我這邊第一次編譯因爲WIN10 SDK沒安裝的原因,很快就報錯了,第二次提示如下:
c:\program files (x86)\windows kits\10\include\10.0.18362.0\um\versionhelpers.h(162): error C2220: 警告被視爲錯誤 - 沒有生成“object”文件
c:\program files (x86)\windows kits\10\include\10.0.18362.0\um\versionhelpers.h(162): warning C4800: “BOOL”: 將值強制爲布爾值“true”或“false”(性能警告)
應該是把警告當成錯誤了,我這邊暫時想了個辦法,versionhelpers.h文件的162行,直接返回true,暫時沒看到什麼問題
return TRUE;
//return fActiveSessionCountLimited;//原始返回