mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Windows: Build cef_sandbox.lib with different GN args for official binary distributions (issue #2220)
This commit is contained in:
@@ -510,6 +510,18 @@ parser.add_option(
|
||||
dest='clientdistribonly',
|
||||
default=False,
|
||||
help='Create a client CEF binary distribution only.')
|
||||
parser.add_option(
|
||||
'--sandbox-distrib',
|
||||
action='store_true',
|
||||
dest='sandboxdistrib',
|
||||
default=False,
|
||||
help='Create a cef_sandbox static library distribution.')
|
||||
parser.add_option(
|
||||
'--sandbox-distrib-only',
|
||||
action='store_true',
|
||||
dest='sandboxdistribonly',
|
||||
default=False,
|
||||
help='Create a cef_sandbox static library distribution only.')
|
||||
parser.add_option(
|
||||
'--no-distrib-docs',
|
||||
action='store_true',
|
||||
@@ -557,7 +569,7 @@ if (options.nochromiumupdate and options.forceupdate) or \
|
||||
if (options.noreleasebuild and \
|
||||
(options.minimaldistrib or options.minimaldistribonly or \
|
||||
options.clientdistrib or options.clientdistribonly)) or \
|
||||
(options.minimaldistribonly and options.clientdistribonly):
|
||||
(options.minimaldistribonly + options.clientdistribonly + options.sandboxdistribonly > 1):
|
||||
print 'Invalid combination of options.'
|
||||
parser.print_help(sys.stderr)
|
||||
sys.exit()
|
||||
@@ -600,13 +612,20 @@ if options.clientdistrib or options.clientdistribonly:
|
||||
parser.print_help(sys.stderr)
|
||||
sys.exit()
|
||||
|
||||
if platform != 'windows' and (options.sandboxdistrib or
|
||||
options.sandboxdistribonly):
|
||||
print 'The sandbox distribution is only supported on Windows.'
|
||||
sys.exit()
|
||||
|
||||
# CEF branch.
|
||||
if options.branch != 'trunk' and not options.branch.isdigit():
|
||||
print 'Invalid branch value: %s' % (options.branch)
|
||||
sys.exit()
|
||||
|
||||
cef_branch = options.branch
|
||||
|
||||
if cef_branch != 'trunk' and int(cef_branch) <= 1453:
|
||||
print 'The requested branch is too old to build using this tool'
|
||||
print 'The requested branch is too old to build using this tool.'
|
||||
sys.exit()
|
||||
|
||||
# True if the requested branch is 2272 or newer.
|
||||
@@ -1054,30 +1073,51 @@ if not options.nobuild and (chromium_checkout_changed or \
|
||||
if platform == 'windows' and options.x64build:
|
||||
build_dir_suffix = '_x64'
|
||||
|
||||
# Make a CEF Debug build.
|
||||
if not options.nodebugbuild:
|
||||
build_path = os.path.join('out', 'Debug' + build_dir_suffix)
|
||||
if use_gn:
|
||||
args_path = os.path.join(chromium_src_dir, build_path, 'args.gn')
|
||||
if os.path.exists(args_path):
|
||||
msg(args_path + ' contents:\n' + read_file(args_path))
|
||||
msg(args_path + ' contents:\n' + read_file(args_path))
|
||||
|
||||
# Make a CEF Debug build.
|
||||
run(command + build_path + target, chromium_src_dir, depot_tools_dir,
|
||||
os.path.join(download_dir, 'build-%s-debug.log' % (cef_branch)) \
|
||||
if options.buildlogfile else None)
|
||||
|
||||
if use_gn and platform == 'windows':
|
||||
# Make the separate cef_sandbox.lib build when GN is_official_build=true.
|
||||
build_path = os.path.join('out', 'Debug' + build_dir_suffix + '_sandbox')
|
||||
if os.path.exists(os.path.join(chromium_src_dir, build_path)):
|
||||
args_path = os.path.join(chromium_src_dir, build_path, 'args.gn')
|
||||
msg(args_path + ' contents:\n' + read_file(args_path))
|
||||
|
||||
run(command + build_path + ' cef_sandbox', chromium_src_dir, depot_tools_dir,
|
||||
os.path.join(download_dir, 'build-%s-debug-sandbox.log' % (cef_branch)) \
|
||||
if options.buildlogfile else None)
|
||||
|
||||
# Make a CEF Release build.
|
||||
if not options.noreleasebuild:
|
||||
build_path = os.path.join('out', 'Release' + build_dir_suffix)
|
||||
if use_gn:
|
||||
args_path = os.path.join(chromium_src_dir, build_path, 'args.gn')
|
||||
if os.path.exists(args_path):
|
||||
msg(args_path + ' contents:\n' + read_file(args_path))
|
||||
msg(args_path + ' contents:\n' + read_file(args_path))
|
||||
|
||||
# Make a CEF Release build.
|
||||
run(command + build_path + target, chromium_src_dir, depot_tools_dir,
|
||||
os.path.join(download_dir, 'build-%s-release.log' % (cef_branch)) \
|
||||
if options.buildlogfile else None)
|
||||
|
||||
if use_gn and platform == 'windows':
|
||||
# Make the separate cef_sandbox.lib build when GN is_official_build=true.
|
||||
build_path = os.path.join('out',
|
||||
'Release' + build_dir_suffix + '_sandbox')
|
||||
if os.path.exists(os.path.join(chromium_src_dir, build_path)):
|
||||
args_path = os.path.join(chromium_src_dir, build_path, 'args.gn')
|
||||
msg(args_path + ' contents:\n' + read_file(args_path))
|
||||
|
||||
run(command + build_path + ' cef_sandbox', chromium_src_dir, depot_tools_dir,
|
||||
os.path.join(download_dir, 'build-%s-release-sandbox.log' % (cef_branch)) \
|
||||
if options.buildlogfile else None)
|
||||
|
||||
elif not options.nobuild:
|
||||
msg('Not building. The source hashes have not changed and ' +
|
||||
'the output folder "%s" already exists' % (out_src_dir))
|
||||
@@ -1099,12 +1139,16 @@ if not options.nodistrib and (chromium_checkout_changed or \
|
||||
distrib_types.append('minimal')
|
||||
elif options.clientdistribonly:
|
||||
distrib_types.append('client')
|
||||
elif options.sandboxdistribonly:
|
||||
distrib_types.append('sandbox')
|
||||
else:
|
||||
distrib_types.append('standard')
|
||||
if options.minimaldistrib:
|
||||
distrib_types.append('minimal')
|
||||
if options.clientdistrib:
|
||||
distrib_types.append('client')
|
||||
if options.sandboxdistrib:
|
||||
distrib_types.append('sandbox')
|
||||
|
||||
cef_tools_dir = os.path.join(cef_src_dir, 'tools')
|
||||
|
||||
@@ -1124,6 +1168,8 @@ if not options.nodistrib and (chromium_checkout_changed or \
|
||||
path = path + ' --minimal'
|
||||
elif type == 'client':
|
||||
path = path + ' --client'
|
||||
elif type == 'sandbox':
|
||||
path = path + ' --sandbox'
|
||||
|
||||
if first_type:
|
||||
if options.nodistribdocs:
|
||||
|
14
tools/distrib/win/README.sandbox.txt
Normal file
14
tools/distrib/win/README.sandbox.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
CONTENTS
|
||||
--------
|
||||
|
||||
Debug Contains the Debug build of cef_sandbox.lib.
|
||||
|
||||
Release Contains the Release build of cef_sandbox.lib.
|
||||
|
||||
|
||||
USAGE
|
||||
-----
|
||||
|
||||
Please visit the CEF Website for usage information.
|
||||
|
||||
https://bitbucket.org/chromiumembedded/cef/
|
@@ -420,6 +420,28 @@ def GetConfigArgs(args, is_debug, cpu):
|
||||
return result
|
||||
|
||||
|
||||
def WinGetConfigArgsSandbox(args, is_debug, cpu):
|
||||
"""
|
||||
Return merged GN args for the Windows cef_sandbox.lib configuration and
|
||||
validate.
|
||||
"""
|
||||
add_args = {
|
||||
# Avoid libucrt.lib linker errors.
|
||||
'use_allocator_shim': False,
|
||||
|
||||
# Avoid /LTCG linker warnings and generate smaller lib files.
|
||||
'is_official_build': False
|
||||
}
|
||||
|
||||
result = MergeDicts(args, add_args, {
|
||||
'is_debug': is_debug,
|
||||
'target_cpu': cpu,
|
||||
})
|
||||
|
||||
ValidateArgs(result)
|
||||
return result
|
||||
|
||||
|
||||
def LinuxSysrootExists(cpu):
|
||||
"""
|
||||
Returns true if the sysroot for the specified |cpu| architecture exists.
|
||||
@@ -482,6 +504,14 @@ def GetAllPlatformConfigs(build_args):
|
||||
result['Debug_GN_' + cpu] = GetConfigArgs(args, True, cpu)
|
||||
result['Release_GN_' + cpu] = GetConfigArgs(args, False, cpu)
|
||||
|
||||
if platform == 'windows' and GetArgValue(args, 'is_official_build'):
|
||||
# Build cef_sandbox.lib with a different configuration.
|
||||
if create_debug:
|
||||
result['Debug_GN_' + cpu + '_sandbox'] = WinGetConfigArgsSandbox(
|
||||
args, True, cpu)
|
||||
result['Release_GN_' + cpu + '_sandbox'] = WinGetConfigArgsSandbox(
|
||||
args, False, cpu)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
|
@@ -112,7 +112,10 @@ def create_readme():
|
||||
footer_data = get_readme_component('footer')
|
||||
|
||||
# format the file
|
||||
data = header_data + '\n\n' + mode_data + '\n\n' + redistrib_data + '\n\n' + footer_data
|
||||
data = header_data + '\n\n' + mode_data
|
||||
if mode != 'sandbox':
|
||||
data += '\n\n' + redistrib_data
|
||||
data += '\n\n' + footer_data
|
||||
data = data.replace('$CEF_URL$', cef_url)
|
||||
data = data.replace('$CEF_REV$', cef_rev)
|
||||
data = data.replace('$CEF_VER$', cef_ver)
|
||||
@@ -149,6 +152,10 @@ def create_readme():
|
||||
distrib_desc = 'This distribution contains a release build of the ' + client_app + ' sample application\n' \
|
||||
'for the ' + platform_str + ' platform. Please see the LICENSING section of this document for\n' \
|
||||
'licensing terms and conditions.'
|
||||
elif mode == 'sandbox':
|
||||
distrib_type = 'Sandbox'
|
||||
distrib_desc = 'This distribution contains only the cef_sandbox static library. Please see\n' \
|
||||
'the LICENSING section of this document for licensing terms and conditions.'
|
||||
|
||||
data = data.replace('$DISTRIB_TYPE$', distrib_type)
|
||||
data = data.replace('$DISTRIB_DESC$', distrib_desc)
|
||||
@@ -343,7 +350,7 @@ parser.add_option(
|
||||
action='store_true',
|
||||
dest='armbuild',
|
||||
default=False,
|
||||
help='create an ARM binary distribution')
|
||||
help='create an ARM binary distribution (Linux only)')
|
||||
parser.add_option(
|
||||
'--minimal',
|
||||
action='store_true',
|
||||
@@ -356,6 +363,12 @@ parser.add_option(
|
||||
dest='client',
|
||||
default=False,
|
||||
help='include only the sample application')
|
||||
parser.add_option(
|
||||
'--sandbox',
|
||||
action='store_true',
|
||||
dest='sandbox',
|
||||
default=False,
|
||||
help='include only the cef_sandbox static library (Windows only)')
|
||||
parser.add_option(
|
||||
'-q',
|
||||
'--quiet',
|
||||
@@ -393,6 +406,10 @@ if options.armbuild and platform != 'linux':
|
||||
print '--arm-build is only supported on Linux.'
|
||||
sys.exit()
|
||||
|
||||
if options.sandbox and platform != 'windows':
|
||||
print '--sandbox is only supported on Windows.'
|
||||
sys.exit()
|
||||
|
||||
if not options.ninjabuild:
|
||||
print 'Ninja build is required on all platforms'
|
||||
sys.exit()
|
||||
@@ -456,6 +473,9 @@ if options.minimal:
|
||||
elif options.client:
|
||||
mode = 'client'
|
||||
output_dir_name = output_dir_name + '_client'
|
||||
elif options.sandbox:
|
||||
mode = 'sandbox'
|
||||
output_dir_name = output_dir_name + '_sandbox'
|
||||
else:
|
||||
mode = 'standard'
|
||||
|
||||
@@ -645,15 +665,31 @@ if platform == 'windows':
|
||||
]
|
||||
|
||||
libcef_dll_file = 'libcef.dll.lib'
|
||||
cef_sandbox_lib = 'obj\\cef\\cef_sandbox.lib'
|
||||
sandbox_libs = [
|
||||
'obj\\base\\allocator\\unified_allocator_shim\\*.obj',
|
||||
'obj\\base\\base.lib',
|
||||
'obj\\base\\base_static.lib',
|
||||
'obj\\base\\third_party\\dynamic_annotations\\dynamic_annotations.lib',
|
||||
'obj\\cef\\cef_sandbox.lib',
|
||||
cef_sandbox_lib,
|
||||
'obj\\sandbox\\win\\sandbox.lib',
|
||||
]
|
||||
|
||||
# Generate the cef_sandbox.lib merged library. A separate *_sandbox build
|
||||
# should exist when GN is_official_build=true.
|
||||
if mode in ('standard', 'minimal', 'sandbox'):
|
||||
dirs = {
|
||||
'Debug': (build_dir_debug + '_sandbox', build_dir_debug),
|
||||
'Release': (build_dir_release + '_sandbox', build_dir_release)
|
||||
}
|
||||
for dir_name in dirs.keys():
|
||||
for src_dir in dirs[dir_name]:
|
||||
if path_exists(os.path.join(src_dir, cef_sandbox_lib)):
|
||||
dst_dir = os.path.join(output_dir, dir_name)
|
||||
make_dir(dst_dir, options.quiet)
|
||||
combine_libs(src_dir, sandbox_libs,
|
||||
os.path.join(dst_dir, 'cef_sandbox.lib'))
|
||||
break
|
||||
|
||||
valid_build_dir = None
|
||||
|
||||
if mode == 'standard':
|
||||
@@ -672,8 +708,6 @@ if platform == 'windows':
|
||||
os.path.join(dst_dir, os.path.basename(binary)), options.quiet)
|
||||
copy_file(os.path.join(build_dir, libcef_dll_file), os.path.join(dst_dir, 'libcef.lib'), \
|
||||
options.quiet)
|
||||
combine_libs(build_dir, sandbox_libs,
|
||||
os.path.join(dst_dir, 'cef_sandbox.lib'))
|
||||
|
||||
if not options.nosymbols:
|
||||
# create the symbol output directory
|
||||
@@ -686,39 +720,38 @@ if platform == 'windows':
|
||||
else:
|
||||
sys.stderr.write("No Debug build files.\n")
|
||||
|
||||
# transfer Release files
|
||||
build_dir = build_dir_release
|
||||
if not options.allowpartial or path_exists(
|
||||
os.path.join(build_dir, 'libcef.dll')):
|
||||
valid_build_dir = build_dir
|
||||
dst_dir = os.path.join(output_dir, 'Release')
|
||||
make_dir(dst_dir, options.quiet)
|
||||
copy_files(
|
||||
os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet)
|
||||
for binary in binaries:
|
||||
copy_file(
|
||||
os.path.join(build_dir, binary),
|
||||
os.path.join(dst_dir, os.path.basename(binary)), options.quiet)
|
||||
if mode != 'sandbox':
|
||||
# transfer Release files
|
||||
build_dir = build_dir_release
|
||||
if not options.allowpartial or path_exists(
|
||||
os.path.join(build_dir, 'libcef.dll')):
|
||||
valid_build_dir = build_dir
|
||||
dst_dir = os.path.join(output_dir, 'Release')
|
||||
make_dir(dst_dir, options.quiet)
|
||||
copy_files(
|
||||
os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet)
|
||||
for binary in binaries:
|
||||
copy_file(
|
||||
os.path.join(build_dir, binary),
|
||||
os.path.join(dst_dir, os.path.basename(binary)), options.quiet)
|
||||
|
||||
if mode != 'client':
|
||||
copy_file(os.path.join(build_dir, libcef_dll_file), os.path.join(dst_dir, 'libcef.lib'), \
|
||||
options.quiet)
|
||||
combine_libs(build_dir, sandbox_libs,
|
||||
os.path.join(dst_dir, 'cef_sandbox.lib'))
|
||||
if mode != 'client':
|
||||
copy_file(os.path.join(build_dir, libcef_dll_file), os.path.join(dst_dir, 'libcef.lib'), \
|
||||
options.quiet)
|
||||
else:
|
||||
copy_file(
|
||||
os.path.join(build_dir, 'cefclient.exe'), dst_dir, options.quiet)
|
||||
|
||||
if not options.nosymbols:
|
||||
# create the symbol output directory
|
||||
symbol_output_dir = create_output_dir(
|
||||
output_dir_name + '_release_symbols', options.outputdir)
|
||||
# transfer contents
|
||||
copy_file(
|
||||
os.path.join(build_dir, 'libcef.dll.pdb'), symbol_output_dir,
|
||||
options.quiet)
|
||||
else:
|
||||
copy_file(
|
||||
os.path.join(build_dir, 'cefclient.exe'), dst_dir, options.quiet)
|
||||
|
||||
if not options.nosymbols:
|
||||
# create the symbol output directory
|
||||
symbol_output_dir = create_output_dir(
|
||||
output_dir_name + '_release_symbols', options.outputdir)
|
||||
# transfer contents
|
||||
copy_file(
|
||||
os.path.join(build_dir, 'libcef.dll.pdb'), symbol_output_dir,
|
||||
options.quiet)
|
||||
else:
|
||||
sys.stderr.write("No Release build files.\n")
|
||||
sys.stderr.write("No Release build files.\n")
|
||||
|
||||
if not valid_build_dir is None:
|
||||
# transfer resource files
|
||||
|
Reference in New Issue
Block a user