cef build

BranchesAndBuilding

This Wiki page provides information about CEF branches and instructions for downloading, building and packaging source code.

Note to Editors: Changes made to this Wiki page without prior approval via the CEF Forum or Issue Tracker may be lost or reverted.



Background

The CEF project is an extension of the Chromium project hosted at http://www.chromium.org. CEF maintains development and release branches that track Chromium branches. CEF source code can be built manually or with automated tools.

Development

Ongoing development of CEF occurs in the CEF master branch. This location tracks the current Chromium master branch and is not recommended for production use.

Current CEF master branch build requirements are as follows. See the MasterBuildQuickStart Wiki page for a development build quick-start guide.

Windows Build RequirementsmacOS Build RequirementsLinux Build Requirements  
Win 7+, VS2017 15.7.1+, Win 10.0.18362 SDK, Ninja macOS 10.10-10.14, 10.10+ deployment target, 10.13.2+ build system w/ 10.13+ base SDK (Xcode 9.3.1+), Ninja, 64-bit only Ubuntu 14.04+, Debian Jessie+, Ninja    

The following URLs should be used for downloading development versions of CEF.

CEF1 is no longer actively developed or supported. See the CEF1 Retirement Plan for details.

Release Branches

CEF branches are created to track each Chromium release milesone (MXX) branch. Users developing applications for production environments are encouraged to use release branches for the following reasons:

  • Binary CEF builds are tied to specific Chromium releases.
  • Release versions of CEF/Chromium are better tested and more appropriate for release applications.
  • Within a release branch the CEF API is "frozen" and generally only security/bug fixes are applied.
  • CEF release branches can include patches to Chromium/Blink source if necessary.
  • CEF master development won't interfere with consumer release schedules.

CEF release branches and associated platform build requirements are described below.

Version Number Format

The CEF version number format was recently changed to include more relevant information and to provide compatibility with the Semantic Versioning 2.0 standard.

Newer CEF release version numbers have the format "X.Y.Z+gHHHHHHH+chromium-A.B.C.D" where:

  • "X" is the Chromium major version (e.g. 73).
  • "Y" is an incremental number that starts at 0 when a release branch is created and changes only when the CEF C/C++ API changes (as determined by updates to the include/cef_api_hash.h file).
  • "Z" is an incremental number that starts at 0 when a release branch is created and changes on each commit, with reset to 0 when "Y" changes.
  • "gHHHHHHH" is the 7-character abbreviation for the Git commit hash. This facilitates lookup of the relevant commit history in Git.
  • "A.B.C.D" is the Chromium version (e.g. 73.0.3683.75).

Older CEF release version numbers have the format X.YYYY.A.gHHHHHHH where:

  • "X" is the CEF major version (e.g. 3).
  • "YYYY" is the Chromium branch.
  • "A" is an incremental number representing the number of commits in the current branch. This is roughly equivalent to the SVN revision number but on a per-branch basis and assists people in quickly determining the order of builds in the same branch (for bug reports, etc).
  • "gHHHHHHH" is the 7-character abbreviation for the Git commit hash. This facilitates lookup of the relevant commit history in Git.

Detailed Chromium and CEF version information is available in the include/cef_version.h header file which is created during the build process or by loading the “about:version” URL in a CEF-derived application.

Current Release Branches (Supported)

Support for newer branches begins when they enter the Chromium beta channel. Support for older branches ends when they exit the Chromium stable channel. The Spotify automated builder provides CEF builds for the current Chromium stable channel and will switch to the next Chromium branch when that branch is promoted to the stable channel. Updating CEF branches is currently a manual process so there will likely be a delay between Chromium release announcements and the availability of associated CEF builds. See the Chromium release calendar for estimated Chromium release dates and versions.

Branch DateRelease BranchChromium VersionCEF VersionWindows Build RequirementsmacOS Build RequirementsLinux Build Requirements
Mar 2020 4044 81 81 Win 7+, VS2017 15.7.1+, Win 10.0.18362 SDK, Ninja macOS 10.10-10.14, 10.10+ deployment target, 10.13.2+ build system w/ 10.13+ base SDK (Xcode 9.3.1+), Ninja, 64-bit only Ubuntu 14.04+, Debian Jessie+, Ninja
Feb 2020 3987 80 80 Win 7+, VS2017 15.7.1+, Win 10.0.18362 SDK, Ninja macOS 10.10-10.14, 10.10+ deployment target, 10.13.2+ build system w/ 10.13+ base SDK (Xcode 9.3.1+), Ninja, 64-bit only Ubuntu 14.04+, Debian Jessie+, Ninja

