mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Mac: Add ARM64 configuration support (see issue #2981)
Requires Xcode 12.2 and the MacOS 11.0 SDK. To generate ARM64 builds set the CEF_ENABLE_ARM64=1 environment variable and replace all usage of --x64-build with --arm64-build in script command-line arguments.
This commit is contained in:
@@ -921,7 +921,8 @@ parser.add_option(
|
||||
'--distrib-subdir-suffix',
|
||||
dest='distribsubdirsuffix',
|
||||
default='',
|
||||
help='CEF distrib dir name suffix, child of chromium/src/cef/binary_distrib')
|
||||
help='CEF distrib dir name suffix, child of chromium/src/cef/binary_distrib'
|
||||
)
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
@@ -1032,16 +1033,11 @@ if options.armbuild:
|
||||
print('The ARM build option is only supported on Linux.')
|
||||
sys.exit()
|
||||
|
||||
if options.arm64build:
|
||||
if platform != 'linux' and platform != 'windows':
|
||||
print('The ARM64 build option is only supported on Linux and Windows.')
|
||||
sys.exit()
|
||||
|
||||
deps_file = 'DEPS'
|
||||
|
||||
if platform == 'mac' and not options.x64build:
|
||||
if platform == 'mac' and not (options.x64build or options.arm64build):
|
||||
print('32-bit MacOS builds are not supported. ' +
|
||||
'Add --x64-build flag to generate a 64-bit build.')
|
||||
'Add --x64-build or --arm64-build flag to generate a 64-bit build.')
|
||||
sys.exit()
|
||||
|
||||
# Platforms that build a cef_sandbox library.
|
||||
|
@@ -99,7 +99,7 @@ class cef_json_builder:
|
||||
@staticmethod
|
||||
def get_platforms():
|
||||
""" Returns the list of supported platforms. """
|
||||
return ('linux32', 'linux64', 'linuxarm', 'linuxarm64', 'macosx64',
|
||||
return ('linux32', 'linux64', 'linuxarm', 'linuxarm64', 'macosarm64', 'macosx64',
|
||||
'windows32', 'windows64')
|
||||
|
||||
@staticmethod
|
||||
|
@@ -26,7 +26,7 @@ cefclient.app/
|
||||
cef_extensions.pak <=====^
|
||||
devtools_resources.pak <=^
|
||||
icudtl.dat <= unicode support
|
||||
snapshot_blob.bin, v8_context_snapshot.bin <= V8 initial snapshot
|
||||
snapshot_blob.bin, v8_context_snapshot.[x86_64|arm64].bin <= V8 initial snapshot
|
||||
en.lproj/, ... <= locale-specific resources and strings
|
||||
Info.plist
|
||||
cefclient Helper.app/
|
||||
|
@@ -327,11 +327,11 @@ def ValidateArgs(args):
|
||||
windows_sdk_path = GetArgValue(args, 'windows_sdk_path')
|
||||
|
||||
# Target CPU architecture.
|
||||
# - Windows supports "x86" and "x64".
|
||||
# - Mac supports only "x64".
|
||||
# - Windows supports "x86", "x64" and "arm64".
|
||||
# - Mac supports "x64" and "arm64".
|
||||
# - Linux supports only "x64" unless using a sysroot environment.
|
||||
if platform == 'mac':
|
||||
assert target_cpu == 'x64', 'target_cpu must be "x64"'
|
||||
assert target_cpu in ('x64', 'arm64'), 'target_cpu must be "x64" or "arm64"'
|
||||
elif platform == 'windows':
|
||||
assert target_cpu in ('x86', 'x64',
|
||||
'arm64'), 'target_cpu must be "x86", "x64" or "arm64"'
|
||||
@@ -548,6 +548,8 @@ def GetAllPlatformConfigs(build_args):
|
||||
supported_cpus.append('arm64')
|
||||
elif platform == 'mac':
|
||||
supported_cpus = ['x64']
|
||||
if os.environ.get('CEF_ENABLE_ARM64', '') == '1':
|
||||
supported_cpus.append('arm64')
|
||||
else:
|
||||
raise Exception('Unsupported platform')
|
||||
|
||||
|
@@ -381,7 +381,8 @@ def combine_libs(platform, build_dir, libs, dest_lib):
|
||||
# Create an intermediate object file that combines all other object files.
|
||||
# Symbols not identified above will be made private (local).
|
||||
intermediate_obj = os.path.splitext(dest_lib)[0] + '.o'
|
||||
cmdline = 'ld -arch x86_64 -r -o "%s"' % intermediate_obj
|
||||
arch = 'arm64' if options.arm64build else 'x86_64'
|
||||
cmdline = 'ld -arch %s -r -o "%s"' % (arch, intermediate_obj)
|
||||
for symbol in symbols:
|
||||
cmdline += ' -exported_symbol %s' % symbol
|
||||
|
||||
@@ -410,6 +411,10 @@ def combine_libs(platform, build_dir, libs, dest_lib):
|
||||
# Verify that no C++ symbols are imported by the archive file. If the
|
||||
# archive imports C++ symbols and the client app links an incompatible C++
|
||||
# library, the result will be undefined behavior.
|
||||
# For example, to avoid importing libc++ symbols the cef_sandbox target
|
||||
# should have a dependency on libc++abi. This dependency can be verified
|
||||
# with the following command:
|
||||
# gn path out/[config] //cef:cef_sandbox //buildtools/third_party/libc++abi
|
||||
print('Verifying imported (undefined) symbols...')
|
||||
undefined_symbols = get_undefined_symbols(dest_lib)
|
||||
cpp_symbols = list(
|
||||
@@ -565,10 +570,6 @@ if options.armbuild and platform != 'linux':
|
||||
print_error('--arm-build is only supported on Linux.')
|
||||
sys.exit()
|
||||
|
||||
if options.arm64build and not platform in ('linux', 'windows'):
|
||||
print_error('--arm64-build is only supported on Linux and Windows.')
|
||||
sys.exit()
|
||||
|
||||
if options.sandbox and not platform in ('mac', 'windows'):
|
||||
print_error('--sandbox is only supported on macOS and Windows.')
|
||||
sys.exit()
|
||||
@@ -632,8 +633,11 @@ else:
|
||||
output_dir_base = 'cef_binary_' + cef_ver
|
||||
|
||||
if options.distribsubdir == '':
|
||||
# For backwards compatibility keep the old default directory name on mac.
|
||||
platform_name = 'macosx' if platform == 'mac' else platform
|
||||
if platform == 'mac':
|
||||
# For backwards compatibility keep the old default directory name on mac.
|
||||
platform_name = 'macos' + ('x' if platform_arch == '64' else '')
|
||||
else:
|
||||
platform_name = platform
|
||||
|
||||
output_dir_name = output_dir_base + '_' + platform_name + platform_arch
|
||||
if options.distribsubdirsuffix != '':
|
||||
|
Reference in New Issue
Block a user