mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Windows: Clarify custom toolchain env variable requirements (issue #1403)
This commit is contained in:
@ -52,20 +52,56 @@ if platform == 'windows':
|
|||||||
# but not installed (e.g. via a custom toolchain) set the following
|
# but not installed (e.g. via a custom toolchain) set the following
|
||||||
# environment variables:
|
# environment variables:
|
||||||
#
|
#
|
||||||
|
# o Enable use of a custom toolchain on Windows.
|
||||||
|
#
|
||||||
# set WIN_CUSTOM_TOOLCHAIN=1
|
# set WIN_CUSTOM_TOOLCHAIN=1
|
||||||
# set VS_VERSION=<VS version>
|
#
|
||||||
|
# o Used by tools/msvs_env.bat to configure the MSVS tools environment.
|
||||||
|
# Should be set to "none" because VC variables for CEF will be set via
|
||||||
|
# INCLUDE/LIB/PATH.
|
||||||
|
# TODO(cef): Make INCLUDE/LIB/PATH values optional when
|
||||||
|
# "%VS_ROOT%\VC\vcvarsall.bat" exists (use those values instead).
|
||||||
|
#
|
||||||
|
# set CEF_VCVARS=none
|
||||||
|
#
|
||||||
|
# o Used by the following scripts:
|
||||||
|
# (a) build/vs_toolchain.py SetEnvironmentAndGetRuntimeDllDirs when
|
||||||
|
# determining whether to copy VS runtime binaries to the output directory.
|
||||||
|
# If GYP_MSVS_OVERRIDE_PATH exists then binaries will not be copied and
|
||||||
|
# should instead be discoverable via the PATH env variable.
|
||||||
|
# (b) build/toolchain/win/setup_toolchain.py _LoadToolchainEnv when
|
||||||
|
# writing environment.* files that specify INCLUDE/LIB/PATH values. If
|
||||||
|
# "%GYP_MSVS_OVERRIDE_PATH%\VC\vcvarsall.bat" exists then environment
|
||||||
|
# variables will be derived from there and the specified INCLUDE/LIB/PATH
|
||||||
|
# values, if any, will be ignored by Chromium. If this file does not exist
|
||||||
|
# then the INCLUDE/LIB/PATH values are also required by Chromium.
|
||||||
|
# TODO(cef): Rename to VS_PATH and VS_VERSION after Chromium cleans up GYP
|
||||||
|
# dependencies.
|
||||||
|
#
|
||||||
|
# set GYP_MSVS_OVERRIDE_PATH=<VS root directory>
|
||||||
|
# set GYP_MSVS_VERSION=<VS version>
|
||||||
|
#
|
||||||
|
# o Used to configure GN arguments in this script.
|
||||||
|
#
|
||||||
# set VS_CRT_ROOT=<VS CRT root directory>
|
# set VS_CRT_ROOT=<VS CRT root directory>
|
||||||
# set VS_ROOT=<VS root directory>
|
|
||||||
# set SDK_ROOT=<Platform SDK root directory>
|
# set SDK_ROOT=<Platform SDK root directory>
|
||||||
|
#
|
||||||
|
# o Used by various scripts as described above.
|
||||||
|
#
|
||||||
# set INCLUDE=<VS include paths>
|
# set INCLUDE=<VS include paths>
|
||||||
# set LIB=<VS library paths>
|
# set LIB=<VS library paths>
|
||||||
# set PATH=<VS executable paths>
|
# set PATH=<VS executable paths>
|
||||||
#
|
#
|
||||||
|
# See tools/depot_tools/win_toolchain/package_from_installed.py for an example
|
||||||
|
# packaging script along with required directory contents and INCLUDE/LIB/PATH
|
||||||
|
# values.
|
||||||
|
#
|
||||||
if bool(int(os.environ.get('WIN_CUSTOM_TOOLCHAIN', '0'))):
|
if bool(int(os.environ.get('WIN_CUSTOM_TOOLCHAIN', '0'))):
|
||||||
required_vars = [
|
required_vars = [
|
||||||
'VS_VERSION',
|
'CEF_VCVARS',
|
||||||
|
'GYP_MSVS_OVERRIDE_PATH',
|
||||||
|
'GYP_MSVS_VERSION',
|
||||||
'VS_CRT_ROOT',
|
'VS_CRT_ROOT',
|
||||||
'VS_ROOT',
|
|
||||||
'SDK_ROOT',
|
'SDK_ROOT',
|
||||||
'INCLUDE',
|
'INCLUDE',
|
||||||
'LIB',
|
'LIB',
|
||||||
@ -75,21 +111,9 @@ if platform == 'windows':
|
|||||||
if not var in os.environ.keys():
|
if not var in os.environ.keys():
|
||||||
raise Exception('%s environment variable must be set' % var)
|
raise Exception('%s environment variable must be set' % var)
|
||||||
|
|
||||||
# VC variables for CEF will be set via INCLUDE/LIB/PATH.
|
|
||||||
# TODO(cef): Make INCLUDE/PATH/LIB values optional when
|
|
||||||
# "%VS_ROOT%\VC\vcvarsall.bat" exists (use those values instead).
|
|
||||||
os.environ['CEF_VCVARS'] = 'none'
|
|
||||||
|
|
||||||
# Checked in build/toolchain/win/setup_toolchain.py _LoadToolchainEnv.
|
|
||||||
# If "%VS_ROOT%\VC\vcvarsall.bat" exists then environment variables will
|
|
||||||
# be derived from there and the specified INCLUDE/LIB/PATH values, if any,
|
|
||||||
# will be ignored by Chromium. If this file does not exist then the
|
|
||||||
# INCLUDE/LIB/PATH values are also required by Chromium.
|
|
||||||
os.environ['GYP_MSVS_OVERRIDE_PATH'] = os.environ['VS_ROOT']
|
|
||||||
|
|
||||||
# Windows custom toolchain requirements. See comments in gn_args.py.
|
# Windows custom toolchain requirements. See comments in gn_args.py.
|
||||||
gn_args['visual_studio_path'] = os.environ['VS_ROOT']
|
gn_args['visual_studio_path'] = os.environ['GYP_MSVS_OVERRIDE_PATH']
|
||||||
gn_args['visual_studio_version'] = os.environ['VS_VERSION']
|
gn_args['visual_studio_version'] = os.environ['GYP_MSVS_VERSION']
|
||||||
gn_args['visual_studio_runtime_dirs'] = os.environ['VS_CRT_ROOT']
|
gn_args['visual_studio_runtime_dirs'] = os.environ['VS_CRT_ROOT']
|
||||||
gn_args['windows_sdk_path'] = os.environ['SDK_ROOT']
|
gn_args['windows_sdk_path'] = os.environ['SDK_ROOT']
|
||||||
|
|
||||||
|
@ -211,15 +211,12 @@ def ValidateArgs(args):
|
|||||||
msg('is_official_build=false + is_debug=true recommends is_win_fastlink=true')
|
msg('is_official_build=false + is_debug=true recommends is_win_fastlink=true')
|
||||||
|
|
||||||
# Windows custom toolchain requirements.
|
# Windows custom toolchain requirements.
|
||||||
# See tools/depot_tools/win_toolchain/package_from_installed.py for an
|
|
||||||
# example packaging script along with required directory contents and
|
|
||||||
# INCLUDE/LIB/PATH values.
|
|
||||||
#
|
#
|
||||||
# Required GN arguments:
|
# Required GN arguments:
|
||||||
# visual_studio_path="<path to VS root>"
|
# visual_studio_path="<path to VS root>"
|
||||||
# The directory that contains Visual Studio. For example, a subset of
|
# The directory that contains Visual Studio. For example, a subset of
|
||||||
# "C:\Program Files (x86)\Microsoft Visual Studio 14.0".
|
# "C:\Program Files (x86)\Microsoft Visual Studio 14.0".
|
||||||
# visual_studio_version="<vs version>"
|
# visual_studio_version="<VS version>"
|
||||||
# The VS version. For example, "2015".
|
# The VS version. For example, "2015".
|
||||||
# visual_studio_runtime_dirs="<path to VS CRT>"
|
# visual_studio_runtime_dirs="<path to VS CRT>"
|
||||||
# The directory that contains the VS CRT. For example, the contents of
|
# The directory that contains the VS CRT. For example, the contents of
|
||||||
@ -232,37 +229,42 @@ def ValidateArgs(args):
|
|||||||
# Required environment variables:
|
# Required environment variables:
|
||||||
# DEPOT_TOOLS_WIN_TOOLCHAIN=0
|
# DEPOT_TOOLS_WIN_TOOLCHAIN=0
|
||||||
# GYP_MSVS_OVERRIDE_PATH=<path to VS root, must match visual_studio_path>
|
# GYP_MSVS_OVERRIDE_PATH=<path to VS root, must match visual_studio_path>
|
||||||
|
# GYP_MSVS_VERSION=<VS version, must match visual_studio_version>
|
||||||
# CEF_VCVARS=none
|
# CEF_VCVARS=none
|
||||||
# INCLUDE=<VS include paths>
|
# INCLUDE=<VS include paths>
|
||||||
# LIB=<VS library paths>
|
# LIB=<VS library paths>
|
||||||
# PATH=<VS executable paths>
|
# PATH=<VS executable paths>
|
||||||
#
|
#
|
||||||
|
# See comments in gclient_hook.py for environment variable usage.
|
||||||
|
#
|
||||||
if visual_studio_path != '':
|
if visual_studio_path != '':
|
||||||
assert visual_studio_version != '', 'visual_studio_path requires visual_studio_version'
|
assert visual_studio_version != '', 'visual_studio_path requires visual_studio_version'
|
||||||
assert visual_studio_runtime_dirs != '', 'visual_studio_path requires visual_studio_runtime_dirs'
|
assert visual_studio_runtime_dirs != '', 'visual_studio_path requires visual_studio_runtime_dirs'
|
||||||
assert windows_sdk_path != '', 'visual_studio_path requires windows_sdk_path'
|
assert windows_sdk_path != '', 'visual_studio_path requires windows_sdk_path'
|
||||||
|
|
||||||
# VC variables for CEF will be set via INCLUDE/LIB/PATH.
|
assert os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '') == '0', \
|
||||||
# TODO(cef): Make INCLUDE/LIB/PATH values optional when
|
"visual_studio_path requires DEPOT_TOOLS_WIN_TOOLCHAIN=0 env variable"
|
||||||
# "%VS_ROOT%\VC\vcvarsall.bat" exists (use those values instead).
|
|
||||||
|
msvs_path = os.environ.get('GYP_MSVS_OVERRIDE_PATH', '')
|
||||||
|
assert msvs_path == visual_studio_path and os.path.exists(msvs_path), \
|
||||||
|
"visual_studio_path requires matching GYP_MSVS_OVERRIDE_PATH env variable"
|
||||||
|
|
||||||
|
msvs_version = os.environ.get('GYP_MSVS_VERSION', '')
|
||||||
|
assert msvs_version == visual_studio_version, \
|
||||||
|
"visual_studio_version requires matching GYP_MSVS_VERSION env variable"
|
||||||
|
|
||||||
assert os.environ.get('CEF_VCVARS', '') == 'none', \
|
assert os.environ.get('CEF_VCVARS', '') == 'none', \
|
||||||
"visual_studio_path requires CEF_VCVARS=none env variable"
|
"visual_studio_path requires CEF_VCVARS=none env variable"
|
||||||
|
|
||||||
assert 'INCLUDE' in os.environ \
|
assert 'INCLUDE' in os.environ \
|
||||||
and 'LIB' in os.environ \
|
and 'LIB' in os.environ \
|
||||||
and 'PATH' in os.environ, \
|
and 'PATH' in os.environ, \
|
||||||
"visual_studio_path requires INCLUDE, LIB and PATH env variables"
|
"visual_studio_path requires INCLUDE, LIB and PATH env variables"
|
||||||
|
|
||||||
# Checked in build/toolchain/win/setup_toolchain.py _LoadToolchainEnv.
|
|
||||||
# If "%VS_ROOT%\VC\vcvarsall.bat" exists then environment variables will
|
# If "%VS_ROOT%\VC\vcvarsall.bat" exists then environment variables will
|
||||||
# be derived from there and the specified INCLUDE/LIB/PATH values, if any,
|
# be derived from there and the specified INCLUDE/LIB/PATH values, if any,
|
||||||
# will be ignored by Chromium. If this file does not exist then the
|
# will be ignored by Chromium. If this file does not exist then the
|
||||||
# INCLUDE/LIB/PATH values are also required by Chromium.
|
# INCLUDE/LIB/PATH values are also required by Chromium.
|
||||||
assert os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '') == '0', \
|
|
||||||
"visual_studio_path requires DEPOT_TOOLS_WIN_TOOLCHAIN=0 env variable"
|
|
||||||
msvs_path = os.environ.get('GYP_MSVS_OVERRIDE_PATH', '')
|
|
||||||
assert msvs_path == visual_studio_path and os.path.exists(msvs_path), \
|
|
||||||
"visual_studio_path requires matching GYP_MSVS_OVERRIDE_PATH env variable"
|
|
||||||
|
|
||||||
vcvars_path = os.path.join(msvs_path, 'VC', 'vcvarsall.bat')
|
vcvars_path = os.path.join(msvs_path, 'VC', 'vcvarsall.bat')
|
||||||
if (os.path.exists(vcvars_path)):
|
if (os.path.exists(vcvars_path)):
|
||||||
msg('INCLUDE/LIB/PATH values will be derived from %s' % vcvars_path)
|
msg('INCLUDE/LIB/PATH values will be derived from %s' % vcvars_path)
|
||||||
|
Reference in New Issue
Block a user