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 /binary_distrib
/docs /docs
# CEF generated files # CEF generated files
/include/cef_config.h
/include/cef_version.h /include/cef_version.h
.ccls-cache/ .ccls-cache/

View File

@ -350,6 +350,10 @@ if (is_win) {
"//build/config:precompiled_headers", "//build/config:precompiled_headers",
] ]
public_configs = [
"libcef/features:config",
]
if (is_component_build) { if (is_component_build) {
# Avoid linker errors with content_switches.cc in component build by not # Avoid linker errors with content_switches.cc in component build by not
# defining CONTENT_EXPORT. # defining CONTENT_EXPORT.
@ -1247,18 +1251,29 @@ config("libcef_autogen_config") {
} }
} }
# Configuration that will be applied to all targets that depend on # Configuration that supports #include paths relative to src/cef/ for CEF
# libcef_dll_wrapper. # client-side code. CEF library-side code (Chromium code and cef/libcef/
config("libcef_dll_wrapper_config") { # directory) uses #include paths relative to src/. See libcef/features:config
# for CEF library-side configuration.
config("libcef_includes_config") {
include_dirs = [ 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. # They will be copied to the include/ directory in the binary distribution.
"$root_out_dir/includes/cef", "$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 (is_win) {
if (current_cpu == "x86") { if (current_cpu == "x86") {
@ -1274,10 +1289,6 @@ config("libcef_dll_wrapper_config") {
ldflags = [ "/STACK:0x800000" ] ldflags = [ "/STACK:0x800000" ]
} }
} }
if (!enable_alloy_bootstrap) {
defines = [ "DISABLE_ALLOY_BOOTSTRAP" ]
}
} }
# libcef_dll_wrapper target. # libcef_dll_wrapper target.
@ -1311,8 +1322,7 @@ static_library("libcef_dll_wrapper") {
if (is_win) { if (is_win) {
static_library("cef_sandbox") { static_library("cef_sandbox") {
sources = [ "libcef_dll/sandbox/sandbox_win.cc" ] sources = [ "libcef_dll/sandbox/sandbox_win.cc" ]
# CEF sources use include paths relative to the CEF root directory. configs += [ ":libcef_includes_config" ]
include_dirs = [ "." ]
deps = [ "libcef/features", "//sandbox" ] deps = [ "libcef/features", "//sandbox" ]
} }
} }
@ -1320,8 +1330,7 @@ if (is_win) {
if (is_mac) { if (is_mac) {
static_library("cef_sandbox") { static_library("cef_sandbox") {
sources = [ "libcef_dll/sandbox/sandbox_mac.mm" ] sources = [ "libcef_dll/sandbox/sandbox_mac.mm" ]
# CEF sources use include paths relative to the CEF root directory. configs += [ ":libcef_includes_config" ]
include_dirs = [ "." ]
deps = [ deps = [
"//build/config:executable_deps", "//build/config:executable_deps",
"//sandbox/mac:seatbelt" "//sandbox/mac:seatbelt"
@ -1505,13 +1514,24 @@ action("make_api_hash_header") {
args = rebase_path(outputs + include_dir, root_build_dir) 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. # Generate cef_config.h.
action("make_config_header") { action("make_config_header") {
script = "tools/make_config_header.py" 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" ] 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. # Generate cef_color_ids.h.

View File

@ -71,11 +71,26 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "cef/libcef/features/features.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) #if !BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
#define DISABLE_ALLOY_BOOTSTRAP 1 #define DISABLE_ALLOY_BOOTSTRAP 1
#endif #endif
#else // !USING_CHROMIUM_INCLUDES #else // !USING_CHROMIUM_INCLUDES
#include "include/cef_config.h"
// The following is substantially similar to the Chromium implementation. // The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be // If the Chromium implementation diverges the below implementation should be
// updated to match. // updated to match.

View File

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

View File

@ -87,12 +87,14 @@ buildflag_header("features") {
} }
# Configuration for all targets that include CEF source code library-side. # Configuration for all targets that include CEF source code library-side.
# See //cef/libcef_includes_config for CEF client-side configuration.
config("config") { config("config") {
# CEF sources use includes relative to the CEF root directory.
include_dirs = [ include_dirs = [
# cef/include/ directory uses #includes relative to the cef/ directory.
"//cef", "//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", "$root_build_dir/includes",
] ]
defines = [ defines = [

View File

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

View File

@ -16,13 +16,21 @@ def make_config_header(gn_config):
defines = [] 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. # The following #defines are used in cef/include/ headers and CEF client-side code.
# Check if the config is explicitly disabling it. # CEF library-side code will get these #defines from include/base/cef_build.h so
if not 'ozone_platform_x11=false' in lines: # any changes must also be reflected there.
defines.append('#define CEF_X11 1')
# 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) + \ result = get_copyright(full=True, translator=False) + \
"""// """//