-
Notifications
You must be signed in to change notification settings - Fork 87
Building Cef from source
This Article has not been updated in 4+ years, the information contained within is no longer useful and is only here for references purposes
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).
- CEF Branching and Building
-
Install Depot Tools - follow the
non-cygwin
instructions forWindows
- 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)
-
Create a directory on a drive of your computer (for this tutorial we'll use
c:\cefsource
) -
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
. -
Download the automate.git.py
Python
script toc:\cefsource
-
Open a dos command prompt ( run as administrator )
-
Change directory to
c:\cefsource
-
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 -
At your command prompt, execute the following (Note If you installed
Depot Tools
then it automatically installsPython
):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 buildCEF
intoc:\cefsource\source
folder. The version ofCEF
that will be downloaded is the Dev Channel (master
). Be warned the build will take many hours to complete and download3-4gb
. -
Test your new
CEF
build using thecefclient
test application (c:\cefsource\source\chromium\src\out\Release\cefclient.exe
) -
Copy the
binary_distrib
folder to a safe place (C:\cefsource\source\chromium\src\cef\binary_distrib
). It will be needed to repackage using thecef-binary
project. -
Rinse and repeat building the
x64
variation by appending the--x64-build --force-build
command line arguments. -
Copy the
x64
binary_distrib
folder. -
Use the cef-binary build instructions with your newly created
x86
andx64
packages to repackageCEF
for use withCefSharp
.
If you need to build a different branch of CEF
, use:
python automate-git.py --download-dir=c:\cefsource\source --depot-tools-dir=c:\cefsource\depot_tools --branch=branch_number_here
#####Example of building the 2272
branch
python automate-git.py --download-dir=c:\cefsource\source --depot-tools-dir=c:\cefsource\depot_tools --branch=2272
# at your dos command prompt type
cd C:\cefsource\source\chromium\src\cef
cef_create_projects.bat
when that batch file has finished running, you will find the VS2013 Solution
cef.sln
under
C:\cefsource\source\chromium\src\cef
and all of the CEF
Visual Studio Project files.
NOTE If you run this step sometime later you'll need to make sure the GYP
environment variables from above are set otherwise it won't generate the VS2013
files.
-
automate-git.py
will automatically downloaddepot_tools
by default. If you already havePython 2.7
installed on your machine you can skip downloaddepot_tools
and just execute the script. - You can patch
CEF
if you would like, by dropping patches in theC:\cefsource\source\chromium\src\cef\patch\patches
and editingC:\cefsource\source\chromium\src\cef\patch\patch.cfg
(Specific details of patching are outside the scope of this tutorial). - The automated build script will also download the corresponding version of
Chromium
which is needed to buildCEF
from source, including temporary files your look at> 40gb
in free space required for the latestCEF
master
build at time of writing.
- Investigate other build options like
--no-debug-build
and--minimal-distrib
- Add
--no-update
to look at speeding up build process. - Create powershell script to download relevant pieces, setup
depot_tools
, set environment variables and execute auto build script - Review https://groups.google.com/forum/#!searchin/cefsharp/GYP_DEFINES|sort:relevance/cefsharp/BJLMXl9c204/HMJlp8mZzF0J and add note about building with
mp3
support (also need to include a statement about how the user needs to deal with the licensing implications). - Add section about building
cefclient
andverbose
builds with logging (--build-tests --client-distrib --verbose-build --build-log-file) - Add manual compile example e.g.
D:\projects\cef\2272\chromium\src> ninja -v -Cout\Debug_x64 cefclient cef_unittests