Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1162|回复: 2
打印 上一主题 下一主题

cef下载编译

[复制链接]

1228

主题

1997

帖子

7582

积分

认证用户组

Rank: 5Rank: 5

积分
7582
跳转到指定楼层
楼主
发表于 2022-9-19 19:31:09 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 Qter 于 2022-9-19 19:37 编辑

https://blog.csdn.net/weixin_40355471/article/details/120762849
CEF( Chromium Embedded Framework Chromium嵌入式框架)
编译环境:cmake-3.21.0-rc3+qt5.13.0+vs2017.


资源下载
cmake官网下载地址,选择Windows x64 ZIP版本:
https://cmake.org/download/
CEF是二次构建,下载源码包:
https://cef-builds.spotifycdn.com/index.html#windows32
我下载的是:cef_binary_85.3.12+g3e94ebf+chromium-85.0.4183.121_windows32.tar.bz2

https://bitbucket.org/chromiumembedded/cef/downloads/?tab=branches
2020-10-24

CEF库libcef_dll_wrapper.lib的编译
资源下载后解压缩,使用cmake打开,选择源码路径和构建目录,点击configure选择vs2017,再点击generate生成vs工程文件。

在构建目录下生成了cef.sln文件,使用vs2017打开,构建libcef_dll_wrapper即可生成静态库libcef_dll_wrapper.lib,debug和release版本都可以构建。
(ps,libcef_dll_wrapper和cefsimple工程,属性-配置属性-C/C+±代码生成-运行库,debug模式下都选多线程调试(/MTd),release模式下都选择多线程(/MT))


cefsimple样例编译运行
构建生成libcef_dll_wrapper.lib后,编译cefsimple工程,在\build\tests\cefsimple\Debug\目录生成cefsimple.exe可执行文件,双击打开程序默认访问google网站(需要fq),打开源码中\cef_binary_85.3.12_windows32\tests\cefsimple\simple_app.cc文件,把默认访问网址修改为https://www.baidu.com,即可正常访问。

效果图


遇到的问题
1、C2440 “初始化”: 无法从“R (__cdecl *)(base::internal::BindStateBase *,conditional<_Test,const std::string&,const std::string&>::type)”转换为“PolymorphicInvoke” libcef_dll_wrapper
刚开始下载的CEF版本是:cef_binary_94.4.9+g09ee681+chromium-94.0.4606.71_windows32,使用这个版本编译libcef_dll_wrapper工程时会报这个错误,最后选择较稳定的版本(cef_binary_85.3.12+g3e94ebf+chromium-85.0.4183.121_windows32.tar.bz2),规避这个错误。

2、MSB3073命令“setlocal;c101008d Failed to write the updated manifest to the resource of file
编译cefsimple工程时,在debug模式下会报这两个错误,release模式不报错;
解决:项目-属性-配置属性-链接器-调试,把生成调试信息改为否,即可解决。

————————————————
版权声明:本文为CSDN博主「架相」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。


回复

使用道具 举报

1228

主题

1997

帖子

7582

积分

认证用户组

Rank: 5Rank: 5

积分
7582
沙发
 楼主| 发表于 2022-9-19 19:31:36 | 只看该作者
https://www.likecs.com/show-203544182.html
[backcolor=transparent !important]一、下载cef
[backcolor=transparent !important]http://opensource.spotify.com/cefbuilds/index.html
[backcolor=transparent !important]二、cmake编译
[backcolor=transparent !important]
[backcolor=transparent !important]三、vs2017编译
[backcolor=transparent !important]1.打开build里面编译好的cef.sln项目
[backcolor=transparent !important]2.debug win32模式下出现以下问题
[backcolor=transparent !important]2-1.debug配置 生成事件-生成后事件 执行异常
[backcolor=transparent !important]
Windows:32位调试版本无法使用cef_sandbox.lib添加清单
[backcolor=transparent !important]如上,看起来这只是Debug版本的问题,您必须在链接器选项中关闭生成调试信息。分别对cefclient,cefsimple,ceftests三个项目关闭生成调试信息,release版本是没这个问题的。
[backcolor=transparent !important]2-2.ceftests项目未找到匹配令牌
[backcolor=transparent !important]替换"か"为"demo"
[backcolor=transparent !important]

[backcolor=transparent !important]2-3.警告被视为错误
[backcolor=transparent !important]
[backcolor=transparent !important]配置-c/c++-常规-将警告视为错误改为否


回复 支持 反对

使用道具 举报

1228

主题

1997

帖子

7582

积分

认证用户组

Rank: 5Rank: 5

积分
7582
板凳
 楼主| 发表于 2022-9-24 17:41:45 | 只看该作者
