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

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

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

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

 

环境准备(初定):chrome

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

二、Visual Studio VS2017 15.3.2+ 安装在默认位置。浏览器

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

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

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

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

 

下载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
相关文章
相关标签/搜索