Legacy Release Branches (Unsupported)

Legacy CEF builds are available from the Spotify automated builder back to 2704 branch. Building legacy branches is not supported. If you choose to build a legacy branch you will need to solve any build errors on your own.

  • Newer legacy branches (within the past year) can often be built using the same tooling as current branches. You will need to (a) manually download depot_tools, (b) sync depot_tools to a revision that existed at the time of the branch, and (c) set the DEPOT_TOOLS_UPDATE=0 environment variable to keep it from updating automatically.
  • Older legacy branches can potentially be built by downloading a CEF source archive at the desired branch from here and a Chromium source archive at the associated/required version from here, and then combining them to create the required directory structure.
  • See the Build Notes section at the end of this page for historical build details.

The following URL should be used for downloading release versions of CEF where YYYY is the release branch number.

Note that 1025 and older branches contain only CEF1 source code and that 1547 and newer branches contain only CEF3 source code.

Building from Source

Building from source code is currently supported on Windows, macOS and Linux platforms. Use of the Automated Method described below is recommended. Building the current CEF/Chromium master branch for local development is described on the MasterBuildQuickStart Wiki page. Building the current CEF/Chromium stable branch automatically for production use is described on the AutomatedBuildSetup Wiki page. For other branches see the build requirements listed in the “Release Branches” section above and the “Build Notes” section below.

Automated Method

CEF provides tools for automatically downloading, building and packaging Chromium and CEF source code. These tools are the recommended way of building CEF locally and can also be integrated with automated build systems as described on the AutomatedBuildSetup Wiki page. See the MasterBuildQuickStart Wiki page for an example of the recommended workflow for local development builds.

These steps apply to the Git workflow only. The Git workflow is recommended for all users and supports CEF3 master and newer CEF3 release branches (1750+).

1. Download the automate-git.py script. Use the most recent master version of this script even when building release branches.

2. On Linux: Chromium requires that certain packages be installed. You can install them by running the install-build-deps.sh script or by explicitly running the necessary installation commands.

3. Run the automate-git.py script at whatever interval is appropriate (for each CEF commit, once per day, once per week, etc).

To build master:

python /path/to/automate/automate-git.py --download-dir=/path/to/download

To build a release branch:

python /path/to/automate/automate-git.py --download-dir=/path/to/download --branch=2785

By default the script will download depot_tools, Chromium and CEF source code, run Debug and Release builds of CEF, and create a binary distribution package containing the build artifacts in the “/path/to/download/chromium/src/cef/binary_distrib” directory. Future runs of the script will perform the minimum work necessary (unless otherwise configured using command-line flags). For example, if there are no pending CEF or Chromium updates the script will do nothing.

If you run the script and CEF or Chromium updates are pending the “/path/to/download/chromium/src/cef” directory will be removed and replaced with a clean copy from “/path/to/download/cef_(branch)” (specify the --no-update command-line flag to disable updates). Make sure to back up any changes that you made in the “/path/to/download/chromium/src/cef” directory before re-running the script.

The same download directory can be used for building multiple CEF branches (just specify a different --branch command-line value). The existing “/path/to/download/chromium/src/out” directory will be moved to “/path/to/download/out_(previousbranch)” so that the build output from the previous branch is not lost. When you switch back to a previous branch the out directory will be restored to its original location.

The script will create a 32-bit build on Windows by default. To create a 64-bit build on Windows, macOS or Linux specify the --x64-build command-line flag. 32-bit builds on macOS are no longer supported starting with 2272 branch so this flag is now required when building 2272+ on that platform.

If you receive Git errors when moving an existing checkout from one branch to another you can force a clean Chromium Git checkout (specify the --force-clean command-line flag) and optionally a clean download of Chromium dependencies (specify the --force-clean-deps command-line flag). Any build output that currently exists in the “src/out” directory will be deleted. Re-downloading the Chromium dependencies can take approximately 30 minutes with a reasonably fast internet connection.

Add the --help command-line switch to output a complete list of supported command-line options.

Manual Downloading

See the MasterBuildQuickStart Wiki page for an example of the recommended developer workflow.

Manual Building

See the MasterBuildQuickStart Wiki page for an example of the recommended developer workflow.

Manual Packaging

After building both Debug and Release configurations you can use the make_distrib tool (.bat on Windows, .sh on macOS and Linux) to create a binary distribution.

