How to Build a Chromium Embedded Framework (CEF) Project on Windows 11

Madhawa Polkotuwa
3 min readMay 14, 2024

--

Welcome to my step-by-step guide on building a Chromium Embedded Framework (CEF) project on Windows 11. In this tutorial, I’ll walk you through the entire process, from setting up your development environment to running your first CEF-based application. By the end, you’ll have a working CEF project and a better understanding of how to embed a Chromium web browser within your own applications.

What is CEF?

Chromium Embedded Framework (CEF) is an open-source software framework for embedding a Chromium web browser within another application. This powerful tool allows developers to integrate web browsing capabilities directly into their projects, enabling the creation of rich, interactive user interfaces with ease.

Prerequisites

Before we begin, ensure you have the following tools installed on your Windows 11 PC:

Step-by-Step Guide

1. Setting Up the Environment

First, install the necessary tools. Make sure to add Python to your PATH environment variable.

2. Cloning the CEF Project Repository

Open a terminal and clone the CEF project repository using Git:

git clone https://bitbucket.org/chromiumembedded/cef-project.git

3. Running CMake and Building the Project

Navigate to the cloned repository and create a new build directory:

cd cef-project
mkdir build
cd build

Run CMake to download the CEF binary distribution and generate build files for your platform:

cmake -G "Visual Studio 17" -A x64 ..

4. Building and Running the Minimal Example

Open the generated Visual Studio project file (cef.sln) and build the solution. Once the build completes, navigate to the build directory and run the minimal example executable. This will launch a simple application with an embedded Chromium browser.

5. Updating the Chrome Browser Version

To update the Chromium browser version used by CEF, follow these steps:

  1. Open the top-level CMakeLists.txt file.
  2. Visit the Spotify automated builder page to find the latest stable CEF version.
  3. Update the CEF_VERSION in the CMakeLists.txt file to the new version.
  4. Re-run the CMake and build commands to incorporate the new version.

6. Creating a Custom Project

To create your own CEF-based project:

  1. Create a new directory named myproject in the root cef-project directory.
  2. Copy the contents of the cef-simple example into your myproject directory.
  3. Update the CMakeLists.txt file in myproject to replace occurrences of cefsimple with myproject.
  4. Add an add_subdirectory(myproject) command to the top-level CMakeLists.txt file.
  5. Re-run the CMake and build commands.

7. Embedding a Local IIS Application

To embed a local IIS application:

  1. Deploy your application to IIS and note the localhost URL.
  2. Update the initial URL in your myproject source code to point to your IIS application.
  3. Build and run the project to see your IIS application embedded within the CEF browser.

Video Tutorial:

Conclusion

Congratulations! You’ve successfully built and run a CEF project on Windows 11. With CEF, you can enhance your applications with powerful web browsing capabilities, making it an invaluable tool for developers across various domains.

If you have any questions or run into issues, feel free to leave a comment below. Don’t forget to like, share, and follow for more tutorials and tech insights.

--

--

No responses yet