【CEF3编译】增加对mp3/mp4等格式支持的编译手记 搭建编译环境的过程中所遇到的问题(1) 2018-5-19

       迫于对现有项目的升级,最近开始考虑更新在项目中所使用到的CEF(Chromium Embedded Framework)浏览器库,但CEF/Chromium出于版权考虑保留了对于mp3/mp4等多媒体格式的支持,没有对外开放。无奈在各个社区中没有找到较新的支持mp3/mp4播放的版本,只得自己动手编译CEF源代码加入对mp3/mp4等多媒体格式的支持。经过多天的资料收集,发现不少前辈在下载代码的环节中遇到了很多问题,于是本着避免重蹈覆辙以及尽量减轻外部环境影响的原则,在某农贸市场买了一个"土豆"

来完成本次的CEF编译工作╮( ̄▽ ̄)╭。

       照例,还是先从master分支开始摸索,折腾成功了,再尝试编译branche。

环境准备(初定):

1、Windows Server 2016 Standard x64 (官方标准: Windows 7 or newer,64-bit OS)。

2、Visual Studio VS2017 15.3.2+ 安装在默认位置。

3、Windows 10.0.15063.486 SDK 安装在默认位置,必须确保SDK的准确版本,以免在后续的编译过程中出现问题。

4、至少8GB的内存以及40GB的硬盘空间(←_← emmmm....,官方标准,仅做参考),在看了某 前辈 在这个问题上趟过的大坑之后,更改配置为: 16GB内存,以及200GB的硬盘空间。

5、6核处理器 2.59GHz(→_→ 官方标准: 4核处理器 2.6GHz)。

6、保持良好通畅且稳定的网络环境。

下载CEF和Chromium的源代码


创建目录结构

c:/code/
  automate/
    automate-git.py   <-- CEF build script
  chromium_git/
    cef/              <-- CEF source checkout
    chromium/
      src/            <-- Chromium source checkout
    update.[bat|sh]   <-- Bootstrap script for automate-git.py
  depot_tools/        <-- Chromium build tools

PS: 以下摘自官方文档:

With this file structure you can develop multiple CEF/Chromium branches side-by-side. For example, repeat the below instructions using "chromium_git1" as the directory name instead of "chromium_git".

WARNING: If you are using VS2017 15.5.* to build 3282 branch then you must add enable_precompiled_headers=false to GN_DEFINES in steps 6 and 7 to avoid a known issue with clang.

通过这个文件结构,您可以并排开发多个CEF / Chromium分支。 例如,请使用“chromium_git1”作为目录名称而不是“chromium_git”来重复以下说明。

警告:如果您使用VS2017 15.5。*构建3282分支,那么您必须在步骤6和7中将GNU DEFINE添加到enable_precompiled_headers = false以避免已知的问题。

WARNING: If you change the above directory names/locations make sure to (a) use only ASCII characters and (b) choose a short file path (less than 35 characters total). Otherwise, some tooling may fail later in the build process due to invalid or overly long file paths.

警告:如果更改上述目录名称/位置,请确保(a)仅使用ASCII字符,并(b)选择一个短文件路径(总共少于35个字符)。 否则,由于无效或过长的文件路径,某些工具可能会在构建过程的后期失败。

 1.下载 depot_tools.zip 并解压缩到"c:\code\depot_tools"目录。不要使用资源管理器中的拖放或复制粘贴提取,它不会提取depot_tools自动更新自身所需的隐藏“.git”文件夹。 不过,您可以使用上下文菜单中的“全部提取...”。 7-zip 也是一个很好的工具。

 打开 "cmd.exe" 运行"update_depot_tools.bat"脚本,安装 Python、Git 和 SVN。

cd c:\code\depot_tools
update_depot_tools.bat
( ̄3 ̄),如果没有装上  PythonGitSVN 可以尝试手动安装(全部使用默认设置一路下一步即可),设置系统环境变量,在"PATH"中分别添加路径"C:\code\depot_tools" 还有Python、Git、SVN的运行目录,参照:
 