cd /path/to/chromium/src/cef/tools
./make_distrib.sh --ninja-build

If the process succeeds a binary distribution package will be created in the /path/to/chromium/src/cef/binary_distrib directory.

See the make_distrib.py script for additional usage options.

The resulting binary distribution can then be built using CMake and platform toolchains. See the README.txt file included with the binary distribution for more information.

Build Notes

This section summarizes build-related requirements and options.

  • Building on most platforms will require at least 8GB of system memory.
  • Ninja must be used when building newer CEF/Chromium branches.
  • Clang is used by default for compiling/linking Chromium/CEF on macOS in all branches, Linux starting in 2063 branch, and Windows starting in 3282 branch.
  • GYP is supported by 2785 branch and older. GN is supported by 2785 branch and newer, and required starting with 2840 branch. Set CEF_USE_GN=1 to build 2785 branch with GN instead of GYP.
  • To perform a 64-bit build on Windows (any branch) or macOS (branch 2171 or older) set GYP_DEFINES=target_arch=x64 (GYP only) or build the out/[Debug|Release]_GN_x64 target (GN only). To perform a 32-bit Linux build on a 64-bit Linux system see instructions on the AutomatedBuildSetup Wiki page.
  • To perform an “official” build set GYP_DEFINES=buildtype=Official (GYP only) or GN_DEFINES=is_official_build=true (GN only). This will disable debugging code and enable additional link-time optimizations in Release builds. See instructions on the AutomatedBuildSetup Wiki page for additional official build recommendations.
  • Windows -
    • If multiple versions of Visual Studio are installed on your system you can set the GYP_MSVS_VERSION environment variable to create project files for that version. For example, set the value to "2015" for VS2015 or "2017" for VS2017. Check the Chromium documentation for the correct value when using other Visual Studio versions.
    • If you wish to use Visual Studio for debugging and compiling in combination with a Ninja build you can set GYP_GENERATORS=ninja,msvs-ninja (GYP only) or GN_ARGUMENTS=--ide=vs2017 --sln=cef --filters=//cef/* (GN only) to generate both Ninja and VS project files. Visual Studio is supported only for debugging and compiling individual source files -- it will not build whole targets successfully. You must use Ninja when building CEF/Chromium targets.
    • For best local developer (non-official debug) build-time performance:
      • When using VS2015 set GN_DEFINES=is_win_fastlink=true for improved compile and link time.
      • When using VS2017 set GN_DEFINES=use_jumbo_build=true for improved compile and link time.
      • Component builds are supported by 3202 branch and newer and significantly reduce link time. Add is_component_build=true to GN_DEFINES in combination with the above VS-version-specific values. Component builds cannot be used to create a CEF binary distribution. See issue #1617 for details.
  • macOS -
    • The combination of deployment target and base SDK version will determine the platforms supported by the resulting binaries. For proper functioning you must use the versions specified under build requirements for each branch.
    • 32-bit builds are no longer supported with 2272 branch and newer. See here for the Chromium announcement.
  • Linux -
    • CEF is developed and tested on the Ubuntu version specified in the "Release Branches" section. It should be possible to build and run CEF on other compatible Linux distributions but this is untested.
    • The libgtkglext1-dev package is required in branch 1547 and newer to support the off-screen rendering example in cefclient. This is only a requirement for cefclient and not a requirement for other applications using CEF.

Updated 2020-03-05

 

cef / MasterBuildQuickStart

This Wiki page provides a quick-start guide for creating a 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 CEF Forum or Issue Tracker may be lost or reverted.



Overview

This page provides a quick-start guide for setting up a minimal development environment and building the master branch of Chromium/CEF for development purposes. For a comprehensive discussion of the available tools and configurations visit the BranchesAndBuilding Wiki page.

This guide is NOT intended for:

  • Those seeking a prebuilt binary distribution for use in third-party apps. Go here instead.
  • Those seeking to build the binary distribution in a completely automated manner. Go here instead.

Development systems can be configured using dedicated hardware or a VMwareParallels or VirtualBox virtual machine.

The below steps can often be used to develop the most recent release branch of CEF/Chromium in addition to the master branch. Chromium build requirements change over time so review the build requirements listed on the BranchesAndBuildingWiki page before attempting 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 file structure will be used on all platforms. "~" can be any path that does not include spaces or special characters. We'll be building this directory structure 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 file structure you can develop multiple CEF/Chromium branches side-by-side. For example, repeat the below instructions using "chromium_git1" as the directory name instead of "chromium_git".

