Add DISABLE_ALLOY_BOOTSTRAP to cef_config.h (see #3681, see #3685)

Include cef_config.h from base/cef_build.h and fix detection of
args.gn changes so that defines are available everywhere by default.

Fix include configuration for chrome_elf_set and sandbox targets.
This commit is contained in:
Marshall Greenblatt 2024-04-30 12:03:59 -04:00
parent 49a34d9160
commit b92749a58a
7 changed files with 68 additions and 26 deletions

1
.gitignore vendored
View File

@ -51,6 +51,5 @@ Thumbs.db
/binary_distrib
/docs
# CEF generated files
/include/cef_config.h
/include/cef_version.h
.ccls-cache/

View File

@ -350,6 +350,10 @@ if (is_win) {
"//build/config:precompiled_headers",
]
public_configs = [
"libcef/features:config",
]
if (is_component_build) {
# Avoid linker errors with content_switches.cc in component build by not
# defining CONTENT_EXPORT.
@ -1247,18 +1251,29 @@ config("libcef_autogen_config") {
}
}
# Configuration that will be applied to all targets that depend on
# libcef_dll_wrapper.
config("libcef_dll_wrapper_config") {
# Configuration that supports #include paths relative to src/cef/ for CEF
# client-side code. CEF library-side code (Chromium code and cef/libcef/
# directory) uses #include paths relative to src/. See libcef/features:config
# for CEF library-side configuration.
config("libcef_includes_config") {
include_dirs = [
# CEF sources use include paths relative to the CEF root directory.
# cef/include/ directory and CEF client-side code use #includes relative to
# the cef/ directory.
".",
# CEF generates some header files that also need to be discoverable.
# CEF generated header files that also need to be discoverable.
# These #includes from client-side code will not be prefixed with cef/.
# They will be copied to the include/ directory in the binary distribution.
"$root_out_dir/includes/cef",
]
}
configs = [ ":libcef_autogen_config" ]
# Configuration that will be applied to all targets that depend on
# libcef_dll_wrapper.
config("libcef_dll_wrapper_config") {
configs = [
":libcef_autogen_config",
":libcef_includes_config",
]
if (is_win) {
if (current_cpu == "x86") {
@ -1274,10 +1289,6 @@ config("libcef_dll_wrapper_config") {
ldflags = [ "/STACK:0x800000" ]
}
}
if (!enable_alloy_bootstrap) {
defines = [ "DISABLE_ALLOY_BOOTSTRAP" ]
}
}
# libcef_dll_wrapper target.
@ -1311,8 +1322,7 @@ static_library("libcef_dll_wrapper") {
if (is_win) {
static_library("cef_sandbox") {
sources = [ "libcef_dll/sandbox/sandbox_win.cc" ]
# CEF sources use include paths relative to the CEF root directory.
include_dirs = [ "." ]
configs += [ ":libcef_includes_config" ]
deps = [ "libcef/features", "//sandbox" ]
}
}
@ -1320,8 +1330,7 @@ if (is_win) {
if (is_mac) {
static_library("cef_sandbox") {
sources = [ "libcef_dll/sandbox/sandbox_mac.mm" ]
# CEF sources use include paths relative to the CEF root directory.
include_dirs = [ "." ]
configs += [ ":libcef_includes_config" ]
deps = [
"//build/config:executable_deps",
"//sandbox/mac:seatbelt"
@ -1505,13 +1514,24 @@ action("make_api_hash_header") {
args = rebase_path(outputs + include_dir, root_build_dir)
}
# This no-op action lists args.gn as an output, allowing it to be referenced as
# an input (trigger) for other actions. Otherwise, GN will complain that no
# target generates the args.gn file because its below the $root_out_dir.
action("args_gn_source") {
script = "//build/noop.py"
outputs = [ "$root_out_dir/args.gn" ]
}
# Generate cef_config.h.
action("make_config_header") {
script = "tools/make_config_header.py"
deps = [ ":args_gn_source" ]
inputs = [ "$root_out_dir/args.gn" ]
outputs = [ "$root_out_dir/includes/cef/include/cef_config.h" ]
args = rebase_path(outputs + [ "$root_out_dir/args.gn" ], root_build_dir)
args = rebase_path(outputs + inputs, root_build_dir)
}
# Generate cef_color_ids.h.

View File

@ -71,11 +71,26 @@
#include "build/build_config.h"
#include "cef/libcef/features/features.h"
// The following #defines are used in cef/include/ headers and CEF client-side
// code. CEF library-side code should use BUILDFLAG checks directly instead of
// these #defines. CEF client-side code will get these #defines from
// cef_config.h so any changes must also be reflected in
// tools/make_config_header.py.
#if BUILDFLAG(IS_LINUX)
#include "ui/base/ozone_buildflags.h"
#if BUILDFLAG(IS_OZONE_X11)
#define CEF_X11 1
#endif
#endif
#if !BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
#define DISABLE_ALLOY_BOOTSTRAP 1
#endif
#else // !USING_CHROMIUM_INCLUDES
#include "include/cef_config.h"
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
// updated to match.

View File

@ -32,7 +32,6 @@
#pragma once
#include "include/base/cef_build.h"
#include "include/cef_config.h"
#if defined(OS_LINUX)

View File

@ -87,12 +87,14 @@ buildflag_header("features") {
}
# Configuration for all targets that include CEF source code library-side.
# See //cef/libcef_includes_config for CEF client-side configuration.
config("config") {
# CEF sources use includes relative to the CEF root directory.
include_dirs = [
# cef/include/ directory uses #includes relative to the cef/ directory.
"//cef",
# CEF generates some header files that also need to be discoverable.
# CEF generated header files that also need to be discoverable.
# These #includes from library-side code will always be prefixed with cef/.
"$root_build_dir/includes",
]
defines = [

View File

@ -5,7 +5,6 @@
#include <memory>
#include "include/base/cef_build.h"
#include "include/cef_config.h"
#if defined(OS_LINUX) && defined(CEF_X11)
#include <X11/Xlib.h>

View File

@ -16,13 +16,21 @@ def make_config_header(gn_config):
defines = []
if sys.platform.startswith('linux'):
lines = read_file(gn_config).split("\n")
lines = read_file(gn_config).split("\n")
# All Linux builds use Ozone, and the X11 platform is enabled by default.
# Check if the config is explicitly disabling it.
if not 'ozone_platform_x11=false' in lines:
defines.append('#define CEF_X11 1')
# The following #defines are used in cef/include/ headers and CEF client-side code.
# CEF library-side code will get these #defines from include/base/cef_build.h so
# any changes must also be reflected there.
# All Linux builds use Ozone, and the X11 platform is enabled by default.
# Check if the config is explicitly disabling it.
if sys.platform.startswith('linux') and \
not 'ozone_platform_x11=false' in lines:
defines.append('#define CEF_X11 1')
# Temporary define for disabling the Alloy bootstrap. See issue #3685.
if 'enable_alloy_bootstrap=false' in lines:
defines.append('#define DISABLE_ALLOY_BOOTSTRAP 1')
result = get_copyright(full=True, translator=False) + \
"""//