Win/Mac: Generate build configs for the native host architecture by default (see issue #2773, see issue #2981)

When building on an ARM64 host the ARM64 configs (arm64) will be generated by
default and the AMD64 configs (x86,x64) will only be generated if the
CEF_ENABLE_AMD64=1 env variable is set.

When building on an AMD64 host the AMD64 configs (x86,x64) will be generated by
default and the ARM64 configs (arm64) will only be generated if the
CEF_ENABLE_ARM64=1 env variable is set.
This commit is contained in:
Marshall Greenblatt 2021-07-29 13:29:41 -04:00
parent 0cfa65b48c
commit a94e113410
1 changed files with 14 additions and 7 deletions

View File

@ -63,6 +63,7 @@
from __future__ import absolute_import
from __future__ import print_function
import os
import platform as python_platform
import shlex
import sys
@ -74,8 +75,12 @@ src_dir = os.path.abspath(os.path.join(cef_dir, os.pardir))
# Determine the platform.
if sys.platform == 'win32':
platform = 'windows'
# Windows machines report 'ARM64' or 'AMD64'.
machine = 'arm64' if python_platform.machine() == 'ARM64' else 'amd64'
elif sys.platform == 'darwin':
platform = 'mac'
# Mac machines report 'arm64' or 'x86_64'.
machine = 'arm64' if python_platform.machine() == 'arm64' else 'amd64'
elif sys.platform.startswith('linux'):
platform = 'linux'
else:
@ -553,17 +558,19 @@ def GetAllPlatformConfigs(build_args):
% cpu)
else:
supported_cpus = ['x64']
elif platform == 'windows':
supported_cpus = ['x86', 'x64']
if os.environ.get('CEF_ENABLE_ARM64', '') == '1':
supported_cpus.append('arm64')
elif platform == 'mac':
supported_cpus = ['x64']
if os.environ.get('CEF_ENABLE_ARM64', '') == '1':
elif platform in ('windows', 'mac'):
if machine == 'amd64' or os.environ.get('CEF_ENABLE_AMD64', '') == '1':
supported_cpus.append('x64')
if platform == 'windows':
supported_cpus.append('x86')
if machine == 'arm64' or os.environ.get('CEF_ENABLE_ARM64', '') == '1':
supported_cpus.append('arm64')
else:
raise Exception('Unsupported platform')
if len(supported_cpus) == 0:
raise Exception('No supported architectures')
for cpu in supported_cpus:
if create_debug:
result['Debug_GN_' + cpu] = GetConfigArgs(args, True, cpu)