首页 > 代码库 > 【WebKit内核 CEF3 】 第一篇:下载分支代码并本地编译

【WebKit内核 CEF3 】 第一篇:下载分支代码并本地编译

关于CEF  Chromium Embedded Framework 简单说就是  WebKit内核的 对外绑定。

当前主流浏览器内核

  1. 一、Trident内核代表产品Internet Explorer,又称其为IE内核。Trident(又称为MSHTML),是微软开发的一种排版引擎。使用Trident渲染引擎的浏览器包括:IE、傲游、世界之窗浏览器、Avant、腾讯TT、Netscape 8、NetCaptor、Sleipnir、GOSURF、GreenBrowser和KKman等。

  2.  

    二、Gecko内核代表作品Mozilla FirefoxGecko是一套开放源代码的、以C++编写的网页排版引擎。Gecko是最流行的排版引擎之一,仅次于Trident。使用它的最著名浏览器有Firefox、Netscape6至9。

  3.  

    三、WebKit内核代表作品Safari、Chromewebkit 是一个开源项目,包含了来自KDE项目和苹果公司的一些组件,主要用于Mac OS系统,它的特点在于源码结构清晰、渲染速度极快。缺点是对网页代码的兼容性不高,导致一些编写不标准的网页无法正常显示。主要代表作品有Safari和Google的浏览器Chrome。

 

 

虽然  win 10后 ,微软开发了 edge  这个兼容 Trident webkit  ,但是不得不说,WebKit内核真快!

webkit 早起于苹果公司的safari .苹果把webkit 开放出去后,谷歌 把这东东优化了,还把自己家的V8引擎集成到自己的浏览器里了。。谷歌浏览器,速度真快。

WebKit is the web browser engine used by Safari, App Store, and many other OS X, iOS, and Linux applications. Web developers can stay updated on feature support, follow development on the blog, 

 

 

浏览器对于web应用起到了决定性的作用。微软捆绑自己操作系统。。自带IE 。。。。不仅慢 卡顿假死 响应慢 兼容差 迭代慢..........一堆问题。谷歌浏览器迅速占领了一部分市场。

把 Chrome 的内核嵌入到桌面程序 ,混合式的开发,越来越常见。

1 基于微软的Web 交互 mshtml 提供了COM接口。但是 卡的要命,兼容差。老版本的上个淘宝都不行........

2 基于其他浏览器内核的 主要是webkit的绑定。提供对其他开发语言的支持。CEF wekit.net 等

3 NW.JS ,这个集成了 node.js 和webkit内核的东东,可以使用html  js 开发本地应用。最新版本的饿了么上家客户端 就是这个技术。

 

看具体场景,选择合适的技术。

我们先说 CEF 3。。。。。

其实就是libcef

libcef 
Chromium嵌入式框架对于嵌入chromium浏览器的其他应用程序来说是一个简单的框架。。其遵循建立于2008年Marshall Greenblatt 的BSD许可协议。基于Google Chromium工程。不像Chromium工程本身,主要集中开发Google Chrome应用程序,CEF聚焦于使用第三方嵌入浏览器的应用程序, 通过提供稳定的API,CEF将chromium底层以及复杂的Blink代码隔离开来,分支发布紧跟chromium发布,以及二进制发布。大多数CEF的特性都有默认的实现,其功能了丰富的功能,较少甚至没有集成工作需要去做。目前全球有超过1亿CEF运行实例,其嵌入在广泛公司和企业的嵌入式产品中。

 

下载代码

https://bitbucket.org/chromiumembedded/cef/downloads/?tab=branches

从上面的官方站点 下载合适版本的代码

注意:分支 2623 是支持XP的最后一个分支。以后都是不支持XP的。

 

开始配置编译环境:参考:http://blog.csdn.net/wangshubo1989/article/details/50167045

http://www.cnblogs.com/visio/p/6295451.html

 

Using CMake 
Starting with 2171 branch the CEF3 sample applications can be built using CMake, a cross-platform open-source build system that can generate project files in many different formats. See the comments at the top of the CMakeLists.txt file included with the binary distribution for platform-specific CMake usage instructions.

这个时候,需要下载CMake了,这是什么鬼? 
CMake是一个跨平台的安装(编译)工具,可以用简单的语句来描述所有平台的安装(编译过程)。他能够输出各种各样的makefile或者project文件,能测试编译器所支持的C++特性,类似UNIX下的automake。 
下载地址: 
https://cmake.org/

下载后安装,没有什么特别的地方。

接下来就是使用cmake了: 
技术分享
Browse Source选择刚刚解压的libcef文件夹,最外面的奥!! 
Browse Build选择要把生成的工程放在哪里。 
点击Generate,然后选择现在使用的VS版本,就可完成。 
技术分享

接下来就可以打开cef.sln了,然后可以运行里面的例子。

 

 

