Building the 64-bit version of Chromium Embedded Framework on Windows

The Chromium Embedded Framework (CEF for short) is an open source framework for embedding Chromium-based browsers in other applications. The base implementation is targeting C/C++ applications but ports for other languages exist (these include Java, C#, Delphi, Python).

The nightly builds (for various systems and platforms) of CEF are available for download at https://cefbuilds.com/. These include:

  • CEF source code necessary to build your apps with
  • CEF dynamic and static library files (together with its dependencies) that you must use in your application
  • C++ wrappers for the C API
  • source code of two sample applications, one called CefSimple and one called CefClient
  • symbol files for debugging binary distribution of CEF
  • build of CefClient sample app with all dependencies and resources

Building the 64-bit version of the sample applications is not straight forward though. In this article I will show what you have to do make it work.

Prerequisites

The following prerequisites are necessary:

  • Visual Studio 2013
  • CMake tools

Notice: Though CMake should be able to generate projects for Visual Studio 2015, I was not able to make it happen. Moreover, the cef_sandbox.lib lib is built with Visual C++ 2013 which means the modules that are linking it should also be built with the same tool set.

You should download the nightly build of the development branch for Windows 64 bit and unzip it.

Create Visual Studio projects

To create Visual Studio projects run the following command from the CEF’s main folder in a console:

This will create:

  • a VC++ 2013 solution called cef.sln in the main folder
  • VC++ 2013 project files for libcef_dll, cefsimple, cefclient
  • two additional project files called ALL_BUILD and ZERO_CHECK

This is how the content of the CEF folder looks after generating the Visual Studio project and solution files.
cef3

This is how the Visual Studio solutions looks.
cef1

Create 64-bit configurations

Though the download is suppose to represent the 64-bit version of the framework, and the DLLs and LIBs in the Debug and Release folder (i.e. the CEF builds and its dependencies) are indeed built for the x64 platform, the generated projects do not have configurations targeting the x64 platform.

What you have to do is:

  • create configuration for targeting the x64 platform (by copying the settings from x86)
    cef7
  • change the Output Directory for all projects and configurations to be $(SolutionDir)$(Configuration)\ which means the output folder will be the existing Debug or Release folder from the main CEF folder.
    cef8
  • for the libcef_dll project change the Librarian > All Options > Additional options to /machine:X64 %(AdditionalOptions)
    cef9
  • for the cefsimple and cefclient projects change the additional dependencies settings to point to libcef.lib, libcef_dll_wrapper.lib and cef_sandbox.lib, instead of the relative paths as in the project.
    cef10
    This is how the list should look for all platforms and configurations:
  • for the cefsimple and cefclient projects add $(SolutionDir)$(Configuration)\ to the Library Directories for all configurations and platforms
    cef11
  • modify the Post Build Event for the cefsimple and cefclient projects to no longer copy files from the solution’s Debug and Release folders to the project’s Debug and Release folders.

    Initially, the post build event looks like this (for Debug configurations)

    It should be changed to look like this (beware at the output folder indicated by outputresource; it should be the Debug\Release folder in the main folder):

Resources

In the main folder there is a sub-folder called Resources. The entire content of this folder must be copied to the out folders, Debug and/or Release. These files are necessary for the sample applications to run properly.

Building and running

With all these in place you can build the projects. The build should succeed and the content of the Debug folder for instance should look like below.
cef4

You can then run the two sample applications. This is how cefsimple looks.
cef5

This is how cefclient looks.
cef6

6 Comments on "Building the 64-bit version of Chromium Embedded Framework on Windows"


  1. Thank you Marius for all the work you put into this. I have tried to follow every step but the one that modifies the Post Build Event. My experience with build events has only been to use short macros. I cannot find extensive coding in the Post-Build Event (VS 2013 Win7 64bit). Where does all this Post Build Event code reside ? Thanks again. MBP


  2. I should add that it all seems to come together but with error LNK1104: cannot open file ‘libcef.lib’. Also, I am rather confused by all of the Debug and Release folders produced.


  3. How can I hide menu and url bar in cefclient. ? So the page looks like yours version. I have developed an in your way but it requires .net framework to be installed to run. Is there a workaroud for creating a distributable build release version. Which only installs or portable version which does not require any further download of .net framework on the clients system;\.


  4. frankly, I downloaded the stuff .. but how to execute the commands ??
    could you explain better how to proceed ??
    thank you

    OS Windows 10×64

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.