2.下载 automate-git.py 脚本并保存至"c:\code\automate\automte-git.py".

创建"c:\code\chromium_git\update.bat"脚本并添加以下代码:

set CEF_USE_GN=1
set GN_DEFINES=use_jumbo_build=true
set GN_ARGUMENTS=--ide=vs2017 --sln=cef --filters=//cef/*
python ..\automate\automate-git.py --download-dir=c:\code\chromium_git --depot-tools-dir=c:\code\depot_tools --no-distrib --no-build

运行"cmd.exe" 执行脚本"update.bat"并等待CEF和Chromium源代码下载。CEF源代码将被下载到"c:\code\chromium_git\cef",Chromium源代码将被下载到"c:\code\chromium_git\chromium\src",下载完成后,CEF源代码将被复制到"c:\code\chromium_git\chromium\src\cef"。

cd c:\code\chromium_git
update.bat

注:在执行脚本期间遇到下面这个错误:

File "..\automate\automate-git.py",line 1163,in <module>

      raise Exception("Not a valid CEF Git checkout: %s" %s (cef_dir))

Exception: Not a valid CEF Git checkout: c:\code\chromium_git\cef

可以尝试使用下面的方法进行解决( (〜 ̄△ ̄)〜,为这个前后瞎折腾了好几个小时 ):

1.删除"c:\code\depot_tools"文件夹下的所有文件。

2.并再次打开"cmd.exe"运行"update.bat"脚本。

cd c:\code\chromium_git
update.bat

安装 Visual Studio 2017(我选择的版本: Visual Studio Community 2017.15.7.1)


        在选择Windows Kits时一定要符合官方文档(Windows 10.0.15063.486 SDK)的建议标准,否则看看这位 前辈 的血泪使吧。

 下面是我勾选的安装项目:
  • .NET Framework 4.5 targeting pack
  • .NET Framework 4.6.1 SDK
  • .NET Native
  • .NET Protable Library targeting pack
  • ClickOnce Publishing
  • Developer Analtyics tools
  • NuGet package manager
  • Static analysis tools
  • Text TemplateTrnsformation
  • C# and Visual Bsic Roslyn compilers
  • C++/CLI support
  • MSBuild
  • VC++ 2015.3 v14.00 (v140) toolset for desktop
  • VC++ 2017 version 15.7 v14.14 latest v141 tools
  • Visual C++ 2017 Redistributable Update
  • Visual C++ tools for CMake
  • Windows Universal CRT SDK
  • Windows XP support for C++
  • .NET profiling tools
  • C++ profiling tools
  • JavaScript diagnostics
  • Just-In-Time debugger
  • Test Adapterfor Boost.Test
  • Test Adapter for Google Test
  • Testing tools core features
  • C# and Visual Basic
  • JavaScript nd TypeScript language support
  • Visual Studio C++ core features
  • Visual Studio Tools for Office (VSTO)
  • Graphicsdebugger and GPU profiler for DirectX
  • Image and 3D model editors
  • Graphics Tools Windows 8.1 SDK
  • TypeScript 2.8 SDK
  • Visual C++ ATL (x86/x64) with Spectre Mitigtions
  • Visual C++ ATL for x86 and x64
  • Visual C++ MFC for x86 and x64
  • Visual C++ MFC for x86/x64 with Spectre Mitigations
  • Windows 10 SDK(10.0.15063.0) for Desktop C++ [x86 and x64]
  • Windows 10 SDK(10.0.15063.0) For UWP; C#,VB, JS
  • Windows 10 SDK(10.0.15063.0) For UWP; C++
  • Windows 10 SDK(10.0.17134.0)
  • Windows 8.1 SDK
  • Windows Universal C Runtime
 

猜你喜欢

转载自www.cnblogs.com/heimao117/p/9062285.html