Skip to content

Building Cef from source

Alex Maitland edited this page May 19, 2015 · 18 revisions

CEF provides detailed instructions for downloading an building from source. This article attempts to provide an abridged version relevant to building CEF on Windows which can later be repackaged for use with CefSharp. I suggest reading this tutorial in it's entirety before going too far (I'd kick off the depot_tools download and then keep reading).

Requirements:

  • Depot Tools
  • Visual Studio 2013 Community or Professional Update 4
  • Windows 8.1 SDK
  • Lots of Drive Space and Memory!
  • and last but not least a lot of time on your hands

The downloading/building of CEF is very much an automated process. (Generating the VS2013 project files is done manually)

  1. Create a directory on a drive of your computer (for this tutorial we'll use c:\cefsource)

  2. Install Depot Tools (Download zip, extract to folder, add to path, run gclient). For the purpose of this tutorial we'll assume you extracted the zip into c:\cefsource\depot_tools.

  3. Download the automate.git.py Python script to c:\cefsource

  4. Open a dos command prompt ( run as administrator )

  5. Change directory to c:\cefsource

  6. Set the GYP environment variables.

    cd c:\cefsource
    # SET some GYP environment variables by typing
    set GYP_GENERATORS=ninja,msvs-ninja
    set GYP_MSVS_VERSION=2013
    

    You are now ready to run the CEF automated git workflow

  7. At your command prompt, execute the following (Note If you installed Depot Tools then it automatically installs Python):

python automate-git.py --download-dir=c:\cefsource\source --depot-tools-dir=c:\cefsource\depot_tools

this will run the automate-git.py script and start downloading the sources needed to build cef into c:\cefsource\source folder. The version of CEF that will be downloaded is the Dev Channel (master)

If you need to download a different branch of CEF, use:

python automate-git.py --download-dir=c:\cefsource\source --branch=branch_number_here --depot-tools-dir=c:\cefsource\depot_tools

example

python automate-git.py --download-dir=c:\cefsource\source --branch=2272

will download and build the cef branch # 2272

By default the script builds a 32bit version, to build a 64bit version append the --x64-build command line argument.

Note that this script will also download the corresponding version of Chromium which is needed to rebuild CEF from source.

This script will run for a long time ( hours ) and when it is done you will find the Chromium and CEF sources in your c:\cefsource\source folder, binary distributions of CEF in C:\cefsource\source\chromium\src\cef\binary_distrib

You can patch CEF if you would like, by dropping patches in the C:\cefsource\source\chromium\src\cef\patch\patches and editing C:\cefsource\source\chromium\src\cef\patch\patch.cfg

#####To generate Visual Studio 2013 project files

# at your dos command prompt type
cd C:\cefsource\source\cef
cef_create_projects.bat

when that batch file has finished running, you will find the Visual Studio 2013 solution cef.sln under C:\cefsource\source\cef and all of the CEF Visual Studio Project files.

Notes

  • automate-git.py will automatically download depot_tools by default. If you already have Python 2.7 installed on your machine you can skip download depot_tools and just execute the script.
Clone this wiki locally