The Chromium Embedded Framework (CEF) is a simple framework for embedding Chromium-based browsers in other applications. This repository hosts a sample project called "cef-project" that can be used as the starting point for third-party applications built using CEF.

Quick Links

  • Project Page - https://bitbucket.org/chromiumembedded/cef-project
  • Tutorial - https://bitbucket.org/chromiumembedded/cef/wiki/Tutorial
  • Support Forum - http://www.magpcss.org/ceforum/

Setup

First install some necessary tools and download the cef-project source code.

1. Install CMake, a cross-platform open-source build system. Version 2.8.12.1 or newer is required.

2. Install Python. Version 2.x is required. If Python is not installed to the default location you can set the PYTHON_EXECUTABLE environment variable before running CMake (watch for errors during the CMake generation step below).

3. Install platform-specific build tools.

  • Linux: Currently supported distributions include Debian Wheezy, Ubuntu Precise, and related. Ubuntu 14.04 64-bit is recommended. Newer versions will likely also work but may not have been tested. Required packages include: build-essential, libgtk2.0-dev, libgtkglext1-dev.
  • macOS: Xcode 6 or newer building on macOS 10.9 (Mavericks) or newer is required. Xcode 8.3 and macOS 10.12 (Sierra) are recommended. The Xcode command-line tools must also be installed. Only 64-bit builds are supported on macOS.
  • Windows: Visual Studio 2013 or newer building on Windows 7 or newer is required. Visual Studio 2015 Update 3 and Windows 10 64-bit are recommended.

4. Download the cef-project source code from the Downloads page or by using Git command-line tools:

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

Build

Now run CMake which will download the CEF binary distribution from the Spotify automated builder and generate build files for your platform. Then build using platform build tools. For example, using the most recent tool versions on each platform:

cd /path/to/cef-project# Create and enter the build directory.mkdir buildcd build# To perform a Linux build using a 32-bit CEF binary distribution on a 32-bit# Linux platform or a 64-bit CEF binary distribution on a 64-bit Linux platform:cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..make -j4 cefclient cefsimple# To perform a macOS build using a 64-bit CEF binary distribution:cmake -G "Xcode" ..# Then, open build\cef.xcodeproj in Xcode and select Product > Build.# To perform a Windows build using a 32-bit CEF binary distribution:cmake -G "Visual Studio 14" ..# Then, open build\cef.sln in Visual Studio 2015 and select Build > Build Solution.# To perform a Windows build using a 64-bit CEF binary distribution:cmake -G "Visual Studio 14 Win64" ..# Then, open build\cef.sln in Visual Studio 2015 and select Build > Build Solution.

CMake supports different generators on each platform. Run cmake --help to list all supported generators. Generators that have been tested with CEF include:

  • Linux: Ninja, Unix Makefiles
  • macOS: Ninja, Xcode 6+
  • Windows: Ninja, Visual Studio 2013+

Ninja is a cross-platform open-source tool for running fast builds using pre-installed platform toolchains (GNU, clang, Xcode or MSVC). See comments in the "third_party/cef/cef_binary_*/CMakeLists.txt" file for Ninja usage instructions.

Next Steps

Here are some activities you might want to try next to gain a better understanding of CEF:

1. Update the CEF version used to build your local copy of cef-project:

  • Visit the Spotify automated builder page to see what CEF versions are available.
  • Change the "CEF_VERSION" value near the top of the top-level CMakeLists.txt file.
  • Re-run the cmake and build commands.

2. Add your own project source code:

  • Create a new "myproject" directory in the root cef-project directory (e.g. "/path/to/cef-project/myproject").
  • Copy the contents of the "third_party/cef/cef_binary_*/cefsimple" directory to "myproject" as a starting point.
  • Add a new add_subdirectory(myproject) command near the end of top-level CMakeLists.txt file after the existing add_subdirectory commands.
  • Change the "CEF_TARGET" and "CEF_HELPER_TARGET" values in "myproject/CMakeLists.txt" from "cefsimple" to "myproject".
  • (Windows only) Rename the "cefclient.exe.manifest" file to "myproject.exe.manifest" in both "myproject/CMakeLists.txt" and the "myproject" directory.
  • Re-run the cmake and build commands.

3. Gain a better understanding of the cefsimple application by reading the Tutorial Wiki page.

4. Fork the cef-project repository using Bitbucket and Git to store the source code for your own CEF-based project. See the ContributingWithGit Wiki page for details (replace all instances of "cef" with "cef-project" in those instructions).

5. Review the GeneralUsage Wiki page for additional details on CEF implementation and usage.

Support and Contributions

If you have any questions about CEF or cef-project please ask on the CEF Forum. If you would like to make contributions please see the "Helping Out" section of the CEF Main Page.

【WebKit内核 CEF3 】 第一篇:下载分支代码并本地编译