1.下载CEF SDK
由于需要跑在32位的机器,所以选择下载32位的SDKCEF Automated Builds
选择 Current Stable Build (Preferred) ,这是当前稳定版本,CEF版本118

下载成功解压

2.下载编译工具 CMake
下载地址:CMake
配置CMake指向CEF目录和编译目录

如果没有事先创建build 文件,将会弹窗提示自动创建,选择 Yes

接着选择 vs 版本 2017、平台 Win32

Configure 成功如下图

如果你电脑没有安装 Doxygen,会有个警告

下载安装Doxygen
https://www.doxygen.nl/files/doxygen-1.9.8-setup.exe
重新点 Configure 配置一遍即可
!!!注意:如果你的cef编译路径有中文路径,Configure 的时候可能会出现
Unable to generate Doxyfile template: 1
Call Stack (most recent call first):
CMakeLists.txt:243 (find_package)
!!!不要用中文路径~!!!
改掉中文后,重新点 Configure即可
接着点击 Generate 生成工程文件

3.打开工程文件
>>可以直接在CMake 点击 Open Project按钮
>>也可以去build文件夹双击打开 cef.sln
设置cefsimple 为启动项,按F5 编译工程

不出意外,出现了编译错误


出现了C2440的错误
大概的意思就是 CEF 118 版本 需要 VC++版本2019,需要Visual Studio 2019 及以上的版本编译
而Visual Studio 2017 的VC++版本为 2015,所以最高支持编译CEF 92 版本
所以下载 CEF 92版本,重新编译,就大功告成了!

!!!那是不可能的!!!
!!!那是不可能的!!!
!!!那是不可能的!!!
换了92版本后,跑 cefsimple 项目出现了一个错误,让人发狂
在Debug 模式下,报了个错
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 c101008d Failed to write the updated manifest to the resource of file "C:/cef_binary_92.0.27+g274abcf+chromium-92.0.4515.159_windows32/build/tests/cefsimple/Debug/cefsimple.exe". 鏂囦欢鎴栫洰褰曟崯鍧忎笖鏃犳硶璇诲彇銆? cefsimple C:\cef_binary_92.0.27+g274abcf+chromium-92.0.4515.159_windows32\build\tests\cefsimple\mt.exe 1

经过各种查找,发现的解决方案
1.修改项目属性,不输出 manifest()
2.关闭Windows实时文件防护(Windows 安全中心也关闭)
3.关闭杀毒软件(QQ管家已卸载)
等等
在我电脑统统不行
※实在解决不了,希望路过的大佬能提点下
※但是在 Release 模式下,又是可以正常跑的
而在 Debug 模式下
在CMake 去掉 USE_SANDBOX 的勾选,生成的项目在 Debug 模式下也是可以跑的

注释掉 cefsimple 项目里的 CMakeLists.txt 中 这个句
ADD_WINDOWS_MANIFEST("{CMAKE_CURRENT_SOURCE_DIR}" "{CEF_TARGET}" "exe")
也是可以正常跑的
