当前位置:网站首页>CEF下载,编译工程
CEF下载,编译工程
2022-07-03 09:05:00 【L-Super】
若要使用CEF,需要下载CEF。一般有两种方式:
- 编译源代码:需要使用svn或者git下载Chromium和CEF的源码。
- 自动构建版本:使用编译好内核的半成品,该版本提供了大部分已经编译完成的动态库及资源,只需要开发者手动编译一个wrapper静态库就可以了。
这里为了简化操作,更方便地体验CEF,而不是把大量时间浪费在编译源代码上,采用第二种方法。
下载CEF
官方下载网址:https://cef-builds.spotifycdn.com/index.html
CEF自动构建了多个平台多个版本,这里选择Windows 64位平台的Standard Distribution文件。(国内环境下载有点慢,可使用特殊手段加快下载速度。)
不同平台拥有共同的结构,介绍一下Standard Distribution版本的文件夹结构:
- cmake:包含所有目标共享的CMake配置文件。
- Debug:包含 libcef.dll、 libcef.lib 和构建运行基于 CEF 的应用程序所需的其他组件的调试版本。默认情况下,这些文件应该放在与可执行文件相同的目录中,并作为构建过程的一部分复制到那里。CEF动态库(libcef.dll on Windows, libcef.so on Linux, “Chromium Embedded Framework.framework” on OS X)
- include:包含所有必需的CEF头文件。
- libcef_dll:包含libcef_dll_wrapper静态库的源代码,所有使用CEF C++API的应用程序都必须链接该库。
- Release:同Debug。包含 libcef.dll、 libcef.lib 和其他需要构建并运行基于CEF 的应用程序的发布版本
- Resources:包含 libcef.dll 所需的资源
- tests:演示CEF的用法demo及测试用例等。
每个二进制压缩包里包含一个README.txt文件和一个LICENSE.txt文件,README.txt用以描述平台相关的细节,而LICENSE.txt包含CEF的BSD版权说明。如果你发布了基于CEF的应用,则应该在应用程序的某个地方包含该版权声明。
请参阅二进制发行版中包含的 README.txt 文件,了解哪些文件是必需的,哪些可以安全地省略。
CMake构建
使用CMake进行CEF的项目构建,在Where is the source code
框中选择下载并解压后的cef文件夹,在cef文件夹中创建一个文件夹“build”,在Where to build binaries
框中选择这个build文件夹
依次点击CMake下方的Configure
按钮,Generate
按钮生成文件,我这里使用的是VS2022,同时,把CMAKE_INSTALL_PERFIX
路径改了一下(随意)
然后点击Open Project
就会使用VS打开工程
- ALL_BUILD与ZERO_CHECK:是cmake自动生成的辅助工程。
- cef_gtest和ceftests:都是测试模块
- cefclient:一个包含CEF各种API演示的浏览器程序Demo。
- cefsimple:一个简单的CEF浏览器程序Demo。
- libcef_dll_wrapper:对libcef库的C++代码封装。上述cefclient与cefsimple都会用它。
这里可以直接对cefclient右键设置为启动项,Ctrl + F5
开始执行程序。
等待一会儿,然后程序就执行起来了,默认打开的是谷歌首页,如果打开的空白,是因为无法访问谷歌导致的。
可以直接在VS中搜索www.google.com
去更改代码,发现它在cefclient-browser-main_context_impl.cc
文件里,把它改为www.baidu.com
再运行就正常了。
cefsimple同理,在cefsimple->simpleapp.cc
里
url = command_line->GetSwitchValue("url");
if (url.empty())
url = "http://www.google.com";//改为其他网址即可
);
编译libcef_dll_wrapper
其实最重要的libcef_dll_wrapper是不是发现还没编译,当然不是,我们在编译cefclient的时候,就顺带编译了。
生成路径
build\libcef_dll_wrapper\Debug\libcef_dll_wrapper.lib
我们也可以查看项目,会发现这个库早已经在项目属性里设置好了。
边栏推荐
- Flink学习笔记(八)多流转换
- Install local sources using yum
- MySQL environment variable configuration
- Install database -linux-5.7
- Jestson nano custom root file system creation (supports the smallest root file system of NVIDIA Graphics Library)
- Matlab reads hexadecimal numbers and converts them into signed short
- Nr-prach:prach format and time-frequency domain
- LeetCode每日一题(1362. Closest Divisors)
- QT sub window is blocked, and the main window cannot be clicked after the sub window pops up
- Filter comments to filter out uncommented and default values
猜你喜欢
[CSDN]C1训练题解析_第二部分_Web基础
[CSDN]C1訓練題解析_第三部分_JS基礎
Idea uses the MVN command to package and report an error, which is not available
Leetcode daily question (1162. as far from land as possible)
LeetCode每日一题(931. Minimum Falling Path Sum)
PolyWorks script development learning notes (I) - script development environment
[graduation successful] [1] - tour [Student Management Information System]
Trial of the combination of RDS and crawler
Design and development of biological instruments
数字身份验证服务商ADVANCE.AI顺利加入深跨协 推进跨境电商行业可持续性发展
随机推荐
UCI and data multiplexing are transmitted on Pusch - Part I
专利查询网站
Trial of the combination of RDS and crawler
Process communication - semaphore
MySQL data manipulation language DML common commands
The rise and fall of mobile phones in my perspective these 10 years
Uncle Wang's blog directory [constantly updating]
Filter comments to filter out uncommented and default values
What do software test engineers do? Pass the technology to test whether there are loopholes in the software program
Hudi data management and storage overview
LeetCode每日一题(985. Sum of Even Numbers After Queries)
Spark overview
Construction and test of TFTP server under unbuntu (Debian)
Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 2 --blinker_ Hello_ WiFi (lighting technology - Mobile App control routine)
基于opencv实现桌面图标识别
Leetcode daily question (968. binary tree cameras)
LeetCode每日一题(931. Minimum Falling Path Sum)
Database execution error: SQL_ mode only_ full_ group_ by:
LeetCode每日一题(2109. Adding Spaces to a String)
Nr-prach:prach format and time-frequency domain