Add GN configuration (issue #1403)
This commit is contained in:
parent
05ee60b7b4
commit
d0a2e217a0
|
@ -0,0 +1,123 @@
|
|||
# Copyright 2016 The Chromium Embedded Framework Authors. Portions copyright
|
||||
# 2014 the Chromium Authors. All rights reserved. Use of this source code is
|
||||
# governed by a BSD-style license that can be found in the LICENSE file.
|
||||
#
|
||||
# This is a copy of src/chrome/chrome_repack_locales.gni with the necessary
|
||||
# modifications to meet CEF's requirements.
|
||||
|
||||
import("//build/config/chrome_build.gni")
|
||||
import("//build/config/features.gni")
|
||||
import("//build/config/ui.gni")
|
||||
import("//tools/grit/repack.gni")
|
||||
|
||||
# Arguments:
|
||||
#
|
||||
# locale
|
||||
# Internal name of locale. e.g. "pt-BR"
|
||||
#
|
||||
# output
|
||||
# Output file name.
|
||||
#
|
||||
# visibility
|
||||
# Normal meaning.
|
||||
template("_repack_one_locale") {
|
||||
locale = invoker.locale
|
||||
|
||||
repack(target_name) {
|
||||
visibility = invoker.visibility
|
||||
|
||||
# Each input pak file should also have a deps line for completeness.
|
||||
sources = [
|
||||
"${root_gen_dir}/cef/cef_strings_${locale}.pak",
|
||||
"${root_gen_dir}/chrome/platform_locale_settings_${locale}.pak",
|
||||
"${root_gen_dir}/components/strings/components_locale_settings_${locale}.pak",
|
||||
"${root_gen_dir}/components/strings/components_strings_${locale}.pak",
|
||||
"${root_gen_dir}/content/app/strings/content_strings_${locale}.pak",
|
||||
"${root_gen_dir}/extensions/strings/extensions_strings_${locale}.pak",
|
||||
"${root_gen_dir}/ui/strings/app_locale_settings_${locale}.pak",
|
||||
"${root_gen_dir}/ui/strings/ui_strings_${locale}.pak",
|
||||
]
|
||||
|
||||
# Use public_deps so that generated grit headers are discoverable from
|
||||
# the libcef_static target. Grit deps that generate .cc files must be
|
||||
# listed both here and in the libcef_static target.
|
||||
public_deps = [
|
||||
":cef_strings",
|
||||
"//chrome/app/resources:platform_locale_settings",
|
||||
"//components/strings:components_locale_settings",
|
||||
"//components/strings:components_strings",
|
||||
"//content/app/strings",
|
||||
"//extensions/strings",
|
||||
"//ui/strings:app_locale_settings",
|
||||
"//ui/strings:ui_strings",
|
||||
]
|
||||
|
||||
output = invoker.output
|
||||
}
|
||||
}
|
||||
|
||||
# Creates an action to call the repack_locales script.
|
||||
#
|
||||
# The GYP version generates the locales in the "gen" directory and then copies
|
||||
# it to the root build directory. This isn't easy to express in a GN copy
|
||||
# rule since the files on Mac have a complex structure. So we generate the
|
||||
# files into the final place and skip the "gen" directory.
|
||||
#
|
||||
# This template uses GN's looping constructs to avoid the complex call to
|
||||
# chrome/tools/build/repack_locales.py which wraps the repack commands in the
|
||||
# GYP build.
|
||||
#
|
||||
# Arguments
|
||||
#
|
||||
# input_locales
|
||||
# List of locale names to use as inputs.
|
||||
#
|
||||
# output_locales
|
||||
# A list containing the corresponding output names for each of the
|
||||
# input names. Mac uses different names in some cases.
|
||||
#
|
||||
# visibility
|
||||
template("cef_repack_locales") {
|
||||
# This is the name of the group below that will collect all the invidual
|
||||
# locale targets. External targets will depend on this.
|
||||
group_target_name = target_name
|
||||
|
||||
# GN's subscript is too stupid to do invoker.output_locales[foo] so we need
|
||||
# to make a copy and do output_locales[foo].
|
||||
output_locales = invoker.output_locales
|
||||
|
||||
# Collects all targets the loop generates.
|
||||
locale_targets = []
|
||||
|
||||
# This loop iterates over the input locales and also keeps a counter so it
|
||||
# can simultaneously iterate over the output locales (using GN's very
|
||||
# limited looping capabilities).
|
||||
current_index = 0
|
||||
foreach(input_locale, invoker.input_locales) {
|
||||
output_locale = output_locales[current_index]
|
||||
|
||||
# Compute the name of the target for the current file. Save it for the deps.
|
||||
current_name = "${target_name}_${input_locale}"
|
||||
locale_targets += [ ":$current_name" ]
|
||||
|
||||
_repack_one_locale(current_name) {
|
||||
visibility = [ ":$group_target_name" ]
|
||||
locale = input_locale
|
||||
|
||||
# Compute the output name. Mac uses a different location.
|
||||
if (is_mac || is_ios) {
|
||||
output = "${root_gen_dir}/repack/locales/${output_locale}.pak"
|
||||
} else {
|
||||
output = "${root_out_dir}/locales/${output_locale}.pak"
|
||||
}
|
||||
}
|
||||
|
||||
current_index = current_index + 1
|
||||
}
|
||||
|
||||
# The group that external targets depend on which collects all deps.
|
||||
group(group_target_name) {
|
||||
forward_variables_from(invoker, [ "visibility" ])
|
||||
public_deps = locale_targets
|
||||
}
|
||||
}
|
|
@ -18,9 +18,9 @@
|
|||
#include "base/threading/thread_restrictions.h"
|
||||
#include "content/public/common/file_chooser_params.h"
|
||||
#include "grit/cef_strings.h"
|
||||
#include "grit/ui_strings.h"
|
||||
#include "net/base/mime_util.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/strings/grit/ui_strings.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
#include "base/win/registry.h"
|
||||
#include "base/win/scoped_comptr.h"
|
||||
#include "grit/cef_strings.h"
|
||||
#include "grit/ui_strings.h"
|
||||
#include "net/base/mime_util.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/win/shell.h"
|
||||
#include "ui/strings/grit/ui_strings.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
# Copyright 2016 The Chromium Embedded Framework Authors. Portions copyright
|
||||
# 2014 the Chromium Authors. All rights reserved. Use of this source code is
|
||||
# governed by a BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import("//build/json_schema_api.gni")
|
||||
import("schemas.gni")
|
||||
|
||||
json_schema_api("api") {
|
||||
schemas = true
|
||||
bundle = true
|
||||
configs = [ "//build/config:precompiled_headers" ]
|
||||
bundle_name = "Chrome"
|
||||
|
||||
deps = schema_dependencies
|
||||
}
|
||||
|
||||
json_schema_api("api_registration") {
|
||||
impl_dir = "//cef/libcef/browser/extensions/api"
|
||||
bundle_registration = true
|
||||
configs = [ "//build/config:precompiled_headers" ]
|
||||
bundle_name = "Chrome"
|
||||
|
||||
deps = [
|
||||
":api",
|
||||
]
|
||||
deps += schema_dependencies
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
# Copyright 2016 The Chromium Embedded Framework Authors. Portions copyright
|
||||
# 2014 the Chromium Authors. All rights reserved. Use of this source code is
|
||||
# governed by a BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
gypi_values = exec_script("//build/gypi_to_gn.py",
|
||||
[ rebase_path("schemas.gypi") ],
|
||||
"scope",
|
||||
[ "schemas.gypi" ])
|
||||
|
||||
sources = gypi_values.schema_files
|
||||
|
||||
uncompiled_sources = gypi_values.non_compiled_schema_files
|
||||
|
||||
root_namespace = "extensions::api::%(namespace)s"
|
||||
schema_include_rules = "//cef/libcef/browser/extensions/api:extensions::api::%(namespace)s"
|
||||
schema_dependencies = [ "//extensions/common/api" ]
|
|
@ -7,14 +7,37 @@
|
|||
|
||||
patches = [
|
||||
{
|
||||
# Necessary for grit integration
|
||||
# Necessary for grit integration.
|
||||
'name': 'gritsettings',
|
||||
'path': '../tools/gritsettings/',
|
||||
},
|
||||
{
|
||||
# Necessary for GN integration.
|
||||
#
|
||||
# Move chrome target locales output to a chrome/ directory to avoid
|
||||
# conflicts with the CEF configuration.
|
||||
#
|
||||
# Add public_deps support to the GN repack template.
|
||||
# TODO(cef): Remove this once all grit includes are relative to the "gen"
|
||||
# directory.
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=623085
|
||||
#
|
||||
# Use a unique output path for the compile_xibs template on Mac.
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=623237
|
||||
#
|
||||
# Fix broken GN configuration for enable_print_preview = false on Mac.
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=617477
|
||||
#
|
||||
# Support custom VS toolchain on Windows.
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=623342
|
||||
'name': 'gn_config',
|
||||
'path': '../',
|
||||
},
|
||||
{
|
||||
# Disable use of the sysroot image for CEF because it does not include
|
||||
# the GTK dependency required by cefclient. It would be nice to enable
|
||||
# this functionality in the future. See http://crbug.com/504446.
|
||||
# TODO(cef): Remove this patch when GYP support is removed.
|
||||
'name': 'build',
|
||||
'path': '../build/',
|
||||
},
|
||||
|
@ -36,6 +59,7 @@ patches = [
|
|||
{
|
||||
# Fix ninja output for localization directories on OS X.
|
||||
# https://bugs.chromium.org/p/gyp/issues/detail?id=331
|
||||
# TODO(cef): Remove this patch when GYP support is removed.
|
||||
'name': 'gyp_331',
|
||||
'path': '../tools/gyp/pylib/',
|
||||
},
|
||||
|
|
|
@ -0,0 +1,189 @@
|
|||
diff --git .gn .gn
|
||||
index 3bd6bc4..0abf820 100644
|
||||
--- .gn
|
||||
+++ .gn
|
||||
@@ -247,6 +247,8 @@ exec_script_whitelist = [
|
||||
"//build/toolchain/win/BUILD.gn",
|
||||
"//build/util/branding.gni",
|
||||
"//build/util/version.gni",
|
||||
+ "//cef/BUILD.gn",
|
||||
+ "//cef/libcef/common/extensions/api/schemas.gni",
|
||||
"//chrome/android/BUILD.gn",
|
||||
"//chrome/browser/BUILD.gn",
|
||||
"//chrome/browser/chromeos/BUILD.gn",
|
||||
diff --git BUILD.gn BUILD.gn
|
||||
index 0a7fe56..467f536 100644
|
||||
--- BUILD.gn
|
||||
+++ BUILD.gn
|
||||
@@ -206,6 +206,7 @@ group("both_gn_and_gyp") {
|
||||
# and whether there should be other targets that are iOS-only and missing.
|
||||
deps += [
|
||||
"//cc:cc_unittests",
|
||||
+ "//cef",
|
||||
"//chrome/test:telemetry_perf_unittests",
|
||||
"//chrome/test:unit_tests",
|
||||
"//components:components_browsertests",
|
||||
diff --git build/config/features.gni build/config/features.gni
|
||||
index 9d33d91..d460e86 100644
|
||||
--- build/config/features.gni
|
||||
+++ build/config/features.gni
|
||||
@@ -148,7 +148,7 @@ enable_web_speech = !is_android && !is_ios
|
||||
|
||||
enable_task_manager = !is_ios && !is_android
|
||||
|
||||
-enable_themes = !is_android && !is_ios
|
||||
+enable_themes = !is_android && !is_ios && !is_linux
|
||||
|
||||
# Whether we are using the rlz library or not. Platforms like Android send
|
||||
# rlz codes for searches but do not use the library.
|
||||
|
||||
diff --git build/config/mac/base_rules.gni build/config/mac/base_rules.gni
|
||||
index 76610cc..7d17aba 100644
|
||||
--- build/config/mac/base_rules.gni
|
||||
+++ build/config/mac/base_rules.gni
|
||||
@@ -366,13 +366,13 @@ template("compile_xibs") {
|
||||
script = "//build/config/mac/compile_xib.py"
|
||||
sources = invoker.sources
|
||||
outputs = [
|
||||
- "$target_gen_dir/{{source_name_part}}.nib",
|
||||
+ "$target_gen_dir/$target_name/{{source_name_part}}.nib",
|
||||
]
|
||||
args = [
|
||||
"--input",
|
||||
"{{source}}",
|
||||
"--output",
|
||||
- rebase_path("$target_gen_dir/{{source_name_part}}.nib"),
|
||||
+ rebase_path("$target_gen_dir/$target_name/{{source_name_part}}.nib"),
|
||||
] + ibtool_flags
|
||||
}
|
||||
}
|
||||
diff --git build/config/win/visual_studio_version.gni build/config/win/visual_studio_version.gni
|
||||
index 05b369f..8be3a47 100644
|
||||
--- build/config/win/visual_studio_version.gni
|
||||
+++ build/config/win/visual_studio_version.gni
|
||||
@@ -12,9 +12,8 @@ declare_args() {
|
||||
# Use "2013" for Visual Studio 2013, or "2013e" for the Express version.
|
||||
visual_studio_version = ""
|
||||
|
||||
- # Directory of the Windows driver kit. If visual_studio_path is empty, this
|
||||
- # will be auto-filled.
|
||||
- wdk_path = ""
|
||||
+ # Path to Visual Studio runtime libraries.
|
||||
+ visual_studio_runtime_dirs = ""
|
||||
|
||||
# Full path to the Windows SDK, not including a backslash at the end.
|
||||
# This value is the default location, override if you have a different
|
||||
@@ -33,12 +32,11 @@ if (visual_studio_path == "") {
|
||||
visual_studio_path = toolchain_data.vs_path
|
||||
windows_sdk_path = toolchain_data.sdk_path
|
||||
visual_studio_version = toolchain_data.vs_version
|
||||
- wdk_path = toolchain_data.wdk_dir
|
||||
visual_studio_runtime_dirs = toolchain_data.runtime_dirs
|
||||
} else {
|
||||
assert(visual_studio_version != "",
|
||||
"You must set the visual_studio_version if you set the path")
|
||||
- assert(wdk_path != "",
|
||||
- "You must set the wdk_path if you set the visual studio path")
|
||||
- visual_studio_runtime_dirs = []
|
||||
+ assert(visual_studio_runtime_dirs != "",
|
||||
+ "You must set the visual_studio_runtime_dirs if you set the visual " +
|
||||
+ "studio path")
|
||||
}
|
||||
diff --git build/toolchain/win/setup_toolchain.py build/toolchain/win/setup_toolchain.py
|
||||
index d58cb85..fd608ba 100644
|
||||
--- build/toolchain/win/setup_toolchain.py
|
||||
+++ build/toolchain/win/setup_toolchain.py
|
||||
@@ -124,11 +124,14 @@ def _LoadToolchainEnv(cpu, sdk_dir):
|
||||
script_path = os.path.normpath(os.path.join(
|
||||
os.environ['GYP_MSVS_OVERRIDE_PATH'],
|
||||
'VC/vcvarsall.bat'))
|
||||
- if not os.path.exists(script_path):
|
||||
- raise Exception('%s is missing - make sure VC++ tools are installed.' %
|
||||
- script_path)
|
||||
- args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64']
|
||||
- variables = _LoadEnvFromBat(args)
|
||||
+ if os.path.exists(script_path):
|
||||
+ args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64']
|
||||
+ variables = _LoadEnvFromBat(args)
|
||||
+ else:
|
||||
+ variables = []
|
||||
+ for k in sorted(os.environ.keys()):
|
||||
+ variables.append('%s=%s' % (str(k), str(os.environ[k])))
|
||||
+ variables = '\n'.join(variables)
|
||||
return _ExtractImportantEnvironment(variables)
|
||||
|
||||
|
||||
diff --git chrome/BUILD.gn chrome/BUILD.gn
|
||||
index fa6cd4c..eaab973 100644
|
||||
--- chrome/BUILD.gn
|
||||
+++ chrome/BUILD.gn
|
||||
@@ -647,7 +647,7 @@ if (is_win) {
|
||||
]
|
||||
|
||||
foreach(locale, locales_as_mac_outputs) {
|
||||
- sources += [ "$root_gen_dir/repack/locales/$locale.pak" ]
|
||||
+ sources += [ "$root_gen_dir/chrome/repack/locales/$locale.pak" ]
|
||||
}
|
||||
|
||||
outputs = [
|
||||
diff --git chrome/chrome_repack_locales.gni chrome/chrome_repack_locales.gni
|
||||
index 9601dd4..9a7734a 100644
|
||||
--- chrome/chrome_repack_locales.gni
|
||||
+++ chrome/chrome_repack_locales.gni
|
||||
@@ -161,9 +161,9 @@ template("chrome_repack_locales") {
|
||||
|
||||
# Compute the output name. Mac uses a different location.
|
||||
if (is_mac || is_ios) {
|
||||
- output = "${root_gen_dir}/repack/locales/${output_locale}.pak"
|
||||
+ output = "${root_gen_dir}/chrome/repack/locales/${output_locale}.pak"
|
||||
} else {
|
||||
- output = "${root_out_dir}/locales/${output_locale}.pak"
|
||||
+ output = "${root_out_dir}/chrome/locales/${output_locale}.pak"
|
||||
}
|
||||
}
|
||||
|
||||
diff --git chrome/installer/mini_installer/BUILD.gn chrome/installer/mini_installer/BUILD.gn
|
||||
index a3dcae8..ea60e17 100644
|
||||
--- chrome/installer/mini_installer/BUILD.gn
|
||||
+++ chrome/installer/mini_installer/BUILD.gn
|
||||
@@ -76,7 +76,7 @@ action("archive") {
|
||||
inputs = [
|
||||
"$root_out_dir/chrome.exe",
|
||||
"$root_out_dir/chrome.dll",
|
||||
- "$root_out_dir/locales/en-US.pak",
|
||||
+ "$root_out_dir/chrome/locales/en-US.pak",
|
||||
"$root_out_dir/setup.exe",
|
||||
release_file,
|
||||
]
|
||||
diff --git chrome/test/BUILD.gn chrome/test/BUILD.gn
|
||||
index e0f20cf..ba7aa8f 100644
|
||||
--- chrome/test/BUILD.gn
|
||||
+++ chrome/test/BUILD.gn
|
||||
@@ -1428,7 +1428,6 @@ if (!is_android) {
|
||||
if (!enable_print_preview) {
|
||||
sources -= [
|
||||
"../browser/extensions/api/cloud_print_private/cloud_print_private_apitest.cc",
|
||||
- "../browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc",
|
||||
"../browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc",
|
||||
"../browser/printing/print_preview_dialog_controller_browsertest.cc",
|
||||
"../browser/printing/print_preview_pdf_generated_browsertest.cc",
|
||||
diff --git tools/grit/repack.gni tools/grit/repack.gni
|
||||
index 42087f9..7dd1520 100644
|
||||
--- tools/grit/repack.gni
|
||||
+++ tools/grit/repack.gni
|
||||
@@ -18,6 +18,7 @@ declare_args() {
|
||||
# File name (single string) of the output file.
|
||||
#
|
||||
# deps [optional]
|
||||
+# public_deps [optional]
|
||||
# visibility [optional]
|
||||
# Normal meaning.
|
||||
template("repack") {
|
||||
@@ -25,6 +26,7 @@ template("repack") {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"deps",
|
||||
+ "public_deps",
|
||||
"testonly",
|
||||
"visibility",
|
||||
])
|
|
@ -169,17 +169,20 @@ def download_and_extract(src, target):
|
|||
if temporary and os.path.exists(archive_path):
|
||||
os.remove(archive_path)
|
||||
|
||||
def read_config_file(path):
|
||||
""" Read a configuration file. """
|
||||
def read_file(path):
|
||||
""" Read a file. """
|
||||
if os.path.exists(path):
|
||||
fp = open(path, 'r')
|
||||
data = fp.read()
|
||||
fp.close()
|
||||
return data
|
||||
else:
|
||||
raise Exception("Path does not exist: %s" % (path))
|
||||
|
||||
def read_config_file(path):
|
||||
""" Read a configuration file. """
|
||||
# Parse the contents.
|
||||
return eval(data, {'__builtins__': None}, None)
|
||||
return eval(read_file(path), {'__builtins__': None}, None)
|
||||
|
||||
def write_config_file(path, contents):
|
||||
""" Write a configuration file. """
|
||||
|
@ -399,7 +402,7 @@ parser.add_option('--build-log-file',
|
|||
'directory.')
|
||||
parser.add_option('--x64-build',
|
||||
action='store_true', dest='x64build', default=False,
|
||||
help='Build for 64-bit systems (Windows and Mac OS X only).')
|
||||
help='Create a 64-bit build.')
|
||||
|
||||
# Distribution-related options.
|
||||
parser.add_option('--force-distrib',
|
||||
|
@ -496,14 +499,6 @@ if options.clientdistrib or options.clientdistribonly:
|
|||
parser.print_help(sys.stderr)
|
||||
sys.exit()
|
||||
|
||||
if options.x64build and platform != 'windows' and platform != 'macosx':
|
||||
print 'The x64 build option is only used on Windows and Mac OS X.'
|
||||
sys.exit()
|
||||
|
||||
if platform == 'windows' and not 'GYP_MSVS_VERSION' in os.environ.keys():
|
||||
print 'You must set the GYP_MSVS_VERSION environment variable on Windows.'
|
||||
sys.exit()
|
||||
|
||||
# CEF branch.
|
||||
if options.branch != 'trunk' and not options.branch.isdigit():
|
||||
print 'Invalid branch value: %s' % (options.branch)
|
||||
|
@ -519,6 +514,29 @@ branch_is_2272_or_newer = (cef_branch == 'trunk' or int(cef_branch) >= 2272)
|
|||
# True if the requested branch is 2357 or newer.
|
||||
branch_is_2357_or_newer = (cef_branch == 'trunk' or int(cef_branch) >= 2357)
|
||||
|
||||
# True if the requested branch is 2743 or older.
|
||||
branch_is_2743_or_older = (cef_branch != 'trunk' and int(cef_branch) <= 2743)
|
||||
|
||||
# Whether to use GN or GYP. GYP is currently the default.
|
||||
use_gn = bool(int(os.environ.get('CEF_USE_GN', '0')))
|
||||
if use_gn:
|
||||
if branch_is_2743_or_older:
|
||||
print 'GN is not supported with branch 2743 and older.'
|
||||
sys.exit()
|
||||
else:
|
||||
if options.x64build and platform != 'windows' and platform != 'macosx':
|
||||
print 'The x64 build option is only used on Windows and Mac OS X.'
|
||||
sys.exit()
|
||||
|
||||
if platform == 'windows' and not 'GYP_MSVS_VERSION' in os.environ.keys():
|
||||
print 'You must set the GYP_MSVS_VERSION environment variable on Windows.'
|
||||
sys.exit()
|
||||
|
||||
# True if GYP_DEFINES=target_arch=x64 must be set.
|
||||
gyp_needs_target_arch_x64 = options.x64build and \
|
||||
(platform == 'windows' or \
|
||||
(platform == 'macosx' and not branch_is_2272_or_newer))
|
||||
|
||||
# Starting with 43.0.2357.126 the DEPS file is now 100% Git and the .DEPS.git
|
||||
# file is no longer created.
|
||||
if branch_is_2357_or_newer:
|
||||
|
@ -531,11 +549,6 @@ if platform == 'macosx' and not options.x64build and branch_is_2272_or_newer:
|
|||
'newer. Add --x64-build flag to generate a 64-bit build.'
|
||||
sys.exit()
|
||||
|
||||
# True if GYP_DEFINES=target_arch=x64 must be set.
|
||||
gyp_needs_target_arch_x64 = options.x64build and \
|
||||
(platform == 'windows' or \
|
||||
(platform == 'macosx' and not branch_is_2272_or_newer))
|
||||
|
||||
# Options that force the sources to change.
|
||||
force_change = options.forceclean or options.forceupdate
|
||||
|
||||
|
@ -869,19 +882,21 @@ if not options.nobuild and (chromium_checkout_changed or \
|
|||
# Building should also force a distribution.
|
||||
options.forcedistrib = True
|
||||
|
||||
# Set GYP environment variables.
|
||||
os.environ['GYP_GENERATORS'] = 'ninja'
|
||||
if gyp_needs_target_arch_x64:
|
||||
if 'GYP_DEFINES' in os.environ.keys():
|
||||
os.environ['GYP_DEFINES'] = os.environ['GYP_DEFINES'] + ' ' + \
|
||||
'target_arch=x64'
|
||||
else:
|
||||
os.environ['GYP_DEFINES'] = 'target_arch=x64'
|
||||
if not use_gn:
|
||||
# Set GYP environment variables.
|
||||
os.environ['GYP_GENERATORS'] = 'ninja'
|
||||
if gyp_needs_target_arch_x64:
|
||||
if 'GYP_DEFINES' in os.environ.keys():
|
||||
os.environ['GYP_DEFINES'] = os.environ['GYP_DEFINES'] + ' ' + \
|
||||
'target_arch=x64'
|
||||
else:
|
||||
os.environ['GYP_DEFINES'] = 'target_arch=x64'
|
||||
|
||||
# Print all build-related environment variables including any that were set
|
||||
# previously.
|
||||
for key in os.environ.keys():
|
||||
if key.startswith('GYP_') or key.startswith('DEPOT_TOOLS_'):
|
||||
if key.startswith('CEF_') or key.startswith('GN_') or \
|
||||
key.startswith('GYP_') or key.startswith('DEPOT_TOOLS_'):
|
||||
msg('%s=%s' % (key, os.environ[key]))
|
||||
|
||||
# Run the cef_create_projects script to generate project files.
|
||||
|
@ -897,21 +912,42 @@ if not options.nobuild and (chromium_checkout_changed or \
|
|||
target = target + ' cef_unittests'
|
||||
if platform == 'linux':
|
||||
target = target + ' chrome_sandbox'
|
||||
|
||||
build_dir_suffix = ''
|
||||
if platform == 'windows' and options.x64build:
|
||||
build_dir_suffix = '_x64'
|
||||
if use_gn:
|
||||
# CEF uses a consistent directory naming scheme for GN via
|
||||
# GetAllPlatformConfigs in tools/gn_args.py.
|
||||
if options.x64build:
|
||||
build_dir_suffix = '_GN_x64'
|
||||
else:
|
||||
build_dir_suffix = '_GN_x86'
|
||||
else:
|
||||
# GYP outputs both x86 and x64 builds to the same directory on Linux and
|
||||
# Mac OS X. On Windows it suffixes the directory name for x64 builds.
|
||||
if platform == 'windows' and options.x64build:
|
||||
build_dir_suffix = '_x64'
|
||||
|
||||
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))
|
||||
|
||||
# Make a CEF Debug build.
|
||||
run(command + os.path.join('out', 'Debug' + build_dir_suffix) + target, \
|
||||
chromium_src_dir, depot_tools_dir,
|
||||
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 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))
|
||||
|
||||
# Make a CEF Release build.
|
||||
run(command + os.path.join('out', 'Release' + build_dir_suffix) + target, \
|
||||
chromium_src_dir, depot_tools_dir,
|
||||
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)
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
# found in the LICENSE file.
|
||||
|
||||
from gclient_util import *
|
||||
from gn_args import GetAllPlatformConfigs, GetConfigFileContents
|
||||
from file_util import make_dir, write_file
|
||||
import os, sys
|
||||
|
||||
# The CEF directory is the parent directory of _this_ script.
|
||||
|
@ -11,6 +13,18 @@ cef_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
|
|||
# The src directory is the parent directory of the CEF directory.
|
||||
src_dir = os.path.abspath(os.path.join(cef_dir, os.pardir))
|
||||
|
||||
# Determine the platform.
|
||||
if sys.platform == 'win32':
|
||||
platform = 'windows'
|
||||
elif sys.platform == 'darwin':
|
||||
platform = 'macosx'
|
||||
elif sys.platform.startswith('linux'):
|
||||
platform = 'linux'
|
||||
else:
|
||||
print 'Unknown operating system platform'
|
||||
sys.exit()
|
||||
|
||||
|
||||
print "\nGenerating CEF version header file..."
|
||||
gyper = [ 'python', 'tools/make_version_header.py',
|
||||
'--header', 'include/cef_version.h',
|
||||
|
@ -26,81 +40,104 @@ RunAction(cef_dir, patcher)
|
|||
|
||||
print "\nGenerating CEF project files..."
|
||||
|
||||
# depot_tools currently bundles VS2013 Express Update 1 which causes linker
|
||||
# errors with Debug builds (see issue #1304). Don't use the bundled version
|
||||
# unless explicitly requested.
|
||||
if not 'DEPOT_TOOLS_WIN_TOOLCHAIN' in os.environ.keys():
|
||||
os.environ['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'
|
||||
# Whether to use GN or GYP. GYP is currently the default.
|
||||
use_gn = bool(int(os.environ.get('CEF_USE_GN', '0')))
|
||||
gn_args = {}
|
||||
|
||||
# By default GYP+Ninja on Windows expects Visual Studio to be installed on the
|
||||
# local machine. To build when Visual Studio is extracted to a directory but not
|
||||
# installed (e.g. via a custom toolchain) you have two options:
|
||||
#
|
||||
# 1. Set up the environment using only environment variables:
|
||||
# set WIN_CUSTOM_TOOLCHAIN=1
|
||||
# set VS_ROOT=<VS root directory>
|
||||
# set SDK_ROOT=<Platform SDK root directory>
|
||||
# set INCLUDE=<VS include paths>
|
||||
# set PATH=<VS executable paths>
|
||||
# set LIB=<VS library paths>
|
||||
#
|
||||
# 2. Set up the environment using a combination of environment variables and the
|
||||
# "%GYP_MSVS_OVERRIDE_PATH%\VC\vcvarsall.bat" script:
|
||||
# set GYP_MSVS_OVERRIDE_PATH=<VS root directory>
|
||||
# set GYP_DEFINES="windows_sdk_path=<Platform SDK root directory>"
|
||||
#
|
||||
# The following environment variables must also be set:
|
||||
# set DEPOT_TOOLS_WIN_TOOLCHAIN=0
|
||||
# set GYP_MSVS_VERSION=<VS version>
|
||||
# set CEF_VCVARS=<empty .bat file>
|
||||
custom_toolchain = False
|
||||
if bool(int(os.environ.get('WIN_CUSTOM_TOOLCHAIN', '0'))):
|
||||
required_vars = [
|
||||
'GYP_MSVS_VERSION',
|
||||
'VS_ROOT',
|
||||
'SDK_ROOT',
|
||||
'INCLUDE',
|
||||
'PATH',
|
||||
'LIB',
|
||||
]
|
||||
for var in required_vars:
|
||||
if not var in os.environ.keys():
|
||||
raise Exception('%s environment variable must be set' % var)
|
||||
if platform == 'windows':
|
||||
# Force use of the locally installed version of Visual Studio.
|
||||
if not 'DEPOT_TOOLS_WIN_TOOLCHAIN' in os.environ:
|
||||
os.environ['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'
|
||||
|
||||
custom_toolchain = True
|
||||
# By default GN/GYP+Ninja on Windows expects Visual Studio to be installed on
|
||||
# the local machine. To build when Visual Studio is extracted to a directory
|
||||
# but not installed (e.g. via a custom toolchain):
|
||||
# set WIN_CUSTOM_TOOLCHAIN=1
|
||||
# set CEF_VCVARS=none
|
||||
# set GYP_MSVS_VERSION=<VS version>
|
||||
# set VS_ROOT=<VS root directory>
|
||||
# set VS_CRT_ROOT=<VS CRT root directory> (GN only)
|
||||
# set SDK_ROOT=<Platform SDK root directory>
|
||||
# set INCLUDE=<VS include paths>
|
||||
# set PATH=<VS executable paths>
|
||||
# set LIB=<VS library paths>
|
||||
custom_toolchain = False
|
||||
if bool(int(os.environ.get('WIN_CUSTOM_TOOLCHAIN', '0'))):
|
||||
required_vars = [
|
||||
'GYP_MSVS_VERSION',
|
||||
'VS_ROOT',
|
||||
'SDK_ROOT',
|
||||
'INCLUDE',
|
||||
'PATH',
|
||||
'LIB',
|
||||
]
|
||||
if use_gn:
|
||||
required_vars.append('VS_CRT_ROOT')
|
||||
for var in required_vars:
|
||||
if not var in os.environ.keys():
|
||||
raise Exception('%s environment variable must be set' % var)
|
||||
|
||||
# Set windows_sdk_path via GYP_DEFINES.
|
||||
gyp_defines = ''
|
||||
if 'GYP_DEFINES' in os.environ.keys():
|
||||
gyp_defines = os.environ['GYP_DEFINES'] + ' '
|
||||
gyp_defines = gyp_defines + \
|
||||
'windows_sdk_path=' + os.environ['SDK_ROOT'].replace('\\', '/')
|
||||
os.environ['GYP_DEFINES'] = gyp_defines
|
||||
custom_toolchain = True
|
||||
|
||||
# Necessary to return correct VS version information via GetVSVersion in
|
||||
# src/tools/gyp/pylib/gyp/msvs_emulation.py.
|
||||
os.environ['GYP_MSVS_OVERRIDE_PATH'] = os.environ['VS_ROOT']
|
||||
# VC variables will be set via INCLUDE/PATH/LIB.
|
||||
os.environ['CEF_VCVARS'] = 'none'
|
||||
|
||||
# Generate environment files (environment.x64, environment.x86) in each
|
||||
# build output directory.
|
||||
# When using the default toolchain this is done by GenerateEnvironmentFiles
|
||||
# in src/tools/gyp/pylib/gyp/msvs_emulation.py.
|
||||
setup_script = os.path.join(cef_dir, 'tools/setup_toolchain.py')
|
||||
win_tool_script = os.path.join(src_dir, 'tools/gyp/pylib/gyp/win_tool.py')
|
||||
out_dirs = ['Debug', 'Debug_x64', 'Release', 'Release_x64']
|
||||
for out_dir in out_dirs:
|
||||
out_dir_abs = os.path.join(src_dir, 'out', out_dir)
|
||||
if not os.path.exists(out_dir_abs):
|
||||
os.makedirs(out_dir_abs)
|
||||
cmd = ['python', setup_script,
|
||||
os.environ['VS_ROOT'], win_tool_script, os.environ['SDK_ROOT']]
|
||||
RunAction(out_dir_abs, cmd)
|
||||
# Necessary to return correct VS version information via GetVSVersion in
|
||||
# src/tools/gyp/pylib/gyp/msvs_emulation.py.
|
||||
os.environ['GYP_MSVS_OVERRIDE_PATH'] = os.environ['VS_ROOT']
|
||||
|
||||
os.environ['CEF_DIRECTORY'] = os.path.basename(cef_dir)
|
||||
gyper = [ 'python', '../build/gyp_chromium', 'cef.gyp', '-I', 'cef.gypi' ]
|
||||
if custom_toolchain:
|
||||
# Disable GYP's auto-detection of the VS install.
|
||||
gyper.extend(['-G', 'ninja_use_custom_environment_files'])
|
||||
if 'GYP_ARGUMENTS' in os.environ.keys():
|
||||
gyper.extend(os.environ['GYP_ARGUMENTS'].split(' '))
|
||||
RunAction(cef_dir, gyper)
|
||||
if use_gn:
|
||||
# Windows custom toolchain requirements. See comments in gn_args.py.
|
||||
gn_args['visual_studio_path'] = os.environ['VS_ROOT']
|
||||
gn_args['visual_studio_version'] = os.environ['GYP_MSVS_VERSION']
|
||||
gn_args['visual_studio_runtime_dirs'] = os.environ['VS_CRT_ROOT']
|
||||
gn_args['windows_sdk_path'] = os.environ['SDK_ROOT']
|
||||
else:
|
||||
# Set windows_sdk_path via GYP_DEFINES.
|
||||
gyp_defines = ''
|
||||
if 'GYP_DEFINES' in os.environ:
|
||||
gyp_defines = os.environ['GYP_DEFINES'] + ' '
|
||||
gyp_defines = \
|
||||
gyp_defines + \
|
||||
'windows_sdk_path=' + os.environ['SDK_ROOT'].replace('\\', '/')
|
||||
os.environ['GYP_DEFINES'] = gyp_defines
|
||||
|
||||
# Generate environment files (environment.x64, environment.x86) in each
|
||||
# build output directory.
|
||||
# When using the default toolchain this is done by
|
||||
# GenerateEnvironmentFiles in src/tools/gyp/pylib/gyp/msvs_emulation.py.
|
||||
setup_script = os.path.join(cef_dir, 'tools/setup_toolchain.py')
|
||||
win_tool_script = os.path.join(src_dir, 'tools/gyp/pylib/gyp/win_tool.py')
|
||||
out_dirs = ['Debug', 'Debug_x64', 'Release', 'Release_x64']
|
||||
for out_dir in out_dirs:
|
||||
out_dir_abs = os.path.join(src_dir, 'out', out_dir)
|
||||
if not os.path.exists(out_dir_abs):
|
||||
os.makedirs(out_dir_abs)
|
||||
cmd = ['python', setup_script,
|
||||
os.environ['VS_ROOT'], win_tool_script, os.environ['SDK_ROOT']]
|
||||
RunAction(out_dir_abs, cmd)
|
||||
|
||||
if use_gn:
|
||||
configs = GetAllPlatformConfigs(gn_args)
|
||||
for dir, config in configs.items():
|
||||
# Create out directories and write the args.gn file.
|
||||
out_path = os.path.join(src_dir, 'out', dir)
|
||||
make_dir(out_path, False)
|
||||
args_gn_path = os.path.join(out_path, 'args.gn')
|
||||
args_gn_contents = GetConfigFileContents(config)
|
||||
write_file(args_gn_path, args_gn_contents)
|
||||
|
||||
# Generate the Ninja config.
|
||||
cmd = [ 'gn', 'gen', os.path.join('out', dir) ]
|
||||
if 'GN_ARGUMENTS' in os.environ.keys():
|
||||
cmd.extend(os.environ['GN_ARGUMENTS'].split(' '))
|
||||
RunAction(src_dir, cmd)
|
||||
else:
|
||||
os.environ['CEF_DIRECTORY'] = os.path.basename(cef_dir)
|
||||
gyper = [ 'python', '../build/gyp_chromium', 'cef.gyp', '-I', 'cef.gypi' ]
|
||||
if custom_toolchain:
|
||||
# Disable GYP's auto-detection of the VS install.
|
||||
gyper.extend(['-G', 'ninja_use_custom_environment_files'])
|
||||
if 'GYP_ARGUMENTS' in os.environ.keys():
|
||||
gyper.extend(os.environ['GYP_ARGUMENTS'].split(' '))
|
||||
RunAction(cef_dir, gyper)
|
||||
|
|
|
@ -0,0 +1,319 @@
|
|||
# Copyright 2016 The Chromium Embedded Framework Authors. Portions copyright
|
||||
# 2012 Google Inc. All rights reserved. Use of this source code is governed by
|
||||
# a BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import os
|
||||
import shlex
|
||||
import sys
|
||||
|
||||
# Determine the platform.
|
||||
if sys.platform == 'win32':
|
||||
platform = 'windows'
|
||||
elif sys.platform == 'darwin':
|
||||
platform = 'macosx'
|
||||
elif sys.platform.startswith('linux'):
|
||||
platform = 'linux'
|
||||
else:
|
||||
print 'Unknown operating system platform'
|
||||
sys.exit()
|
||||
|
||||
def msg(msg):
|
||||
print 'NOTE: ' + msg
|
||||
|
||||
def NameValueListToDict(name_value_list):
|
||||
"""
|
||||
Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary
|
||||
of the pairs. If a string is simply NAME, then the value in the dictionary
|
||||
is set to True. If VALUE can be converted to a boolean or integer, it is.
|
||||
"""
|
||||
result = { }
|
||||
for item in name_value_list:
|
||||
tokens = item.split('=', 1)
|
||||
if len(tokens) == 2:
|
||||
token_value = tokens[1]
|
||||
if token_value.lower() == 'true':
|
||||
token_value = True
|
||||
elif token_value.lower() == 'false':
|
||||
token_value = False
|
||||
else:
|
||||
# If we can make it an int, use that, otherwise, use the string.
|
||||
try:
|
||||
token_value = int(token_value)
|
||||
except ValueError:
|
||||
sys.exc_clear()
|
||||
# Set the variable to the supplied value.
|
||||
result[tokens[0]] = token_value
|
||||
else:
|
||||
# No value supplied, treat it as a boolean and set it.
|
||||
result[tokens[0]] = True
|
||||
return result
|
||||
|
||||
def ShlexEnv(env_name):
|
||||
"""
|
||||
Split an environment variable using shell-like syntax.
|
||||
"""
|
||||
flags = os.environ.get(env_name, [])
|
||||
if flags:
|
||||
flags = shlex.split(flags)
|
||||
return flags
|
||||
|
||||
def MergeDicts(*dict_args):
|
||||
"""
|
||||
Given any number of dicts, shallow copy and merge into a new dict.
|
||||
Precedence goes to key value pairs in latter dicts.
|
||||
"""
|
||||
result = {}
|
||||
for dictionary in dict_args:
|
||||
result.update(dictionary)
|
||||
return result
|
||||
|
||||
def GetChromiumDefaultArgs():
|
||||
"""
|
||||
Return default GN args. These must match the Chromium defaults.
|
||||
"""
|
||||
# Search for these values in declare_args() sections of *.gni files to find
|
||||
# the defaults.
|
||||
|
||||
defaults = {
|
||||
'dcheck_always_on': False,
|
||||
'is_asan': False,
|
||||
'is_debug': True,
|
||||
'is_official_build': False,
|
||||
'target_cpu': 'x64',
|
||||
}
|
||||
|
||||
if platform == 'linux':
|
||||
defaults['use_sysroot'] = True
|
||||
|
||||
if platform == 'windows':
|
||||
defaults['is_win_fastlink'] = False
|
||||
defaults['visual_studio_path'] = ''
|
||||
defaults['visual_studio_version'] = ''
|
||||
defaults['windows_sdk_path'] = ''
|
||||
|
||||
return defaults
|
||||
|
||||
def GetArgValue(args, key):
|
||||
"""
|
||||
Return an existing GN arg value or the Chromium default.
|
||||
"""
|
||||
defaults = GetChromiumDefaultArgs()
|
||||
assert key in defaults, "No default Chromium value specified for %s" % key
|
||||
return args.get(key, defaults[key])
|
||||
|
||||
def GetRecommendedDefaultArgs():
|
||||
"""
|
||||
Return recommended default GN args that differ from Chromium defaults.
|
||||
"""
|
||||
# Search for these values in declare_args() sections of *.gni files to find
|
||||
# the defaults.
|
||||
|
||||
result = {
|
||||
# Enable NaCL. Default is true. False is recommended for faster builds.
|
||||
'enable_nacl': False,
|
||||
}
|
||||
|
||||
if platform == 'linux':
|
||||
# Use a sysroot environment. Default is true. False is recommended for local
|
||||
# builds.
|
||||
# Run the following commands to download the sysroot environment:
|
||||
# x86 build only: $ export GYP_DEFINES='target_arch=ia32'
|
||||
# x86 or x64 build: $ gclient runhooks
|
||||
result['use_sysroot'] = False
|
||||
|
||||
return result
|
||||
|
||||
def GetGNEnvArgs():
|
||||
"""
|
||||
Return GN args specified via the GN_DEFINES env variable.
|
||||
"""
|
||||
return NameValueListToDict(ShlexEnv('GN_DEFINES'))
|
||||
|
||||
def GetRequiredArgs():
|
||||
"""
|
||||
Return required GN args.
|
||||
"""
|
||||
result = {
|
||||
# Set ENABLE_PRINTING=1 ENABLE_BASIC_PRINTING=1.
|
||||
'enable_basic_printing': True,
|
||||
'enable_print_preview': False,
|
||||
|
||||
# Enable support for Widevine CDM.
|
||||
'enable_widevine': True,
|
||||
|
||||
# Disable support for plugin installation.
|
||||
'enable_plugin_installation': False,
|
||||
}
|
||||
|
||||
if platform == 'linux' or platform == 'macosx':
|
||||
# Don't use the chrome style plugin.
|
||||
result['clang_use_chrome_plugins'] = False
|
||||
|
||||
return result
|
||||
|
||||
def GetMergedArgs(build_args):
|
||||
"""
|
||||
Return merged GN args.
|
||||
"""
|
||||
return MergeDicts(GetRecommendedDefaultArgs(), GetGNEnvArgs(), build_args, GetRequiredArgs())
|
||||
|
||||
def ValidateArgs(args):
|
||||
"""
|
||||
Validate GN arg combinations that we know about. Also provide suggestions
|
||||
where appropriate.
|
||||
"""
|
||||
dcheck_always_on = GetArgValue(args, 'dcheck_always_on')
|
||||
is_asan = GetArgValue(args, 'is_asan')
|
||||
is_debug = GetArgValue(args, 'is_debug')
|
||||
is_official_build = GetArgValue(args, 'is_official_build')
|
||||
target_cpu = GetArgValue(args, 'target_cpu')
|
||||
|
||||
if platform == 'linux':
|
||||
use_sysroot = GetArgValue(args, 'use_sysroot')
|
||||
|
||||
if platform == 'windows':
|
||||
is_win_fastlink = GetArgValue(args, 'is_win_fastlink')
|
||||
visual_studio_path = GetArgValue(args, 'visual_studio_path')
|
||||
visual_studio_version = GetArgValue(args, 'visual_studio_version')
|
||||
windows_sdk_path = GetArgValue(args, 'windows_sdk_path')
|
||||
|
||||
# Target CPU architecture.
|
||||
# - Windows supports "x86" and "x64".
|
||||
# - Mac supports only "x64".
|
||||
# - Linux supports only "x64" unless using a sysroot environment.
|
||||
if platform == 'macosx':
|
||||
assert target_cpu == 'x64', 'target_cpu must be "x64"'
|
||||
else:
|
||||
assert target_cpu in ('x86', 'x64'), 'target_cpu must be "x86" or "x64"'
|
||||
|
||||
if platform == 'linux' and target_cpu == 'x86':
|
||||
assert use_sysroot, 'target_cpu="x86" requires use_sysroot=true'
|
||||
|
||||
# ASAN requires Release builds.
|
||||
if is_asan:
|
||||
assert not is_debug, "is_asan=true requires is_debug=false"
|
||||
if not dcheck_always_on:
|
||||
msg('is_asan=true recommends dcheck_always_on=true')
|
||||
|
||||
if platform == 'windows':
|
||||
# Official builds should not use /DEBUG:FASTLINK.
|
||||
if is_official_build:
|
||||
assert not is_win_fastlink, "is_official_build=true precludes is_win_fastlink=true"
|
||||
|
||||
# Non-official debug builds should use /DEBUG:FASTLINK.
|
||||
if not is_official_build and is_debug and not is_win_fastlink:
|
||||
msg('is_official_build=false + is_debug=true recommends is_win_fastlink=true')
|
||||
|
||||
# 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
|
||||
# PATH/LIB/INCLUDE values.
|
||||
#
|
||||
# Required GN arguments:
|
||||
# visual_studio_path="<path to VS root>"
|
||||
# The directory that contains Visual Studio. For example, a subset of
|
||||
# "C:\Program Files (x86)\Microsoft Visual Studio 14.0".
|
||||
# visual_studio_version="<vs version>"
|
||||
# The VS version. For example, "2015".
|
||||
# visual_studio_runtime_dirs="<path to VS CRT>"
|
||||
# The directory that contains the VS CRT. For example, the contents of
|
||||
# "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64" plus
|
||||
# "C:\Windows\System32\ucrtbased.dll"
|
||||
# windows_sdk_path="<path to WinSDK>"
|
||||
# The directory that contains the Win SDK. For example, a subset of
|
||||
# "C:\Program Files (x86)\Windows Kits\10".
|
||||
#
|
||||
# Required environment variables:
|
||||
# DEPOT_TOOLS_WIN_TOOLCHAIN=0
|
||||
# CEF_VCVARS=none
|
||||
# GYP_MSVS_OVERRIDE_PATH=<path to VS root>
|
||||
# PATH=<VS executable paths>
|
||||
# LIB=<VS library paths>
|
||||
# INCLUDE=<VS include paths>
|
||||
if visual_studio_path != '':
|
||||
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 windows_sdk_path != '', 'visual_studio_path requires windows_sdk_path'
|
||||
assert bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', 0))), \
|
||||
"visual_studio_path requires DEPOT_TOOLS_WIN_TOOLCHAIN=0 env variable"
|
||||
assert os.environ.get('CEF_VCVARS', '') == 'none', \
|
||||
"visual_studio_path requires CEF_VCVARS=none env variable"
|
||||
assert 'GYP_MSVS_OVERRIDE_PATH' is os.environ \
|
||||
and 'PATH' in os.environ \
|
||||
and 'LIB' in os.environ \
|
||||
and 'INCLUDE' in os.environ, \
|
||||
"visual_studio_path requires GYP_MSVS_OVERRIDE_PATH, PATH, LIB and INCLUDE env variables"
|
||||
|
||||
def GetConfigArgs(args, is_debug, is_x64):
|
||||
"""
|
||||
Return merged GN args for the configuration and validate.
|
||||
"""
|
||||
result = MergeDicts(args, {
|
||||
'is_debug': is_debug,
|
||||
'target_cpu': 'x64' if is_x64 else 'x86',
|
||||
})
|
||||
ValidateArgs(result)
|
||||
return result
|
||||
|
||||
def GetAllPlatformConfigs(build_args):
|
||||
"""
|
||||
Return a map of directory name to GN args for the current platform.
|
||||
"""
|
||||
result = {}
|
||||
|
||||
# Merged args without validation.
|
||||
args = GetMergedArgs(build_args)
|
||||
|
||||
# Don't create debug directories for asan builds.
|
||||
is_asan = GetArgValue(args, 'is_asan')
|
||||
|
||||
# Always create x64 configs.
|
||||
if not is_asan:
|
||||
result['Debug_GN_x64'] = GetConfigArgs(args, True, True)
|
||||
result['Release_GN_x64'] = GetConfigArgs(args, False, True)
|
||||
|
||||
# Create x86 configs on Windows and on Linux when using the sysroot.
|
||||
if platform == 'windows' or \
|
||||
(platform == 'linux' and GetArgValue(args, 'use_sysroot') == True):
|
||||
if not is_asan:
|
||||
result['Debug_GN_x86'] = GetConfigArgs(args, True, False)
|
||||
result['Release_GN_x86'] = GetConfigArgs(args, False, False)
|
||||
|
||||
return result
|
||||
|
||||
def GetConfigFileContents(args):
|
||||
"""
|
||||
Generate config file contents for the arguments.
|
||||
"""
|
||||
pairs = []
|
||||
for k in sorted(args.keys()):
|
||||
val = args[k]
|
||||
if isinstance(val, basestring):
|
||||
val = '"%s"' % val
|
||||
elif isinstance(val, bool):
|
||||
if val:
|
||||
val = 'true'
|
||||
else:
|
||||
val = 'false'
|
||||
pairs.append("%s=%s" % (k, val))
|
||||
return "\n".join(pairs)
|
||||
|
||||
|
||||
# Program entry point.
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
|
||||
# Allow override of the platform via the command-line for testing.
|
||||
if len(sys.argv) > 1:
|
||||
platform = sys.argv[1]
|
||||
if not platform in ('linux', 'macosx', 'windows'):
|
||||
sys.stderr.write('Usage: %s <platform>' % sys.argv[0])
|
||||
sys.exit()
|
||||
|
||||
print 'Platform: %s' % platform
|
||||
|
||||
# Dump the configuration based on platform and environment.
|
||||
configs = GetAllPlatformConfigs({})
|
||||
for dir, config in configs.items():
|
||||
print '\n\nout/%s:\n' % dir
|
||||
print GetConfigFileContents(config)
|
|
@ -261,7 +261,7 @@ parser.add_option('--ninja-build',
|
|||
help='build was created using ninja')
|
||||
parser.add_option('--x64-build',
|
||||
action='store_true', dest='x64build', default=False,
|
||||
help='build was created for 64-bit systems')
|
||||
help='create a 64-bit binary distribution')
|
||||
parser.add_option('--minimal',
|
||||
action='store_true', dest='minimal', default=False,
|
||||
help='include only release build binary files')
|
||||
|
@ -282,13 +282,16 @@ elif sys.platform == 'darwin':
|
|||
elif sys.platform.startswith('linux'):
|
||||
platform = 'linux'
|
||||
|
||||
# Whether to use GN or GYP. GYP is currently the default.
|
||||
use_gn = bool(int(os.environ.get('CEF_USE_GN', '0')))
|
||||
|
||||
# the outputdir option is required
|
||||
if options.outputdir is None:
|
||||
parser.print_help(sys.stderr)
|
||||
sys.exit()
|
||||
|
||||
if options.minimal and options.client:
|
||||
print 'Invalid combination of options'
|
||||
print 'Cannot specify both --minimal and --client'
|
||||
parser.print_help(sys.stderr)
|
||||
sys.exit()
|
||||
|
||||
|
@ -337,7 +340,9 @@ platform_arch = '32'
|
|||
if options.x64build:
|
||||
platform_arch = '64'
|
||||
|
||||
if platform == 'linux':
|
||||
if platform == 'linux' and not use_gn:
|
||||
# GYP places x86 and x64 builds in the same directory. Check file attributes
|
||||
# to differentiate between them.
|
||||
platform_arch = ''
|
||||
lib_dir_name = 'lib'
|
||||
release_libcef_path = os.path.join(src_dir, 'out', 'Release', lib_dir_name, 'libcef.so');
|
||||
|
@ -480,6 +485,27 @@ if mode == 'standard':
|
|||
os.path.join(output_dir, 'cef_paths.gypi'), options.quiet)
|
||||
|
||||
|
||||
# Determine the build directory suffix.
|
||||
build_dir_suffix = ''
|
||||
if use_gn:
|
||||
# CEF uses a consistent directory naming scheme for GN via
|
||||
# GetAllPlatformConfigs in gn_args.py.
|
||||
if options.x64build:
|
||||
build_dir_suffix = '_GN_x64'
|
||||
else:
|
||||
build_dir_suffix = '_GN_x86'
|
||||
else:
|
||||
# GYP outputs both x86 and x64 builds to the same directory on Linux and
|
||||
# Mac OS X. On Windows it suffixes the directory name for x64 builds.
|
||||
if platform == 'windows' and options.x64build:
|
||||
build_dir_suffix = '_x64'
|
||||
|
||||
# Determine the build directory paths.
|
||||
out_dir = os.path.join(src_dir, 'out')
|
||||
build_dir_debug = os.path.join(out_dir, 'Debug' + build_dir_suffix)
|
||||
build_dir_release = os.path.join(out_dir, 'Release' + build_dir_suffix)
|
||||
|
||||
|
||||
if platform == 'windows':
|
||||
binaries = [
|
||||
'd3dcompiler_47.dll',
|
||||
|
@ -491,7 +517,6 @@ if platform == 'windows':
|
|||
'widevinecdmadapter.dll',
|
||||
]
|
||||
|
||||
out_dir = os.path.join(src_dir, 'out')
|
||||
libcef_dll_file = 'libcef.dll.lib'
|
||||
sandbox_libs = [
|
||||
'obj\\base\\base.lib',
|
||||
|
@ -503,13 +528,9 @@ if platform == 'windows':
|
|||
|
||||
valid_build_dir = None
|
||||
|
||||
build_dir_suffix = ''
|
||||
if options.x64build:
|
||||
build_dir_suffix = '_x64'
|
||||
|
||||
if mode == 'standard':
|
||||
# transfer Debug files
|
||||
build_dir = os.path.join(out_dir, 'Debug' + build_dir_suffix);
|
||||
build_dir = build_dir_debug
|
||||
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, 'Debug')
|
||||
|
@ -530,7 +551,7 @@ if platform == 'windows':
|
|||
sys.stderr.write("No Debug build files.\n")
|
||||
|
||||
# transfer Release files
|
||||
build_dir = os.path.join(out_dir, 'Release' + build_dir_suffix);
|
||||
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')
|
||||
|
@ -600,14 +621,12 @@ if platform == 'windows':
|
|||
copy_dir(src_dir, docs_output_dir, options.quiet)
|
||||
|
||||
elif platform == 'macosx':
|
||||
out_dir = os.path.join(src_dir, 'out')
|
||||
|
||||
valid_build_dir = None
|
||||
framework_name = 'Chromium Embedded Framework'
|
||||
|
||||
if mode == 'standard':
|
||||
# transfer Debug files
|
||||
build_dir = os.path.join(out_dir, 'Debug')
|
||||
build_dir = build_dir_debug
|
||||
if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient.app')):
|
||||
valid_build_dir = build_dir
|
||||
dst_dir = os.path.join(output_dir, 'Debug')
|
||||
|
@ -616,7 +635,7 @@ elif platform == 'macosx':
|
|||
os.path.join(dst_dir, '%s.framework' % framework_name), options.quiet)
|
||||
|
||||
# transfer Release files
|
||||
build_dir = os.path.join(out_dir, 'Release')
|
||||
build_dir = build_dir_release
|
||||
if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient.app')):
|
||||
valid_build_dir = build_dir
|
||||
dst_dir = os.path.join(output_dir, 'Release')
|
||||
|
@ -674,14 +693,13 @@ elif platform == 'macosx':
|
|||
options.quiet)
|
||||
|
||||
elif platform == 'linux':
|
||||
out_dir = os.path.join(src_dir, 'out')
|
||||
lib_dir_name = 'lib'
|
||||
|
||||
valid_build_dir = None
|
||||
|
||||
if mode == 'standard':
|
||||
# transfer Debug files
|
||||
build_dir = os.path.join(out_dir, 'Debug');
|
||||
build_dir = build_dir_debug
|
||||
libcef_path = os.path.join(build_dir, lib_dir_name, 'libcef.so')
|
||||
if not options.allowpartial or path_exists(libcef_path):
|
||||
valid_build_dir = build_dir
|
||||
|
@ -695,7 +713,7 @@ elif platform == 'linux':
|
|||
sys.stderr.write("No Debug build files.\n")
|
||||
|
||||
# transfer Release files
|
||||
build_dir = os.path.join(out_dir, 'Release');
|
||||
build_dir = build_dir_release
|
||||
libcef_path = os.path.join(build_dir, lib_dir_name, 'libcef.so')
|
||||
if not options.allowpartial or path_exists(libcef_path):
|
||||
valid_build_dir = build_dir
|
||||
|
|
Loading…
Reference in New Issue