标签:code padding order 源代码 run font version mpi put
依赖软件参考
本文参考官方网站上的jcef编译过程
编译成功的环境如下:
以上的软件也是官网上要求安装的软件,不过版本稍有不同,官网上的版本要求如下:
VS官方是建议使用2015版本。
另外在64位机器上编译,jdk最好装64位的,由于64位的机器默认编译64位的依赖,因此,32位jdk找到的依赖会报错,后面会提到出错后的处理
h@DESKTOP-8K18HPL MINGW64 ~ $ cd /d/learn/jecf/ ? h@DESKTOP-8K18HPL MINGW64 /d/learn/jecf $ git clone https://bitbucket.org/chromiumembedded/java-cef.git src Cloning into ‘src‘… remote: Counting objects: 3710, done. remote: Compressing objects: 100% (1758/1758), done. remote: Total 3710 (delta 2461), reused 2576 (delta 1682) Receiving objects: 100% (3710/3710), 27.49 MiB | 68.00 KiB/s, done. Resolving deltas: 100% (2461/2461), done. ? h@DESKTOP-8K18HPL MINGW64 /d/learn/jecf $
到了这一步就虽然可以执行make了,make过程有个问题make是需要从Google Storage 下载 clang-format,这个步骤执行一次即可;国内的用户需要设置代理才可以,不然会停留在 -- Downloading clang-format from Google Storage...
这一步 输出如下:
-- Found PythonInterp: D:/Python27/python.exe (found version "2.7.13") -- Found JNI: C:/jdk1.8.0_121_x86/lib/jawt.lib (Required is at least version "1.7") -- Generating native/jcef_version.h file… File native/jcef_version.h is already up to date. -- Downloading clang-format from Google Storage…
执行make 前,设置cmd代理:
set http_proxy=http://{ip}:{port} set https_proxy=http://{ip}:{port}
执行make,参考下面官网提供的make流程命令
# Enter the JCEF source code directory. cd /path/to/java-cef/src ? # Create and enter the `jcef_build` directory. # The `jcef_build` directory name is required by other JCEF tooling # and should not be changed. mkdir jcef_build && cd jcef_build ? # Linux: Generate 64-bit Unix Makefiles. cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .. # Build using Make. make -j4 ? # Mac OS X: Generate 64-bit Xcode project files. cmake -G "Xcode" -DPROJECT_ARCH="x86_64" .. # Open jcef.xcodeproj in Xcode # - Select Scheme > Edit Scheme and change the "Build Configuration" to "Release" # - Select Product > Build. ? # Windows: Generate 64-bit VS2015 project files. cmake -G "Visual Studio 14 Win64" .. # 32 bit # cmake -G "Visual Studio 14" .. # Open jcef.sln in Visual Studio # - Select Build > Configuration Manager and change the "Active solution configuration" to "Release" # - Select Build > Build Solution.
若这个步骤出现JDK依赖错误,通常是使用64 bit 的机器上使用32 bit的JDK,make的时候,看最后的输出,
-- Java directory: C:/jdk1.8.0_121_x86 -- JNI libraries: C:/jdk1.8.0_121_x86/lib/jawt.lib;C:/jdk1.8.0_121_x86/lib/jvm.lib -- JNI include directories: C:/jdk1.8.0_121_x86/include;C:/jdk1.8.0_121_x86/include/win32;C:/jdk1.8.0_121_x86/include -- Configuring done -- Generating done
上面的输出可以看到,Java directory和JNI libraries 选择了32位的JDK的路径,重新安装JDK和配置了64 bit JDK到环境变量中,删除jcef build 中的所有文件,重新执行make 步骤即可。
执行完成后输入如下:
-- Configuring done -- Generating done -- Build files have been written to: D:/learn/jecf/src/jcef_build
由于JCEF是java对CEF的封装,因此还是需要依赖CEF的,CEF及相关的bridge编译使用VS来完成的。
进入jcef_build目录,打开jcef.sln
将解决方案的项目配置由 debug 改成release ,然后直接生成,生产成功后,输出如下:
5>------ 已跳过生成: 项目: ALL_BUILD, 配置: Debug x64 ------
5>没有为此解决方案配置选中要生成的项目
========== 生成: 成功 4 个,失败 0 个,最新 0 个,跳过 1 个 ==========
执行compile.bat win64
32 bit 执行 compile.bat win32
D:\learn\jecf\src\tools>compile.bat win64 D:\learn\jecf\src\java\tests\detailed\handler\binding_test.html -> D:\learn\jecf\src\out\win64\tests\detailed\handler\binding_test.html D:\learn\jecf\src\java\tests\detailed\handler\binding_test2.html -> D:\learn\jecf\src\out\win64\tests\detailed\handler\binding_test2.html D:\learn\jecf\src\java\tests\detailed\handler\localstorage.html -> D:\learn\jecf\src\out\win64\tests\detailed\handler\localstorage.html D:\learn\jecf\src\java\tests\detailed\handler\spellcheck.html -> D:\learn\jecf\src\out\win64\tests\detailed\handler\spellcheck.html D:\learn\jecf\src\java\tests\detailed\handler\transparency.html -> D:\learn\jecf\src\out\win64\tests\detailed\handler\transparency.html 复制了 5 个文件 D:\learn\jecf\src\java\tests\detailed\handler\logo.png -> D:\learn\jecf\src\out\win64\tests\detailed\handler\logo.png 复制了 1 个文件 ? D:\learn\jecf\src\tools>run.bat win64 Release detailed ERROR: Native build output path does not exist ? D:\learn\jecf\src\tools>
执行run.bat win64 Release detailed
32 bit 执行 run.bat win32 Release detailed
得到一个嵌入了浏览器的AWT界面的java应用,在地址栏输入https://html5test.com/
,可以看到得到的分数基本与安装的Chrome一致
若VS没有修改项目配置为release,执行时候报Release 路径没有找到
执行 make_distrib.bat win64
32 bit 执行 make_distrib.bat win32
D:\learn\jecf\src\tools>make_distrib.bat win64
ERROR: Native Release build output path does not exist
若VS没有修改项目配置为release,同样执行时候报Release 路径没有找到
若执行成功,在src目录下会增加一个binary_distrib的文件夹,里面就是打包好的分发的文件了。
进入binary_distrib执行run.bat,运行得到与编译后的测试一致的应用;
至此,编译jcef的过程结束
标签:code padding order 源代码 run font version mpi put
原文地址:https://www.cnblogs.com/JpgCode/p/9397166.html