本帖最后由 Qter 于 2022-9-24 17:49 编辑

---------------debug编译----------------
1. 替换"か"为"demo"


2. error C2220: 警告被视为错误 - 没有生成“object”文件


VS2017菜单 - 项目 - 属性 - 配置属性 - C/C++ - 常规 - 将警告视为错误 修改为 否,重新编译即可。




3. eneral error c101008d: Failed to write the updated manifest to the resource of file

删除生成后事件

  1. <font face="-apple-system, SF UI Text, Arial, PingFang SC, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, sans-serif, SimHei, SimSun"><font color="#4d4d4d">setlocal
  2. mt.exe -nologo -manifest "E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/tests/ceftests/resources/win/ceftests.exe.manifest" "E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/tests/ceftests/resources/win/compatibility.manifest" -outputresource:"E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/ceftests.exe";#1
  3. if %errorlevel% neq 0 goto :cmEnd
  4. :cmEnd
  5. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  6. :cmErrorLevel
  7. exit /b %1
  8. :cmDone
  9. if %errorlevel% neq 0 goto :VCEnd
  10. setlocal
  11. E:\gitcode\ElectronLab\mCloudQt\cmake\cmake-3.21.0-rc3-windows-x86_64\bin\cmake.exe -E copy_if_different E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/Debug/chrome_elf.dll E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/chrome_elf.dll
  12. if %errorlevel% neq 0 goto :cmEnd
  13. :cmEnd
  14. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  15. :cmErrorLevel
  16. exit /b %1
  17. :cmDone
  18. if %errorlevel% neq 0 goto :VCEnd
  19. setlocal
  20. E:\gitcode\ElectronLab\mCloudQt\cmake\cmake-3.21.0-rc3-windows-x86_64\bin\cmake.exe -E copy_if_different E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/Debug/d3dcompiler_47.dll E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/d3dcompiler_47.dll
  21. if %errorlevel% neq 0 goto :cmEnd
  22. :cmEnd
  23. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  24. :cmErrorLevel
  25. exit /b %1
  26. :cmDone
  27. if %errorlevel% neq 0 goto :VCEnd
  28. setlocal
  29. E:\gitcode\ElectronLab\mCloudQt\cmake\cmake-3.21.0-rc3-windows-x86_64\bin\cmake.exe -E copy_if_different E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/Debug/libcef.dll E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/libcef.dll
  30. if %errorlevel% neq 0 goto :cmEnd
  31. :cmEnd
  32. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  33. :cmErrorLevel
  34. exit /b %1
  35. :cmDone
  36. if %errorlevel% neq 0 goto :VCEnd
  37. setlocal
  38. E:\gitcode\ElectronLab\mCloudQt\cmake\cmake-3.21.0-rc3-windows-x86_64\bin\cmake.exe -E copy_if_different E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/Debug/libEGL.dll E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/libEGL.dll
  39. if %errorlevel% neq 0 goto :cmEnd
  40. :cmEnd
  41. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  42. :cmErrorLevel
  43. exit /b %1
  44. :cmDone
  45. if %errorlevel% neq 0 goto :VCEnd
  46. setlocal
  47. E:\gitcode\ElectronLab\mCloudQt\cmake\cmake-3.21.0-rc3-windows-x86_64\bin\cmake.exe -E copy_if_different E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/Debug/libGLESv2.dll E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/libGLESv2.dll
  48. if %errorlevel% neq 0 goto :cmEnd
  49. :cmEnd
  50. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  51. :cmErrorLevel
  52. exit /b %1
  53. :cmDone
  54. if %errorlevel% neq 0 goto :VCEnd
  55. setlocal
  56. E:\gitcode\ElectronLab\mCloudQt\cmake\cmake-3.21.0-rc3-windows-x86_64\bin\cmake.exe -E copy_if_different E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/Debug/snapshot_blob.bin E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/snapshot_blob.bin
  57. if %errorlevel% neq 0 goto :cmEnd
  58. :cmEnd
  59. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  60. :cmErrorLevel
  61. exit /b %1
  62. :cmDone
  63. if %errorlevel% neq 0 goto :VCEnd
  64. setlocal
  65. E:\gitcode\ElectronLab\mCloudQt\cmake\cmake-3.21.0-rc3-windows-x86_64\bin\cmake.exe -E copy_if_different E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/Debug/v8_context_snapshot.bin E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/v8_context_snapshot.bin
  66. if %errorlevel% neq 0 goto :cmEnd
  67. :cmEnd
  68. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  69. :cmErrorLevel
  70. exit /b %1
  71. :cmDone
  72. if %errorlevel% neq 0 goto :VCEnd
  73. setlocal
  74. E:\gitcode\ElectronLab\mCloudQt\cmake\cmake-3.21.0-rc3-windows-x86_64\bin\cmake.exe -E copy_directory E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/Debug/swiftshader E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/swiftshader
  75. if %errorlevel% neq 0 goto :cmEnd
  76. :cmEnd
  77. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  78. :cmErrorLevel
  79. exit /b %1
  80. :cmDone
  81. if %errorlevel% neq 0 goto :VCEnd
  82. setlocal
  83. E:\gitcode\ElectronLab\mCloudQt\cmake\cmake-3.21.0-rc3-windows-x86_64\bin\cmake.exe -E copy_if_different E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/Resources/cef.pak E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/cef.pak
  84. if %errorlevel% neq 0 goto :cmEnd
  85. :cmEnd
  86. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  87. :cmErrorLevel
  88. exit /b %1
  89. :cmDone
  90. if %errorlevel% neq 0 goto :VCEnd
  91. setlocal
  92. E:\gitcode\ElectronLab\mCloudQt\cmake\cmake-3.21.0-rc3-windows-x86_64\bin\cmake.exe -E copy_if_different E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/Resources/cef_100_percent.pak E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/cef_100_percent.pak
  93. if %errorlevel% neq 0 goto :cmEnd
  94. :cmEnd
  95. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  96. :cmErrorLevel
  97. exit /b %1
  98. :cmDone
  99. if %errorlevel% neq 0 goto :VCEnd
  100. setlocal
  101. E:\gitcode\ElectronLab\mCloudQt\cmake\cmake-3.21.0-rc3-windows-x86_64\bin\cmake.exe -E copy_if_different E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/Resources/cef_200_percent.pak E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/cef_200_percent.pak
  102. if %errorlevel% neq 0 goto :cmEnd
  103. :cmEnd
  104. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  105. :cmErrorLevel
  106. exit /b %1
  107. :cmDone
  108. if %errorlevel% neq 0 goto :VCEnd
  109. setlocal
  110. E:\gitcode\ElectronLab\mCloudQt\cmake\cmake-3.21.0-rc3-windows-x86_64\bin\cmake.exe -E copy_if_different E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/Resources/cef_extensions.pak E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/cef_extensions.pak
  111. if %errorlevel% neq 0 goto :cmEnd
  112. :cmEnd
  113. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  114. :cmErrorLevel
  115. exit /b %1
  116. :cmDone
  117. if %errorlevel% neq 0 goto :VCEnd
  118. setlocal
  119. E:\gitcode\ElectronLab\mCloudQt\cmake\cmake-3.21.0-rc3-windows-x86_64\bin\cmake.exe -E copy_if_different E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/Resources/devtools_resources.pak E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/devtools_resources.pak
  120. if %errorlevel% neq 0 goto :cmEnd
  121. :cmEnd
  122. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  123. :cmErrorLevel
  124. exit /b %1
  125. :cmDone
  126. if %errorlevel% neq 0 goto :VCEnd
  127. setlocal
  128. E:\gitcode\ElectronLab\mCloudQt\cmake\cmake-3.21.0-rc3-windows-x86_64\bin\cmake.exe -E copy_if_different E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/Resources/icudtl.dat E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/icudtl.dat
  129. if %errorlevel% neq 0 goto :cmEnd
  130. :cmEnd
  131. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  132. :cmErrorLevel
  133. exit /b %1
  134. :cmDone
  135. if %errorlevel% neq 0 goto :VCEnd
  136. setlocal
  137. E:\gitcode\ElectronLab\mCloudQt\cmake\cmake-3.21.0-rc3-windows-x86_64\bin\cmake.exe -E copy_directory E:/gitcode/ElectronLab/mCloudQt/cef/cef_binary_85.3.13+gcd6cbe0+chromium-85.0.4183.121_windows32/Resources/locales E:/gitcode/ElectronLab/mCloudQt/cef/chromiumembedded-cef-cd6cbe008b12/build/tests/ceftests/Debug/locales
  138. if %errorlevel% neq 0 goto :cmEnd
  139. :cmEnd
  140. endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  141. :cmErrorLevel
  142. exit /b %1
  143. :cmDone
  144. if %errorlevel% neq 0 goto :VCEnd</font></font>
复制代码


-----release编译----

1. error C2220: 警告被视为错误 - 没有生成“object”文件


VS2017菜单 - 项目 - 属性 - 配置属性 - C/C++ - 常规 - 将警告视为错误 修改为 否,重新编译即可。


回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-5-4 00:14 , Processed in 0.063059 second(s), 21 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表