-
Notifications
You must be signed in to change notification settings - Fork 86
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-cygwininstructions 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
Pythonscript toc:\cefsource -
Open a dos command prompt ( run as administrator )
-
Change directory to
c:\cefsource -
Set the
GYPenvironment variables.cd c:\cefsource # SET some GYP environment variables by typing set GYP_GENERATORS=ninja,msvs-ninja set GYP_MSVS_VERSION=2013You are now ready to run the
CEFautomated git workflow -
At your command prompt, execute the following (Note If you installed
Depot Toolsthen it automatically installsPython):python automate-git.py --download-dir=c:\cefsource\source --depot-tools-dir=c:\cefsource\depot_toolsthis will run the
automate-git.pyscript and start downloading the sources needed to buildCEFintoc:\cefsource\sourcefolder. The version ofCEFthat will be downloaded is the Dev Channel (master). Be warned the build will take many hours to complete and download3-4gb. -
Test your new
CEFbuild using thecefclienttest application (c:\cefsource\source\chromium\src\out\Release\cefclient.exe) -
Copy the
binary_distribfolder to a safe place (C:\cefsource\source\chromium\src\cef\binary_distrib). It will be needed to repackage using thecef-binaryproject. -
Rinse and repeat building the
x64variation by appending the--x64-build --force-buildcommand line arguments. -
Copy the
x64binary_distribfolder. -
Use the cef-binary build instructions with your newly created
x86andx64packages to repackageCEFfor 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.pywill automatically downloaddepot_toolsby default. If you already havePython 2.7installed on your machine you can skip downloaddepot_toolsand just execute the script. - You can patch
CEFif you would like, by dropping patches in theC:\cefsource\source\chromium\src\cef\patch\patchesand 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
Chromiumwhich is needed to buildCEFfrom source, including temporary files your look at> 40gbin free space required for the latestCEFmasterbuild at time of writing.
- Investigate other build options like
--no-debug-buildand--minimal-distrib - Add
--no-updateto 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
mp3support (also need to include a statement about how the user needs to deal with the licensing implications). - Add section about building
cefclientandverbosebuilds 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