Windows Configuration
What's Required
Windows 7 or newer, 64-bit OS.
Visual Studio 2017 15.3.2+.
Windows 10.0.15063.468 SDK.
At least 8GB of RAM and 40GB of free disk space.
See comments in gclient_hook.py for Windows custom toolchain requirements. VS + SDK can be packaged for distribution to build agents using a script like Chromium's package_from_installed.py.
WARNING: If you are using VS2017 15.5.* to build 3282 branch then you must add enable_precompiled_headers=false to GN_DEFINES to avoid a known issue with clang.
set vs_root=C:\Program Files (x86)\Microsoft Visual Studio 14.0
set sdk_root=C:\Program Files (x86)\Windows Kits\10
set sdk_version=10.0.16299.0
set vs_crt_root=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\crt
set vc_tools_version=14.16.27023
32-bit Build Commands
To build 32-bit CEF on a 64-bit Windows host system:
If VS2017 or SDK is not installed to the default location then set the following before executing automate-git.py:
#set WIN_CUSTOM_TOOLCHAIN=1
#set CEF_VCVARS=none
#set GYP_MSVS_OVERRIDE_PATH=%vs_root%
#set VS_CRT_ROOT=%vs_crt_root%
#set SDK_ROOT=%sdk_root%
#
set PATH=%sdk_root%\bin\%sdk_version%\x64;%vs_root%\VC\Tools\MSVC\%vc_tools_version%\bin\HostX64\x64;%vs_root%\VC\Redist\MSVC\%vc_redist_version%\x64\%vc_redist_crt%;%vs_root%\SystemCRT;%PATH%
set LIB=%sdk_root%\Lib\%sdk_version\um\x64;%sdk_root%\Lib\%sdk_version\ucrt\x64;%vs_root%\VC\Tools\MSVC\%vc_tools_version%\lib\x64;%vs_root%\VC\Tools\MSVC\%vc_tools_version%\atlmfc\lib\x64;%LIB%
#set INCLUDE=%sdk_root%\Include\%sdk_version%\um;%sdk_root%\Include\%sdk_version%\ucrt;%sdk_root%\Include\%sdk_version%\shared;%vs_root%\VC\Tools\MSVC\%vc_tools_version%\include;%vs_root%\VC\Tools\MSVC\%vc_tools_version%\atlmfc\include;%INCLUDE%
vs2015
If VS2015 or SDK is not installed to the default location then set the following before executing automate-git.py:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
set WIN_CUSTOM_TOOLCHAIN=1
set CEF_VCVARS=none
set GYP_MSVS_OVERRIDE_PATH=%vs_root%
set VS_CRT_ROOT=%vs_crt_root%
set SDK_ROOT=%sdk_root%
set PATH=%sdk_root%\bin\x86;%vs_root%\VC\bin;%PATH%
set LIB=%sdk_root%\Lib\10.0.10586.0\um\x86;%sdk_root%\Lib\10.0.10586.0\ucrt\x86;%vs_root%\VC\lib;%vs_root%\VC\atlmfc\lib;%LIB%
set INCLUDE=%sdk_root%\Include\10.0.10586.0\um;%sdk_root%\Include\10.0.10586.0\ucrt;%sdk_root%\Include\10.0.10586.0\shared;%sdk_root%\Include\10.0.10586.0\winrt;%vs_root%\VC\include;%vs_root%\VC\atlmfc\include;%INCLUDE%
**64-bit Build Commands**
To build 64-bit CEF on a 64-bit Windows host system:
1
2
3
4
5
set CEF_USE_GN=1
set GN_DEFINES=is_official_build=true
set GYP_DEFINES=buildtype=Official
set GYP_MSVS_VERSION=2015
set CEF_ARCHIVE_FORMAT=tar.bz2
automate-git.py --download-dir=%download_dir% --branch=%cef_branch% --minimal-distrib --client-distrib --force-clean --x64-build
If VS2015 or SDK is not installed to the default location then set the following before executing automate-git.py:
1
2
3
set WIN_CUSTOM_TOOLCHAIN=1
set CEF_VCVARS=none
set GYP_MSVS_OVERRIDE_PATH=%vs_root%
set VS_CRT_ROOT=%vs_crt_root%
set SDK_ROOT=%sdk_root%
set PATH=%sdk_root%\bin\x64;%vs_root%\VC\bin\amd64;%PATH%
set LIB=%sdk_root%\Lib\10.0.10586.0\um\x64;%sdk_root%\Lib\10.0.10586.0\ucrt\x64;%vs_root%\VC\lib\amd64;%vs_root%\VC\atlmfc\lib\amd64;%LIB%
set INCLUDE=%sdk_root%\Include\10.0.10586.0\um;%sdk_root%\Include\10.0.10586.0\ucrt;%sdk_root%\Include\10.0.10586.0\shared;%sdk_root%\Include\10.0.10586.0\winrt;%vs_root%\VC\include;%vs_root%\VC\atlmfc\include;%INCLUDE%
The below steps can often be used to develop the most recent release branch of CEF/Chromium in addition to the master branch. Chromium build requirements change over time so review the build requirements listed on the BranchesAndBuilding Wiki page before attempting to build a release branch. Then just add --branch=XXXX to the automate-git.py command-line where "XXXX" is the branch number you wish to build.
What's Required
Windows 7 or newer, 64-bit OS.
Visual Studio VS2017 15.7.1+ installed in the default location.
Windows 10.0.17763 SDK installed in the default location. You must install this exact SDK version to avoid build issues.
At least 8GB of RAM and 40GB of free disk space.
Approximately 2 hours with a fast internet connection (25Mbps) and fast build machine (2.6Ghz+, 4+ logical cores).
7.创建 “c:\code\chromium_git\chromium\src\cef\create.bat”
set GN_DEFINES=use_jumbo_build=true
set GN_ARGUMENTS=–ide=vs2017 --sln=cef --filters=//cef/*
call cef_create_projects.bat
Run the “create.bat” script to generate Ninja and Visual Studio project files.
cd c:\code\chromium_git\chromium\src\cef
create.bat
Create a Debug build of CEF/Chromium using Ninja. Replace “x86” with “x64” in the below example to generate a 64-bit build instead of a 32-bit build. Edit the CEF source code at “c:\code\chromium_git\chromium\src\cef” and repeat this step multiple times to perform incremental builds while developing.
cd c:\code\chromium_git\chromium\src
ninja -C out\Debug_GN_x86 cef
Run the resulting cefclient sample application.
cd c:\code\chromium_git\chromium\src
out\Debug_GN_x86\cefclient.exe
Legacy CEF builds are available from the Spotify automated builder back to 2704 branch. Building legacy branches is not supported. If you choose to build a legacy branch you will need to solve any build errors on your own.
Newer legacy branches (within the past year) can often be built using the same tooling as current branches. You will need to (a) manually download depot_tools, (b) sync depot_tools to a revision that existed at the time of the branch, and (c) set the DEPOT_TOOLS_UPDATE=0 environment variable to keep it from updating automatically.
Older legacy branches can potentially be built by downloading a CEF source archive at the desired branch from here and a Chromium source archive at the associated/required version from here, and then combining them to create the required directory structure.
See the Build Notes section at the end of this page for historical build details.
The script will create a 32-bit build on Windows by default. To create a 64-bit build on Windows, macOS or Linux specify the --x64-build command-line flag. 32-bit builds on macOS are no longer supported starting with 2272 branch so this flag is now required when building 2272+ on that platform.
Ninja must be used when building newer CEF/Chromium branches.
Clang is used by default for compiling/linking Chromium/CEF on macOS in all branches, Linux starting in 2063 branch, and Windows starting in 3282 branch.
GYP is supported by 2785 branch and older. GN is supported by 2785 branch and newer, and required starting with 2840 branch. Set CEF_USE_GN=1 to build 2785 branch with GN instead of GYP.
Component builds are supported by 3202 branch and newer and significantly reduce link time. Add is_component_build=true to GN_DEFINES in combination with the above VS-version-specific values. Component builds cannot be used to create a CEF binary distribution. See issue #1617 for details.
预先设置的环境变量
:: 默认打包格式为zip,其余为tar.gz/tar.bz2
set CEF_ARCHIVE_FORMAT=tar.bz2
::2785之前使用GYP编译
::set CEF_USE_GN=0
::2785-至今,使用GN
set CEF_USE_GN=1
:: 设置64位 GYP版本-----
::set GYP_DEFINES=target_arch=x64
:: GN 需要 build out/[Debug|Release]_GN_x64
:: official 官方构建集 GYP-----
::set GYP_DEFINES=buildtype=Official
:: GN
set GN_DEFINES=is_official_build=true
:: 如果计算机上安装了多个版本的vs则设置-----
set GYP_MSVS_VERSION=2015
::如果需要vs和ninja进行调试和编译则设置 GYP -----
set GYP_GENERATORS=ninja,msvs-ninja
:: GN
set GN_ARGUMENTS=–ide=vs2017 --sln=cef --filters=//cef/*
:: 为了获得最佳的本地开发人员(非官方调试)构建时性能 vs2015-----
set GN_DEFINES=is_win_fastlink=true
::vs2017
set GN_DEFINES=use_jumbo_build=true
:: 禁止更新 -----
::告诉depot_tools使用您本地安装的Visual Studio版本(缺省情况下,depot_tools将尝试使用Google内部版本)
set DEPOT_TOOLS_WIN_TOOLCHAIN=0 // 不设置0 则出现 Username for ‘https://chrome-internal.googlesource.com’:
This utility implements automation for the download, update, build and
distribution of CEF.
Options:
-h, --help show this help message and exit
--download-dir=DIR Download directory with no spaces [required].
--depot-tools-dir=DIR
Download directory for depot_tools.
--depot-tools-archive=DEPOTTOOLSARCHIVE
Zip archive file that contains a single top-level
depot_tools directory.
--branch=BRANCH Branch of CEF to build (trunk, 1916, ...). This will
be used to name the CEF download directory and to
identify the correct URL if --url is not specified.
The default value is trunk.
--url=URL CEF download URL. If not specified the default URL
will be used.
--chromium-url=CHROMIUMURL
Chromium download URL. If not specified the default
URL will be used.
--checkout=CHECKOUT Version of CEF to checkout. If not specified the most
recent remote version of the branch will be used.
--chromium-checkout=CHROMIUMCHECKOUT
Version of Chromium to checkout (Git branch/hash/tag).
This overrides the value specified by CEF in
CHROMIUM_BUILD_COMPATIBILITY.txt.
--chromium-channel=CHROMIUMCHANNEL
Chromium channel to check out (canary, dev, beta or
stable). This overrides the value specified by CEF in
CHROMIUM_BUILD_COMPATIBILITY.txt.
--chromium-channel-distance=CHROMIUMCHANNELDISTANCE
The target number of commits to step in the channel,
or 0 to use the newest channel version. Used in
combination with --chromium-channel.
--force-config Force creation of a new gclient config file.
--force-clean Force a clean checkout of Chromium and CEF. This will
trigger a new update, build and distribution.
--force-clean-deps Force a clean checkout of Chromium dependencies. Used
in combination with --force-clean.
--dry-run Output commands without executing them.
--dry-run-platform=DRYRUNPLATFORM
Simulate a dry run on the specified platform (windows,
macosx, linux). Must be used in combination with the
--dry-run flag.
--force-update Force a Chromium and CEF update. This will trigger a
new build and distribution.
--no-update Do not update Chromium or CEF. Pass --force-build or
--force-distrib if you desire a new build or
distribution.
--no-cef-update Do not update CEF. Pass --force-build or --force-
distrib if you desire a new build or distribution.
--force-cef-update Force a CEF update. This will cause local changes in
the CEF checkout to be discarded and patch files to be
reapplied.
--no-chromium-update Do not update Chromium.
--no-depot-tools-update
Do not update depot_tools.
--fast-update Update existing Chromium/CEF checkouts for fast
incremental builds by attempting to minimize the
number of modified files. The update will fail if
there are unstaged CEF changes or if Chromium changes
are not included in a patch file.
--force-patch-update Force update of patch files.
--resave Resave patch files.
--log-chromium-changes
Create a log of the Chromium changes.
--force-build Force CEF debug and release builds. This builds
[build-target] on all platforms and chrome_sandbox on
Linux.
--no-build Do not build CEF.
--build-target=BUILDTARGET
Target name(s) to build (defaults to "cefclient").
--build-tests Also build the test target specified via --test-
target.
--no-debug-build Don't perform the CEF debug build.
--no-release-build Don't perform the CEF release build.
--verbose-build Show all command lines while building.
--build-failure-limit=BUILDFAILURELIMIT
Keep going until N jobs fail.
--build-log-file Write build logs to file. The file will be named
"build-[branch]-[debug|release].log" in the download
directory.
--x64-build Create a 64-bit build.
--arm-build Create an ARM build.
--run-tests Run the ceftests target.
--no-debug-tests Don't run debug build tests.
--no-release-tests Don't run release build tests.
--test-target=TESTTARGET
Test target name to build (defaults to "ceftests").
--test-prefix=TESTPREFIX
Prefix for running the test executable (e.g. `xvfb-
run` on Linux).
--test-args=TESTARGS Arguments that will be passed to the test executable.
--force-distrib Force creation of a CEF binary distribution.
--no-distrib Don't create a CEF binary distribution.
--minimal-distrib Create a minimal CEF binary distribution.
--minimal-distrib-only
Create a minimal CEF binary distribution only.
--client-distrib Create a client CEF binary distribution.
--client-distrib-only
Create a client CEF binary distribution only.
--sandbox-distrib Create a cef_sandbox static library distribution.
--sandbox-distrib-only
Create a cef_sandbox static library distribution only.
--no-distrib-docs Don't create CEF documentation.
--no-distrib-archive Don't create archives for output directories.
--clean-artifacts Clean the artifacts output directory.
--distrib-subdir=DISTRIBSUBDIR
CEF distrib dir name, child of
chromium/src/cef/binary_distrib
make_distrib.bat --help
Usage: make_distrib.py [options]
This utility builds the CEF Binary Distribution.
Options:
-h, --help show this help message and exit
--output-dir=DIR output directory [required]
--distrib-subdir=DISTRIBSUBDIR
name of the subdirectory for the distribution
--allow-partial allow creation of partial distributions
--no-symbols don't create symbol files
--no-docs don't create documentation
--no-archive don't create archives for output directories
--ninja-build build was created using ninja
--x64-build create a 64-bit binary distribution
--arm-build create an ARM binary distribution (Linux only)
--minimal include only release build binary files
--client include only the sample application
--sandbox include only the cef_sandbox static library (macOS and
Windows only)
-q, --quiet do not output detailed status information
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-j JOBS, --jobs=JOBS Specify how many SCM commands can run in parallel;
defaults to 8 on this machine
-v, --verbose Produces additional output for diagnostics. Can be
used up to three times for more logging info.
--gclientfile=CONFIG_FILENAME
Specify an alternate .gclient file
--spec=SPEC create a gclient file containing the provided string.
Due to Cygwin/Python brokenness, it can't contain any
newlines.
--no-nag-max Ignored for backwards compatibility.
-f, --force force update even for unchanged modules
-n, --nohooks don't run hooks after the update is complete
-p, --noprehooks don't run pre-DEPS hooks
-r REV, --revision=REV
Enforces revision/hash for the solutions with the
format src@rev. The src@ part is optional and can be
skipped. You can also specify URLs instead of paths
and gclient will find the solution corresponding to
the given URL. If a path is also specified, the URL
takes precedence. -r can be used multiple times when
.gclient has multiple solutions configured, and will
work even if the src@ part is skipped.
--patch-ref=GERRIT_REF
Patches the given reference with the format dep
@[target-ref:]patch-ref. For |dep|, you can specify
URLs as well as paths, with URLs taking preference.
|patch-ref| will be applied to |dep|, rebased on top
of what |dep| was synced to, and a soft reset will be
done. Use --no-rebase-patch-ref and --no-reset-patch-
ref to disable this behavior. |target-ref| is the
target branch against which a patch was created, it is
used to determine which commits from the |patch-ref|
actually constitute a patch. If not given, we will
iterate over all remote branches and select one that
contains the revision |dep| is synced at. WARNING:
|target-ref| will be mandatory soon.
--with_branch_heads Clone git "branch_heads" refspecs in addition to the
default refspecs. This adds about 1/2GB to a full
checkout. (git only)
--with_tags Clone git tags in addition to the default refspecs.
-H, --head DEPRECATED: only made sense with safesync urls.
-D, --delete_unversioned_trees
Deletes from the working copy any dependencies that
have been removed since the last sync, as long as
there are no local modifications. When used with
--force, such dependencies are removed even if they
have local modifications. When used with --reset, all
untracked directories are removed from the working
copy, excluding those which are explicitly ignored in
the repository.
-R, --reset resets any local changes before updating (git only)
-M, --merge merge upstream changes instead of trying to fast-
forward or rebase
-A, --auto_rebase Automatically rebase repositories against local
checkout during update (git only).
--deps=OS_LIST override deps for the specified (comma-separated)
platform(s); 'all' will process all deps_os references
--process-all-deps Check out all deps, even for different OS-es, or with
conditions evaluating to false
--upstream Make repo state match upstream branch.
--output-json=OUTPUT_JSON
Output a json document to this path containing summary
information about the sync.
--no-history GIT ONLY - Reduces the size/time of the checkout at
the cost of no history. Requires Git 1.9+
--shallow GIT ONLY - Do a shallow clone into the cache dir.
Requires Git 1.9+
--no_bootstrap, --no-bootstrap
Don't bootstrap from Google Storage.
--ignore_locks GIT ONLY - Ignore cache locks.
--break_repo_locks GIT ONLY - Forcibly remove repo locks (e.g.
index.lock). This should only be used if you know for
certain that this invocation of gclient is the only
thing operating on the git repos (e.g. on a bot).
--lock_timeout=LOCK_TIMEOUT
GIT ONLY - Deadline (in seconds) to wait for git cache
lock to become available. Default is 5000.
-t, --transitive DEPRECATED: This is a no-op.
-m, --manually_grab_svn_rev
DEPRECATED: This is a no-op.
--validate-syntax Validate the .gclient and DEPS syntax
--disable-syntax-validation
Disable validation of .gclient and DEPS syntax.
--no-rebase-patch-ref
Bypass rebase of the patch ref after checkout.
--no-reset-patch-ref Bypass calling reset after patching the ref.
Examples:
gclient sync
update files from SCM according to current configuration,
*for modules which have changed since last update or sync*
gclient sync --force
update files from SCM according to current configuration, for
all modules (useful for recovering files deleted from local copy)
gclient sync --revision src@31000
update src directory to r31000
JSON output format:
If the --output-json option is specified, the following document structure will
be emitted to the provided file. 'null' entries may occur for subprojects which
are present in the gclient solution, but were not processed (due to custom_deps,
os_deps, etc.)
{
"solutions" : {
"<name>": { # <name> is the posix-normalized path to the solution.
"revision": [<git id hex string>|null],
"scm": ["git"|null],
}
}
}
下面的指令,很重要!!!
set GN_DEFINES=is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome
set GYP_DEFINES=branding=Chromium buildtype=Official proprietary_codecs=true ffmpeg_branding=Chrome
error: Your local changes to the following files would be overwritten by checkout:
Traceback (most recent call last):
File “automate-git.py”, line 1399, in
chromium_src_dir, depot_tools_dir)
File “automate-git.py”, line 61, in run
args, cwd=working_dir, env=env, shell=(sys.platform == ‘win32’))
File “D:\code_xin\chromium_git\depot_tools\win_tools-2_7_6_bin\python\bin\lib\subprocess.py”, line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘D:\code_xin\chromium_git\depot_tools\git.bat’, ‘checkout’, ‘refs/tags/73.0.3683.75’]’ returned non-zero exit status 1