来自:
1.
2.
Wiki
/ MasterBuildQuickStart
This Wiki page provides a quick-start guide for creatinga Debug build of CEF/Chromium using the current master (development) branch.
Note to Editors:Changes made to this Wiki page without prior approval via the or may be lost or reverted.
·
·
·
·
·
·
Overview
This page providesa quick-start guide for setting up a minimal development environment andbuilding the master branch of Chromium/CEF for development purposes. For acomprehensive discussion of the available tools and configurations visit the Wiki page.
This guide is NOTintended for:
· Those seeking aprebuilt binary distribution for use in third-party apps. Go instead.
· Those seeking tobuild the binary distribution in a completely automated manner. Go instead.
Developmentsystems can be configured using dedicated hardware or a , or virtualmachine.
The below stepscan often be used to develop the most recent release branch of CEF/Chromium inaddition to the master branch. Chromium build requirements change over time soreview the build requirements listed on the Wiki page beforeattempting to build a release branch. Then just add --branch=XXXX to the automate-git.py command-line where"XXXX" is the branch number you wish to build.
File Structure
The same filestructure will be used on all platforms. "~" can be any path thatdoes not include spaces or special characters. We'll be building this directorystructure for each platform in the following sections.
~/code/
automate/
automate-git.py <-- CEF build script
chromium_git/
cef/ <-- CEF source checkout
chromium/
src/ <-- Chromium source checkout
update.[bat|sh] <-- Bootstrap script for automate-git.py
depot_tools/ <-- Chromium build tools
With this filestructure you can develop multiple CEF/Chromium branches side-by-side. Forexample, repeat the below instructions using "chromium_git1" as thedirectory name instead of "chromium_git".
Windows Setup
What's Required
· Windows 7 ornewer, 64-bit OS.
· Visual Studio 2015Update 2 installed in the default location.
· installed in thedefault location. This SDK version is included with VS2015 so no need toinstall it separately if you installed that product.
· At least 8GB ofRAM and 40GB of free disk space.
· Approximately 2hours with a fast internet connection (25Mbps) and fast build machine (2.6Ghz+,4+ logical cores).
Step-by-step Guide
All of the belowcommands should be run using the system "cmd.exe" and not a Cygwinshell.
1. Create thefollowing directories.
c:\code\automate
c:\code\chromium_git
2. Download and extract to"c:\code\depot_tools". Do not use drag-n-drop or copy-n-paste extractfrom Explorer, this will not extract the hidden ".git" folder whichis necessary for depot_tools to auto-update itself. You can use "Extractall..." from the context menu though. isalso a good tool for this.
3. Run"update_depot_tools.bat" to install Python, Git and SVN.
cdc:\code\depot_tools
update_depot_tools.bat
4. Add the"c:\code\depot_tools" folder to your system PATH. For example, onWindows 10:
· Run the"SystemPropertiesAdvanced" command.
· Click the"Environment Variables..." button.
· Double-click on"Path" under "System variables" to edit the value.
5. Download the script to"c:\code\automate\automate-git.py".
6. Create the"c:\code\chromium_git\update.bat" script with the following contents.Remove the GN_DEFINES line if you’re planning to create Release builds insteadof Debug builds.
setCEF_USE_GN=1
setGN_DEFINES=is_win_fastlink=true
setGN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*
python..\automate\automate-git.py --download-dir=c:\code\chromium_git--depot-tools-dir=c:\code\depot_tools --no-distrib --no-build
Run the"update.bat" script and wait for CEF and Chromium source code todownload. CEF source code will be downloaded to"c:\code\chromium_git\cef" and Chromium source code will bedownloaded to "c:\code\chromium_git\chromium\src". After downloadcompletion the CEF source code will be copied to "c:\code\chromium_git\chromium\src\cef".
cdc:\code\chromium_git
update.bat
7. Create the"c:\code\chromium_git\chromium\src\cef\create.bat" script with thefollowing contents. Remove the GN_DEFINES line if you’re planning to createRelease builds instead of Debug builds.
setCEF_USE_GN=1
setGN_DEFINES=is_win_fastlink=true
setGN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*
callcef_create_projects.bat
Run the"create.bat" script to generate Ninja and Visual Studio projectfiles.
cdc:\code\chromium_git\chromium\src\cef
create.bat
This will generatea "c:\code\chromium_git\chromium\src\out\Debug_GN_x86\cef.sln" filethat can be loaded in Visual Studio for debugging and compiling individualfiles. Replace “x86” with “x64” in this path to work with the 64-bit buildinstead of the 32-bit build. Always use Ninja to build the complete project.Repeat this step if you change the project configuration or add/remove files inthe GN configuration (BUILD.gn file).
8. Create a Debugbuild of CEF/Chromium using Ninja. Replace “x86” with “x64” in the below exampleto generate a 64-bit build instead of a 32-bit build. Edit the CEF source codeat "c:\code\chromium_git\chromium\src\cef" and repeat this stepmultiple times to perform incremental builds while developing.
cdc:\code\chromium_git\chromium\src
ninja-C out\Debug_GN_x86 cefclient cefsimple cef_unittests
9. Run theresulting cefclient sample application.
cdc:\code\chromium_git\chromium\src
out\Debug_GN_x86\cefclient.exe
See the for detaileddebugging instructions.
Mac OS X Setup
What's Required
· OS X 10.10 ornewer.
· Xcode 7.2.
· At least 8GB ofRAM and 40GB of free disk space.
· Approximately 2hours with a fast internet connection (25Mbps) and fast build machine (2.6Ghz+,4+ logical cores).
Step-by-step Guide
In this example"~" is "/Users/marshall". Note that in some cases theabsolute path must be used. Environment variables described in this section canbe added to your "~/.bash_profile" file to persist them acrosssessions.
1. Create thefollowing directories.
mkdir~/code/automate
mkdir~/code/chromium_git
2. Download"~/code/depot_tools" using Git.
cd~/code
gitclone https://chromium.googlesource.com/chromium/tools/depot_tools.git
3. Add the"~/code/depot_tools" directory to your PATH. Note the use of anabsolute path here.
export PATH=/Users/marshall/code/depot_tools:$PATH
4. Download the script to"~/code/automate/automate-git.py".
5. Create the"~/code/chromium_git/update.sh" script with the following contents.
#!/bin/bash
export CEF_USE_GN=1
python../automate/automate-git.py --download-dir=/Users/marshall/code/chromium_git --depot-tools-dir=/Users/marshall/code/depot_tools --no-distrib --no-build--x64-build
Give it executablepermissions.
cd~/code/chromium_git
chmod755 update.sh
Run the"update.sh" script and wait for CEF and Chromium source code todownload. CEF source code will be downloaded to"~/code/chromium_git/cef" and Chromium source code will be downloadedto "~/code/chromium_git/chromium/src". After download completion theCEF source code will be copied to "~/code/chromium_git/chromium/src/cef".
cd~/code/chromium_git
./update.sh
6. Create the"~/code/chromium_git/chromium/src/cef/create.sh" script with thefollowing contents.
#!/bin/bash
export CEF_USE_GN=1
./cef_create_projects.sh
Give it executablepermissions.
cd~/code/chromium_git/chromium/src/cef
chmod755 create.sh
Run the"create.sh" script to create Ninja project files. Repeat this step ifyou change the project configuration or add/remove files in the GNconfiguration (BUILD.gn file).
cd~/code/chromium_git/chromium/src/cef
./create.sh
7. Create a Debugbuild of CEF/Chromium using Ninja. Edit the CEF source code at"~/code/chromium_git/chromium/src/cef" and repeat this step multipletimes to perform incremental builds while developing.
cd~/code/chromium_git/chromium/src
ninja-C out/Debug_GN_x64 cefclient cefsimple cef_unittests
8. Run theresulting cefclient sample application.
cd~/code/chromium_git/chromium/src
openout/Debug_GN_x64/cefclient.app
See the for detaileddebugging instructions.
Linux Setup
What's Required
· is recommended. To build on Debian 7 64-bitsee the Wiki page foradditional instructions. Building with other versions or distros has not beentested and may experience issues.
· At least 6GB ofRAM and 40GB of free disk space.
· Approximately 2hours with a fast internet connection (25Mbps) and fast build machine (2.6Ghz+,4+ logical cores).
Step-by-step Guide
In this example"~" is "/home/marshall". Note that in some cases theabsolute path must be used. Environment variables described in this section canbe added to your "~/.profile" or "~/.bashrc" file topersist them across sessions.
1. Create thefollowing directories.
mkdir~/code/automate
mkdir~/code/chromium_git
2. Download andrun "~/code/install-build-deps.sh" to install build dependencies.Answer Y (yes) to all of the questions.
cd~/code
curl'https://chromium.googlesource.com/chromium/src/+/master/build/install-build-deps.sh?format=TEXT'| base64 -d > install-build-deps.sh
chmod755 install-build-deps.sh
sudo./install-build-deps.sh
3. Install the"libgtkglext1-dev" package required by the cefclient sampleapplication.
sudoapt-get install libgtkglext1-dev
4. Download"~/code/depot_tools" using Git.
cd~/code
gitclone https://chromium.googlesource.com/chromium/tools/depot_tools.git
5. Add the"~/code/depot_tools" directory to your PATH. Note the use of anabsolute path here.
export PATH=/home/marshall/code/depot_tools:$PATH
6. Download the"~/automate/automate-git.py" script.
cd~/code/automate
wgethttps://bitbucket.org/chromiumembedded/cef/raw/master/tools/automate/automate-git.py
7. Create the"~/code/chromium_git/update.sh" script with the following contents.
#!/bin/bash
export CEF_USE_GN=1
python../automate/automate-git.py --download-dir=/home/marshall/code/chromium_git --depot-tools-dir=/home/marshall/code/depot_tools --no-distrib --no-build
Give it executablepermissions.
cd~/code/chromium_git
chmod755 update.sh
Run the"update.sh" script and wait for CEF and Chromium source code todownload. CEF source code will be downloaded to"~/code/chromium_git/cef" and Chromium source code will be downloadedto "~/code/chromium_git/chromium/src". After download completion theCEF source code will be copied to"~/code/chromium_git/chromium/src/cef".
cd~/code/chromium_git
./update.sh
8. Create the"~/code/chromium_git/chromium/src/cef/create.sh" script with thefollowing contents.
#!/bin/bash
export CEF_USE_GN=1
./cef_create_projects.sh
Give it executablepermissions.
cd~/code/chromium_git/chromium/src/cef
chmod755 create.sh
Run the"create.sh" script to create Ninja project files. Repeat this step ifyou change the project configuration or add/remove files in the GNconfiguration (BUILD.gn file).
cd~/code/chromium_git/chromium/src/cef
./create.sh
9. Create a Debugbuild of CEF/Chromium using Ninja. Edit the CEF source code at"~/code/chromium_git/chromium/src/cef" and repeat this step multipletimes to perform incremental builds while developing. Note the additional"chrome_sandbox" target required by step 10.
cd~/code/chromium_git/chromium/src
ninja-C out/Debug_GN_x64 cefclient cefsimple cef_unittests chrome_sandbox
10. Set up the .
#This environment variable should be set at all times.
exportCHROME_DEVEL_SANDBOX=/usr/local/sbin/chrome-devel-sandbox
#This command only needs to be run a single time.
cd~/code/chromium_git/chromium/src
sudo./build/update-linux-sandbox.sh BUILDTYPE=Debug_GN_x64
11. Run thecefclient sample application.
cd~/code/chromium_git/chromium/src
./out/Debug_GN_x64/cefclient
See the for detaileddebugging instructions.
Next Steps
· If you're seekinga good code editor on Linux check out the and tutorials.
· Review the and Wiki pages for details onCEF implementation and usage.
· Review the Chromiumdebugging guide for , or .
· When you’re readyto contribute your changes back to the CEF project see the Wiki page forinstructions on creating a pull request.
Updated 2016-07-21