如果需要自己编译JCEF,可参考以下文档。
虽然是英文的,但是并不难看懂,实在看不懂,在谷歌浏览器右键,选择“翻译成中文”
注意:最新的JCEF需要使用VS2019编译,文章中目前写的是VS2015,请参照JCEF项目中CMakeLists.txt中的注释进行编译,以免安装不必要的软件,浪费不必要的时间(我是踩了个大坑)
windows下编译需安装软件(请以自己的机机型号和最新的文档为准)【我的是Win10】
Cmake 最新版本(安装时可选择是否配置环境变量,也可手动在Path下加入Cmake的bin目录路径)
Git
JDK 1.7或1.8,我用的1.8。
Python 2.6+或3+
Visual studio 2019。安装跟C++开发有关的
PS:还得准备个VPN,Cmake编译时需要下载国外的资源。建议开个按量付费的云服务器编译,选择香港区域,流量选按使用流量付费,一小时几块钱(最新的版本我是在阿里云编译的)
软件装好了,一般不会有什么问题。用到的软件均可在此地址获取:百度网盘 请输入提取码 提取码:hfk2
1.在win10上,如果出现javac指令用不了,可以尝试配置java环境变量 Path 时用完整的路径
2.python安装好以后需要在环境变量 Path 配置安装路径
3.软件安装好后,在cmd命令行测试 python,cmake,javac 指令是否可用
在磁盘下新建一个jcef目录(名字随便取),使用cmd命令行进入此目录
下载jcef工程,建议用git
git clone https://bitbucket.org/chromiumembedded/java-cef.git src
项目下载完之后,进入src目录,打开CMakeLists.txt,把从message(STATUS "Downloading clang-format from Google Storage...")开始的这一块代码给注释了。clang-format这玩意不需要用到,下载很耗时间。
cmd命令行进入src目录
cd src
创建jcef_build目录,不要使用其他名字
mkdir jcef_build && cd jcef_build
执行cmake操作,可以使用Cmake bin目录下的 cmake-gui来操作,记得配置参数(注意,这里看CMakeLists.txt中怎么写的)
cmake -G "Visual Studio 16" -A x64 ..
cmake完成后,jcef_build目录下会生成vs项目。双击jcef.sln打开工程,设置为Release和x64,点击菜单项“生成”>“生成解决方案”,等待编译完成
cmd命令行进入src/tools目录下,执行命令
compile.bat win64
编译完成后,使用以下命令测试是否成功,出现浏览器窗口表示成功了。
run.bat win64 Release detailed
执行脚本,生成项目需要用到的文件,文件生成在 src\binary_distrib\win64\bin\lib 目录下
make_distrib.bat win64
岁在甲子,天下大吉!