Windows Setup

What's Required

  • Windows Build Requirements as listed on the BranchesAndBuilding Wiki page.
  • Install the exact Windows SDK version specified in the default location to avoid build issues.
  • At least 8GB of RAM and 40GB of free disk space.
  • Approximately 2 hours with a fast internet connection (25Mbps) and fast build machine (2.6Ghz+, 4+ logical cores).

Step-by-step Guide

All of the below commands should be run using the system "cmd.exe" and not a Cygwin shell.

1. Create the following directories.

c:\code\automate
c:\code\chromium_git

WARNING: If you change the above directory names/locations make sure to (a) use only ASCII characters and (b) choose a short file path (less than 35 characters total). Otherwise, some tooling may fail later in the build process due to invalid or overly long file paths.

2. Download depot_tools.zip and extract to "c:\code\depot_tools". Do not use drag-n-drop or copy-n-paste extract from Explorer, this will not extract the hidden ".git" folder which is necessary for depot_tools to auto-update itself. You can use "Extract all..." from the context menu though. 7-zip is also a good tool for this.

3. Run "update_depot_tools.bat" to install Python and Git.

cd c:\code\depot_tools
update_depot_tools.bat

4. Add the "c:\code\depot_tools" folder to your system PATH. For example, on Windows 10:

  • Run the "SystemPropertiesAdvanced" command.
  • Click the "Environment Variables..." button.
  • Double-click on "Path" under "System variables" to edit the value.

5. Download the automate-git.py script to "c:\code\automate\automate-git.py".

6. Create the "c:\code\chromium_git\update.bat" script with the following contents.

set GN_DEFINES=use_jumbo_build=true is_component_build=true
# Use vs2017 or vs2019 as appropriate.
set GN_ARGUMENTS=--ide=vs2019 --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 to download. CEF source code will be downloaded to "c:\code\chromium_git\cef" and Chromium source code will be downloaded to "c:\code\chromium_git\chromium\src". After download completion the CEF source code will be copied to "c:\code\chromium_git\chromium\src\cef".

cd c:\code\chromium_git
update.bat

7. Create the "c:\code\chromium_git\chromium\src\cef\create.bat" script with the following contents.

set GN_DEFINES=use_jumbo_build=true is_component_build=true
# Use vs2017 or vs2019 as appropriate.
set GN_ARGUMENTS=--ide=vs2019 --sln=cef --filters=//cef/*
call cef_create_projects.bat

Run the "create.bat" script to generate Ninja and Visual Studio project files.

cd c:\code\chromium_git\chromium\src\cef
create.bat

This will generate a "c:\code\chromium_git\chromium\src\out\Debug_GN_x86\cef.sln" file that can be loaded in Visual Studio for debugging and compiling individual files. Replace “x86” with “x64” in this path to work with the 64-bit build instead 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 in the GN configuration (BUILD.gn file).

8. Create a Debug build of CEF/Chromium using Ninja. Replace “x86” with “x64” in the below example to generate a 64-bit build instead of a 32-bit build. Edit the CEF source code at "c:\code\chromium_git\chromium\src\cef" and repeat this step multiple times to perform incremental builds while developing.

cd c:\code\chromium_git\chromium\src
ninja -C out\Debug_GN_x86 cef

9. Run the resulting cefclient sample application.

cd c:\code\chromium_git\chromium\src
out\Debug_GN_x86\cefclient.exe

See the Windows debugging guide for detailed debugging instructions.

Mac OS X Setup

What's Required

  • macOS Build Requirements as listed on the BranchesAndBuilding Wiki page.
  • At least 8GB of RAM and 40GB of free disk space.
  • Approximately 2 hours 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 the absolute path must be used. Environment variables described in this section can be added to your "~/.bash_profile" file to persist them across sessions.

1. Create the following directories.

mkdir ~/code
mkdir ~/code/automate
mkdir ~/code/chromium_git

2. Download "~/code/depot_tools" using Git.

cd ~/code
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

3. Add the "~/code/depot_tools" directory to your PATH. Note the use of an absolute path here.

export PATH=/Users/marshall/code/depot_tools:$PATH

4. Download the automate-git.py script to "~/code/automate/automate-git.py".

5. Create the "~/code/chromium_git/update.sh" script with the following contents.

#!/bin/bash
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 executable permissions.

cd ~/code/chromium_git
chmod 755 update.sh

Run the "update.sh" script and wait for CEF and Chromium source code to download. CEF source code will be downloaded to "~/code/chromium_git/cef" and Chromium source code will be downloaded to "~/code/chromium_git/chromium/src". After download completion the CEF 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 the following contents.

#!/bin/bash
export GN_DEFINES=use_jumbo_build=true
./cef_create_projects.sh

Give it executable permissions.

cd ~/code/chromium_git/chromium/src/cef
chmod 755 create.sh

Run the "create.sh" script to create Ninja project files. Repeat this step if you change the project configuration or add/remove files in the GN configuration (BUILD.gn file).

cd ~/code/chromium_git/chromium/src/cef
./create.sh

7. Create a Debug build of CEF/Chromium using Ninja. Edit the CEF source code at "~/code/chromium_git/chromium/src/cef" and repeat this step multiple times to perform incremental builds while developing.

cd ~/code/chromium_git/chromium/src
ninja -C out/Debug_GN_x64 cef

8. Run the resulting cefclient sample application.

cd ~/code/chromium_git/chromium/src
open out/Debug_GN_x64/cefclient.app

See the Mac OS X debugging guide for detailed debugging instructions.

Linux Setup

What's Required

  • Linux Build Requirements as listed on the BranchesAndBuilding Wiki page.
  • Building with other versions or distros has not been tested and may experience issues.
  • At least 6GB of RAM and 40GB of free disk space.
  • Approximately 2 hours 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 the absolute path must be used. Environment variables described in this section can be added to your "~/.profile" or "~/.bashrc" file to persist them across sessions.

1. Create the following directories.

mkdir ~/code
mkdir ~/code/automate
mkdir ~/code/chromium_git

2. Download and run "~/code/install-build-deps.sh" to install build dependencies. Answer Y (yes) to all of the questions.

cd ~/code
sudo apt-get install curl
curl 'https://chromium.googlesource.com/chromium/src/+/master/build/install-build-deps.sh?format=TEXT' | base64 -d > install-build-deps.sh
chmod 755 install-build-deps.sh
sudo ./install-build-deps.sh --no-arm --no-chromeos-fonts --no-nacl

3. Install the "libgtkglext1-dev" package required by the cefclient sample application.

sudo apt-get install libgtkglext1-dev

4. Download "~/code/depot_tools" using Git.

cd ~/code
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

5. Add the "~/code/depot_tools" directory to your PATH. Note the use of an absolute path here.

export PATH=/home/marshall/code/depot_tools:$PATH

6. Download the "~/automate/automate-git.py" script.

cd ~/code/automate
wget https://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
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 executable permissions.

cd ~/code/chromium_git
chmod 755 update.sh

Run the "update.sh" script and wait for CEF and Chromium source code to download. CEF source code will be downloaded to "~/code/chromium_git/cef" and Chromium source code will be downloaded to "~/code/chromium_git/chromium/src". After download completion the CEF 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 the following contents.

#!/bin/bash
export GN_DEFINES=use_jumbo_build=true
./cef_create_projects.sh

Give it executable permissions.

cd ~/code/chromium_git/chromium/src/cef
chmod 755 create.sh

Run the "create.sh" script to create Ninja project files. Repeat this step if you change the project configuration or add/remove files in the GN configuration (BUILD.gn file).

cd ~/code/chromium_git/chromium/src/cef
./create.sh

9. Create a Debug build of CEF/Chromium using Ninja. Edit the CEF source code at "~/code/chromium_git/chromium/src/cef" and repeat this step multiple times 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 cef chrome_sandbox

10. Set up the Linux SUID sandbox.

# This environment variable should be set at all times.
export CHROME_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 BUILDTYPE=Debug_GN_x64 ./build/update-linux-sandbox.sh

11. Run the cefclient sample application.

cd ~/code/chromium_git/chromium/src
./out/Debug_GN_x64/cefclient

See the Linux debugging guide for detailed debugging instructions.

Next Steps

  • If you're seeking a good code editor on Linux check out the Eclipse and Emacs tutorials.
  • Review the Tutorial and GeneralUsage Wiki pages for details on CEF implementation and usage.
  • Review the Chromium debugging guide for WindowsMac OS X or Linux.
  • When you’re ready to contribute your changes back to the CEF project see the ContributingWithGit Wiki page for instructions on creating a pull request.

Updated 2020-02-06

posted @ 2020-03-24 18:39  Bigben  阅读(1335)  评论(0编辑  收藏  举报