Compare commits

...

2 Commits

Author SHA1 Message Date
Loïc Frasse-Mathon 84246a31a2 posix: Added option to disable signal handlers
See https://github.com/chromiumembedded/java-cef/issues/477
2024-08-06 19:06:46 +00:00
Marshall Greenblatt c95c4aa8ea bazel: Limit define scope to specific cc targets (see #3757)
- Add `declare_[cc|objc]_library` macros to configure common `copts`
  and `local_defines` (where supported) on `[cc|objc]_library`
  targets. This limits the scope of defines to the specific target
  without inheritance by dependent targets.
- `objc_library` does not currently support `local_defines` so we
  use `copts` instead of MacOS.
- Use `**kwargs` to pass all other arguments to the actual cc
  target declaration.
2024-08-06 15:00:24 -04:00
14 changed files with 204 additions and 112 deletions

90
bazel/library_helpers.bzl Normal file
View File

@ -0,0 +1,90 @@
# Copyright (c) 2024 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
load("//bazel/win:variables.bzl",
WIN_COMMON_COPTS="COMMON_COPTS",
WIN_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
WIN_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG",
WIN_COMMON_DEFINES="COMMON_DEFINES",
WIN_COMMON_DEFINES_RELEASE="COMMON_DEFINES_RELEASE",
WIN_COMMON_DEFINES_DEBUG="COMMON_DEFINES_DEBUG")
load("//bazel/linux:variables.bzl",
LINUX_COMMON_COPTS="COMMON_COPTS",
LINUX_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
LINUX_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG",
LINUX_COMMON_DEFINES="COMMON_DEFINES",
LINUX_COMMON_DEFINES_RELEASE="COMMON_DEFINES_RELEASE",
LINUX_COMMON_DEFINES_DEBUG="COMMON_DEFINES_DEBUG")
load("//bazel/mac:variables.bzl",
MAC_COMMON_COPTS="COMMON_COPTS",
MAC_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
MAC_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG")
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library")
def declare_cc_library(copts=[], local_defines=[], **kwargs):
"""
cc_library wrapper that applies common copts and local_defines.
"""
# NOTE: objc_library does not support local_defines on MacOS, so on
# that platform we put the defines in copts instead.
cc_library(
copts = select({
"@platforms//os:windows": WIN_COMMON_COPTS,
"@platforms//os:linux": LINUX_COMMON_COPTS,
"@platforms//os:macos": MAC_COMMON_COPTS,
"//conditions:default": None,
}) + select({
"@cef//:windows_opt": WIN_COMMON_COPTS_RELEASE,
"@cef//:windows_dbg": WIN_COMMON_COPTS_DEBUG,
"@cef//:windows_fastbuild": WIN_COMMON_COPTS_RELEASE,
"@cef//:linux_opt": LINUX_COMMON_COPTS_RELEASE,
"@cef//:linux_dbg": LINUX_COMMON_COPTS_DEBUG,
"@cef//:linux_fastbuild": LINUX_COMMON_COPTS_RELEASE,
"@cef//:macos_opt": MAC_COMMON_COPTS_RELEASE,
"@cef//:macos_dbg": MAC_COMMON_COPTS_DEBUG,
"@cef//:macos_fastbuild": MAC_COMMON_COPTS_RELEASE,
"//conditions:default": None,
}) + copts,
local_defines = select({
"@platforms//os:windows": WIN_COMMON_DEFINES,
"@platforms//os:linux": LINUX_COMMON_DEFINES,
"//conditions:default": None,
}) + select({
"@cef//:windows_opt": WIN_COMMON_DEFINES_RELEASE,
"@cef//:windows_dbg": WIN_COMMON_DEFINES_DEBUG,
"@cef//:windows_fastbuild": WIN_COMMON_DEFINES_RELEASE,
"@cef//:linux_opt": LINUX_COMMON_DEFINES_RELEASE,
"@cef//:linux_dbg": LINUX_COMMON_DEFINES_DEBUG,
"@cef//:linux_fastbuild": LINUX_COMMON_DEFINES_RELEASE,
"//conditions:default": None,
}) + local_defines,
**kwargs
)
def declare_objc_library(copts=[], **kwargs):
"""
objc_library wrapper that applies common copts.
"""
# NOTE: objc_library does not support local_defines on MacOS, so on
# that platform we put the defines in copts instead.
objc_library(
copts = select({
"@platforms//os:windows": WIN_COMMON_COPTS,
"@platforms//os:linux": LINUX_COMMON_COPTS,
"@platforms//os:macos": MAC_COMMON_COPTS,
"//conditions:default": None,
}) + select({
"@cef//:windows_opt": WIN_COMMON_COPTS_RELEASE,
"@cef//:windows_dbg": WIN_COMMON_COPTS_DEBUG,
"@cef//:windows_fastbuild": WIN_COMMON_COPTS_RELEASE,
"@cef//:linux_opt": LINUX_COMMON_COPTS_RELEASE,
"@cef//:linux_dbg": LINUX_COMMON_COPTS_DEBUG,
"@cef//:linux_fastbuild": LINUX_COMMON_COPTS_RELEASE,
"@cef//:macos_opt": MAC_COMMON_COPTS_RELEASE,
"@cef//:macos_dbg": MAC_COMMON_COPTS_DEBUG,
"@cef//:macos_fastbuild": MAC_COMMON_COPTS_RELEASE,
"//conditions:default": None,
}) + copts,
**kwargs
)

View File

@ -6,10 +6,11 @@ load("//bazel:copy_filegroups.bzl", "copy_filegroups")
load("//bazel/linux:fix_rpath.bzl", "fix_rpath") load("//bazel/linux:fix_rpath.bzl", "fix_rpath")
load("//bazel/linux:variables.bzl", load("//bazel/linux:variables.bzl",
"COMMON_LINKOPTS", "COMMON_LINKOPTS",
"COMMON_COPTS", "COMMON_COPTS_RELEASE", "COMMON_COPTS_DEBUG") "COMMON_COPTS", "COMMON_COPTS_RELEASE", "COMMON_COPTS_DEBUG",
"COMMON_DEFINES", "COMMON_DEFINES_RELEASE", "COMMON_DEFINES_DEBUG")
load("@rules_cc//cc:defs.bzl", "cc_binary") load("@rules_cc//cc:defs.bzl", "cc_binary")
def declare_exe(name, srcs=[], deps=[], linkopts=[], copts=[], defines=[], data=[]): def declare_exe(name, srcs=[], deps=[], linkopts=[], copts=[], local_defines=[], data=[], **kwargs):
# Copy SOs and resources into the current project. # Copy SOs and resources into the current project.
copy_target = "{}_sos_and_resources".format(name) copy_target = "{}_sos_and_resources".format(name)
copy_filegroups( copy_filegroups(
@ -36,15 +37,19 @@ def declare_exe(name, srcs=[], deps=[], linkopts=[], copts=[], defines=[], data=
"@cef//:cef_sandbox", "@cef//:cef_sandbox",
] + deps, ] + deps,
linkopts = COMMON_LINKOPTS + linkopts, linkopts = COMMON_LINKOPTS + linkopts,
copts = select({ copts = COMMON_COPTS + select({
"@cef//:linux_dbg": COMMON_COPTS_DEBUG, "@cef//:linux_dbg": COMMON_COPTS_DEBUG,
"//conditions:default": COMMON_COPTS_RELEASE, "//conditions:default": COMMON_COPTS_RELEASE,
}) + COMMON_COPTS + copts, }) + copts,
defines = defines, local_defines = COMMON_DEFINES + select({
"@cef//:linux_dbg": COMMON_DEFINES_DEBUG,
"//conditions:default": COMMON_DEFINES_RELEASE,
}) + local_defines,
data = [ data = [
":{}".format(copy_target), ":{}".format(copy_target),
] + data, ] + data,
target_compatible_with = ["@platforms//os:linux"], target_compatible_with = ["@platforms//os:linux"],
**kwargs
) )
# Set rpath to $ORIGIN so that libraries can be loaded from next to the # Set rpath to $ORIGIN so that libraries can be loaded from next to the

View File

@ -7,7 +7,7 @@ MACOS_BUNDLE_ID_BASE="org.cef"
CEF_FRAMEWORK_NAME="Chromium Embedded Framework" CEF_FRAMEWORK_NAME="Chromium Embedded Framework"
# #
# Common 'linkopts' for cc_binary targets. # Common 'linkopts' for macos_application targets.
# #
# Standard link frameworks. # Standard link frameworks.
@ -29,34 +29,24 @@ COMMON_LINKOPTS = [
}) })
# #
# Common 'copts' for cc_libary and cc_binary targets. # Common 'copts' for cc_libary, objc_library and macos_application targets.
# We include defines in 'copts' because objc_library does not support
# 'local_defines'. See https://github.com/bazelbuild/bazel/issues/17482.
# #
COMMON_COPTS = [ COMMON_COPTS = [
"-Wno-undefined-var-template", "-Wno-undefined-var-template",
"-Wno-missing-field-initializers", "-Wno-missing-field-initializers",
"-Wno-deprecated-copy", "-Wno-deprecated-copy",
# Used by apps to test if the sandbox is enabled
"-DCEF_USE_SANDBOX",
] ]
COMMON_COPTS_DEBUG = [ COMMON_COPTS_DEBUG = [
] ]
COMMON_COPTS_RELEASE = [ COMMON_COPTS_RELEASE = [
]
#
# Common 'defines' for cc_libary targets.
#
COMMON_DEFINES = [
# Used by apps to test if the sandbox is enabled
"CEF_USE_SANDBOX",
]
COMMON_DEFINES_DEBUG = [
]
COMMON_DEFINES_RELEASE = [
# Not a debug build # Not a debug build
"NDEBUG", "-DNDEBUG",
] ]

View File

@ -7,11 +7,13 @@ load("//bazel/win:mt.bzl", "add_manifest")
load("//bazel/win:rc.bzl", "compile_rc") load("//bazel/win:rc.bzl", "compile_rc")
load("//bazel/win:variables.bzl", load("//bazel/win:variables.bzl",
"COMMON_LINKOPTS", "COMMON_LINKOPTS",
"COMMON_COPTS", "COMMON_COPTS_RELEASE", "COMMON_COPTS_DEBUG") "COMMON_COPTS", "COMMON_COPTS_RELEASE", "COMMON_COPTS_DEBUG",
"COMMON_DEFINES", "COMMON_DEFINES_RELEASE", "COMMON_DEFINES_DEBUG")
load("@rules_cc//cc:defs.bzl", "cc_binary") load("@rules_cc//cc:defs.bzl", "cc_binary")
def declare_exe(name, srcs, manifest_srcs, rc_file, resources_srcs, resources_deps=[], def declare_exe(name, srcs, manifest_srcs, rc_file, resources_srcs, resources_deps=[],
deps=[], linkopts=[], copts=[], defines=[], data=[]): deps=[], linkopts=[], copts=[], local_defines=[], data=[],
additional_linker_inputs=[], features=[], **kwargs):
# Resource file. # Resource file.
res_target = "{}_res".format(name) res_target = "{}_res".format(name)
compile_rc( compile_rc(
@ -51,19 +53,23 @@ def declare_exe(name, srcs, manifest_srcs, rc_file, resources_srcs, resources_de
linkopts = [ linkopts = [
"$(location :{})".format(res_target), "$(location :{})".format(res_target),
] + COMMON_LINKOPTS + linkopts, ] + COMMON_LINKOPTS + linkopts,
copts = select({ copts = COMMON_COPTS + select({
"@cef//:windows_dbg": COMMON_COPTS_DEBUG, "@cef//:windows_dbg": COMMON_COPTS_DEBUG,
"//conditions:default": COMMON_COPTS_RELEASE, "//conditions:default": COMMON_COPTS_RELEASE,
}) + COMMON_COPTS + copts, }) + copts,
defines = defines, local_defines = COMMON_DEFINES + select({
"@cef//:windows_dbg": COMMON_DEFINES_DEBUG,
"//conditions:default": COMMON_DEFINES_RELEASE,
}) + local_defines,
additional_linker_inputs = [ additional_linker_inputs = [
":{}".format(res_target), ":{}".format(res_target),
], ] + additional_linker_inputs,
data = [ data = [
":{}".format(copy_target), ":{}".format(copy_target),
] + data, ] + data,
features = ["generate_pdb_file"], features = ["generate_pdb_file"] + features,
target_compatible_with = ["@platforms//os:windows"], target_compatible_with = ["@platforms//os:windows"],
**kwargs
) )
# Add manifest and rename to final executable. # Add manifest and rename to final executable.

View File

@ -514,6 +514,13 @@ typedef struct _cef_settings_t {
/// runtime on Windows. /// runtime on Windows.
/// ///
int chrome_app_icon_id; int chrome_app_icon_id;
#if defined(OS_POSIX) && !defined(OS_ANDROID)
///
/// Specify whether signal handlers must be disabled on POSIX systems.
///
bool disable_signal_handlers;
#endif
} cef_settings_t; } cef_settings_t;
/// ///

View File

@ -437,6 +437,10 @@ struct CefSettingsTraits {
cef_string_set(src->chrome_policy_id.str, src->chrome_policy_id.length, cef_string_set(src->chrome_policy_id.str, src->chrome_policy_id.length,
&target->chrome_policy_id, copy); &target->chrome_policy_id, copy);
target->chrome_app_icon_id = src->chrome_app_icon_id; target->chrome_app_icon_id = src->chrome_app_icon_id;
#if defined(OS_POSIX) && !defined(OS_ANDROID)
target->disable_signal_handlers = src->disable_signal_handlers;
#endif
} }
}; };

View File

@ -277,7 +277,13 @@ bool CefMainRunner::Initialize(CefSettings* settings,
this, settings, application); this, settings, application);
exit_code_ = exit_code_ =
ContentMainInitialize(args, windows_sandbox_info, &settings->no_sandbox); ContentMainInitialize(args, windows_sandbox_info, &settings->no_sandbox,
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
settings->disable_signal_handlers
#else
false
#endif
);
if (exit_code_ >= 0) { if (exit_code_ >= 0) {
LOG(ERROR) << "ContentMainInitialize failed with exit code " << exit_code_; LOG(ERROR) << "ContentMainInitialize failed with exit code " << exit_code_;
return false; return false;
@ -429,7 +435,8 @@ int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args,
int CefMainRunner::ContentMainInitialize(const CefMainArgs& args, int CefMainRunner::ContentMainInitialize(const CefMainArgs& args,
void* windows_sandbox_info, void* windows_sandbox_info,
int* no_sandbox) { int* no_sandbox,
bool disable_signal_handlers) {
main_delegate_->BeforeMainThreadInitialize(args); main_delegate_->BeforeMainThreadInitialize(args);
// Initialize the content runner. // Initialize the content runner.
@ -452,6 +459,10 @@ int CefMainRunner::ContentMainInitialize(const CefMainArgs& args,
main_params.argv = const_cast<const char**>(args.argv); main_params.argv = const_cast<const char**>(args.argv);
#endif #endif
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
main_params.disable_signal_handlers = disable_signal_handlers;
#endif
return content::ContentMainInitialize(std::move(main_params), return content::ContentMainInitialize(std::move(main_params),
main_runner_.get()); main_runner_.get());
} }

View File

@ -60,7 +60,9 @@ class CefMainRunner : public CefMainRunnerHandler {
// Called from Initialize(). // Called from Initialize().
int ContentMainInitialize(const CefMainArgs& args, int ContentMainInitialize(const CefMainArgs& args,
void* windows_sandbox_info, void* windows_sandbox_info,
int* no_sandbox); int* no_sandbox,
bool disable_signal_handlers);
int ContentMainRun(bool* initialized, base::OnceClosure context_initialized); int ContentMainRun(bool* initialized, base::OnceClosure context_initialized);
// CefMainRunnerHandler methods: // CefMainRunnerHandler methods:

View File

@ -12,7 +12,7 @@ index 79ba3ac1913f8..46bcb4366d2f8 100644
if (main_argv) if (main_argv)
setproctitle_init(main_argv); setproctitle_init(main_argv);
diff --git content/app/content_main.cc content/app/content_main.cc diff --git content/app/content_main.cc content/app/content_main.cc
index 96c28a7ce3183..3d60ab170e9a5 100644 index 96c28a7ce3183..8a396ce7adf86 100644
--- content/app/content_main.cc --- content/app/content_main.cc
+++ content/app/content_main.cc +++ content/app/content_main.cc
@@ -174,11 +174,8 @@ ContentMainParams::~ContentMainParams() = default; @@ -174,11 +174,8 @@ ContentMainParams::~ContentMainParams() = default;
@ -39,7 +39,18 @@ index 96c28a7ce3183..3d60ab170e9a5 100644
// A flag to indicate whether Main() has been called before. On Android, we // A flag to indicate whether Main() has been called before. On Android, we
// may re-run Main() without restarting the browser process. This flag // may re-run Main() without restarting the browser process. This flag
@@ -274,14 +268,6 @@ RunContentProcess(ContentMainParams params, @@ -266,7 +260,9 @@ RunContentProcess(ContentMainParams params,
// default, "C", locale.
setlocale(LC_NUMERIC, "C");
- SetupSignalHandlers();
+ if (!params.disable_signal_handlers) {
+ SetupSignalHandlers();
+ }
#endif
#if BUILDFLAG(IS_WIN)
@@ -274,14 +270,6 @@ RunContentProcess(ContentMainParams params,
#endif #endif
#if BUILDFLAG(IS_MAC) #if BUILDFLAG(IS_MAC)
@ -54,7 +65,7 @@ index 96c28a7ce3183..3d60ab170e9a5 100644
InitializeMac(); InitializeMac();
#endif #endif
@@ -329,12 +315,46 @@ RunContentProcess(ContentMainParams params, @@ -329,12 +317,46 @@ RunContentProcess(ContentMainParams params,
if (IsSubprocess()) if (IsSubprocess())
CommonSubprocessInit(); CommonSubprocessInit();
@ -149,10 +160,22 @@ index cbbc2f3ec12fa..f097b3cdded2f 100644
int RunBrowser(MainFunctionParams main_function_params, int RunBrowser(MainFunctionParams main_function_params,
bool start_minimal_browser); bool start_minimal_browser);
diff --git content/public/app/content_main.h content/public/app/content_main.h diff --git content/public/app/content_main.h content/public/app/content_main.h
index 7f9b515297357..89b52e34fa31a 100644 index 7f9b515297357..5606867e43780 100644
--- content/public/app/content_main.h --- content/public/app/content_main.h
+++ content/public/app/content_main.h +++ content/public/app/content_main.h
@@ -94,6 +94,13 @@ struct CONTENT_EXPORT ContentMainParams { @@ -66,6 +66,11 @@ struct CONTENT_EXPORT ContentMainParams {
// are left uninitialized.
bool minimal_browser_mode = false;
+#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
+ // Indicates whether to disable signal handlers
+ bool disable_signal_handlers = false;
+#endif
+
#if BUILDFLAG(IS_MAC)
// The outermost autorelease pool to pass to main entry points.
STACK_ALLOCATED_IGNORE("https://crbug.com/1424190")
@@ -94,6 +99,13 @@ struct CONTENT_EXPORT ContentMainParams {
} }
}; };

View File

@ -9,33 +9,16 @@ package(default_visibility = [
load("@bazel_skylib//lib:selects.bzl", "selects") load("@bazel_skylib//lib:selects.bzl", "selects")
load("@build_bazel_rules_apple//apple:apple.bzl", "apple_dynamic_framework_import") load("@build_bazel_rules_apple//apple:apple.bzl", "apple_dynamic_framework_import")
load("//bazel:library_helpers.bzl", "declare_cc_library", "declare_objc_library")
load("//bazel/win:variables.bzl", load("//bazel/win:variables.bzl",
WIN_DLLS="DLLS", WIN_DLLS="DLLS",
WIN_DLLS_X64="DLLS_X64", WIN_DLLS_X64="DLLS_X64",
WIN_SANDBOX_LIBS="SANDBOX_LIBS", WIN_SANDBOX_LIBS="SANDBOX_LIBS")
WIN_COMMON_COPTS="COMMON_COPTS",
WIN_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
WIN_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG",
WIN_COMMON_DEFINES="COMMON_DEFINES",
WIN_COMMON_DEFINES_RELEASE="COMMON_DEFINES_RELEASE",
WIN_COMMON_DEFINES_DEBUG="COMMON_DEFINES_DEBUG")
load("//bazel/linux:variables.bzl", load("//bazel/linux:variables.bzl",
LINUX_SOS="SOS", LINUX_SOS="SOS")
LINUX_COMMON_COPTS="COMMON_COPTS",
LINUX_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
LINUX_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG",
LINUX_COMMON_DEFINES="COMMON_DEFINES",
LINUX_COMMON_DEFINES_RELEASE="COMMON_DEFINES_RELEASE",
LINUX_COMMON_DEFINES_DEBUG="COMMON_DEFINES_DEBUG")
load("//bazel/mac:variables.bzl", load("//bazel/mac:variables.bzl",
"CEF_FRAMEWORK_NAME", "CEF_FRAMEWORK_NAME")
MAC_COMMON_COPTS="COMMON_COPTS", load("@rules_cc//cc:defs.bzl", "cc_import")
MAC_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
MAC_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG",
MAC_COMMON_DEFINES="COMMON_DEFINES",
MAC_COMMON_DEFINES_RELEASE="COMMON_DEFINES_RELEASE",
MAC_COMMON_DEFINES_DEBUG="COMMON_DEFINES_DEBUG")
load("@rules_cc//cc:defs.bzl", "cc_import", "cc_library", "objc_library")
# #
# Define supported configurations. # Define supported configurations.
@ -124,7 +107,7 @@ selects.config_setting_group(
# Public headers for cef_wrapper here. # Public headers for cef_wrapper here.
# Seperated from the actual cef_wrapper since the *.mm file needs access to these as well. # Seperated from the actual cef_wrapper since the *.mm file needs access to these as well.
cc_library( declare_cc_library(
name = "cef_wrapper_headers", name = "cef_wrapper_headers",
hdrs = glob( hdrs = glob(
[ [
@ -137,7 +120,7 @@ cc_library(
), ),
) )
objc_library( declare_objc_library(
name = "cef_wrapper_apple", name = "cef_wrapper_apple",
srcs = [ srcs = [
"libcef_dll/wrapper/cef_library_loader_mac.mm", "libcef_dll/wrapper/cef_library_loader_mac.mm",
@ -145,7 +128,7 @@ objc_library(
implementation_deps = [":cef_wrapper_headers"], implementation_deps = [":cef_wrapper_headers"],
) )
cc_library( declare_cc_library(
name = "cef_wrapper", name = "cef_wrapper",
srcs = glob( srcs = glob(
[ [
@ -159,42 +142,9 @@ cc_library(
"include/test/*.h", "include/test/*.h",
], ],
), ),
copts = select({
"@platforms//os:windows": WIN_COMMON_COPTS,
"@platforms//os:linux": LINUX_COMMON_COPTS,
"@platforms//os:macos": MAC_COMMON_COPTS,
"//conditions:default": None,
}) + select({
"@cef//:windows_opt": WIN_COMMON_COPTS_RELEASE,
"@cef//:windows_dbg": WIN_COMMON_COPTS_DEBUG,
"@cef//:windows_fastbuild": WIN_COMMON_COPTS_RELEASE,
"@cef//:linux_opt": LINUX_COMMON_COPTS_RELEASE,
"@cef//:linux_dbg": LINUX_COMMON_COPTS_DEBUG,
"@cef//:linux_fastbuild": LINUX_COMMON_COPTS_RELEASE,
"@cef//:macos_opt": MAC_COMMON_COPTS_RELEASE,
"@cef//:macos_dbg": MAC_COMMON_COPTS_DEBUG,
"@cef//:macos_fastbuild": MAC_COMMON_COPTS_RELEASE,
"//conditions:default": None,
}),
defines = [ defines = [
"WRAPPING_CEF_SHARED", "WRAPPING_CEF_SHARED",
] + select({ ],
"@platforms//os:windows": WIN_COMMON_DEFINES,
"@platforms//os:linux": LINUX_COMMON_DEFINES,
"@platforms//os:macos": MAC_COMMON_DEFINES,
"//conditions:default": None,
}) + select({
"@cef//:windows_opt": WIN_COMMON_DEFINES_RELEASE,
"@cef//:windows_dbg": WIN_COMMON_DEFINES_DEBUG,
"@cef//:windows_fastbuild": WIN_COMMON_DEFINES_RELEASE,
"@cef//:linux_opt": LINUX_COMMON_DEFINES_RELEASE,
"@cef//:linux_dbg": LINUX_COMMON_DEFINES_DEBUG,
"@cef//:linux_fastbuild": LINUX_COMMON_DEFINES_RELEASE,
"@cef//:macos_opt": MAC_COMMON_DEFINES_RELEASE,
"@cef//:macos_dbg": MAC_COMMON_DEFINES_DEBUG,
"@cef//:macos_fastbuild": MAC_COMMON_DEFINES_RELEASE,
"//conditions:default": None,
}),
deps = [":cef_wrapper_headers"] + deps = [":cef_wrapper_headers"] +
select({ select({
"@platforms//os:macos": [":cef_wrapper_apple"], "@platforms//os:macos": [":cef_wrapper_apple"],
@ -206,7 +156,7 @@ cc_library(
) )
# Only available on MacOS/Windows. # Only available on MacOS/Windows.
cc_library( declare_cc_library(
name = "cef_sandbox_linkflags", name = "cef_sandbox_linkflags",
linkopts = select({ linkopts = select({
"@platforms//os:macos": ["-lsandbox"], "@platforms//os:macos": ["-lsandbox"],

View File

@ -10,7 +10,8 @@ package(default_visibility = [
":__subpackages__", ":__subpackages__",
]) ])
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library") load("//bazel:library_helpers.bzl", "declare_cc_library", "declare_objc_library")
load("@rules_cc//cc:defs.bzl", "cc_library")
# #
# Source file lists. # Source file lists.
@ -53,7 +54,7 @@ filegroup(
# MacOS targets. # MacOS targets.
# #
objc_library( declare_objc_library(
name = "BrowserLibMac", name = "BrowserLibMac",
srcs = srcs_common + srcs_browser + srcs_browser_mac, srcs = srcs_common + srcs_browser + srcs_browser_mac,
target_compatible_with = [ target_compatible_with = [
@ -65,7 +66,7 @@ objc_library(
], ],
) )
objc_library( declare_objc_library(
name = "RendererLibMac", name = "RendererLibMac",
srcs = srcs_common + srcs_renderer, srcs = srcs_common + srcs_renderer,
target_compatible_with = [ target_compatible_with = [

View File

@ -10,7 +10,8 @@ package(default_visibility = [
":__subpackages__", ":__subpackages__",
]) ])
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library") load("//bazel:library_helpers.bzl", "declare_cc_library", "declare_objc_library")
load("@rules_cc//cc:defs.bzl", "cc_library")
# #
# Source file lists. # Source file lists.
@ -40,7 +41,7 @@ srcs_renderer_mac = [
# MacOS targets. # MacOS targets.
# #
objc_library( declare_objc_library(
name = "BrowserLibMac", name = "BrowserLibMac",
srcs = srcs_browser + srcs_browser_mac, srcs = srcs_browser + srcs_browser_mac,
target_compatible_with = [ target_compatible_with = [
@ -51,7 +52,7 @@ objc_library(
], ],
) )
cc_library( declare_cc_library(
name = "RendererLibMac", name = "RendererLibMac",
srcs = srcs_renderer_mac, srcs = srcs_renderer_mac,
target_compatible_with = [ target_compatible_with = [

View File

@ -10,7 +10,8 @@ package(default_visibility = [
":__subpackages__", ":__subpackages__",
]) ])
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library") load("//bazel:library_helpers.bzl", "declare_cc_library", "declare_objc_library")
load("@rules_cc//cc:defs.bzl", "cc_library")
# #
# Source file lists. # Source file lists.
@ -51,7 +52,7 @@ filegroup(
srcs = ["resources/net"], srcs = ["resources/net"],
) )
objc_library( declare_objc_library(
name = "BrowserLibMac", name = "BrowserLibMac",
srcs = srcs_browser + srcs_browser_mac, srcs = srcs_browser + srcs_browser_mac,
target_compatible_with = [ target_compatible_with = [
@ -64,7 +65,7 @@ objc_library(
], ],
) )
objc_library( declare_objc_library(
name = "RendererLibMac", name = "RendererLibMac",
srcs = srcs_renderer_mac, srcs = srcs_renderer_mac,
target_compatible_with = [ target_compatible_with = [

View File

@ -2,7 +2,8 @@
# reserved. Use of this source code is governed by a BSD-style license that # reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file. # can be found in the LICENSE file.
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library") load("//bazel:library_helpers.bzl", "declare_cc_library", "declare_objc_library")
load("@rules_cc//cc:defs.bzl", "cc_library")
# Allow access from all //tests packages. # Allow access from all //tests packages.
package(default_visibility = [ package(default_visibility = [
@ -62,7 +63,7 @@ filegroup(
# MacOS targets. # MacOS targets.
# #
objc_library( declare_objc_library(
name = "BrowserLibMac", name = "BrowserLibMac",
srcs = srcs_common + srcs_browser + srcs_browser_mac, srcs = srcs_common + srcs_browser + srcs_browser_mac,
target_compatible_with = [ target_compatible_with = [
@ -73,7 +74,7 @@ objc_library(
], ],
) )
cc_library( declare_cc_library(
name = "RendererLibMac", name = "RendererLibMac",
srcs = srcs_common + srcs_renderer + srcs_renderer_mac, srcs = srcs_common + srcs_renderer + srcs_renderer_mac,
target_compatible_with = [ target_compatible_with = [
@ -89,7 +90,7 @@ cc_library(
# Needs to be defined here because Bazel disallows direct access to files # Needs to be defined here because Bazel disallows direct access to files
# outside of the package directory. # outside of the package directory.
objc_library( declare_objc_library(
name = "BrowserLibMacCefTests", name = "BrowserLibMacCefTests",
srcs = srcs_browser_mac_ceftests, srcs = srcs_browser_mac_ceftests,
target_compatible_with = [ target_compatible_with = [
@ -101,7 +102,7 @@ objc_library(
], ],
) )
objc_library( declare_objc_library(
name = "RendererLibMacCefTests", name = "RendererLibMacCefTests",
srcs = srcs_renderer_mac_ceftests, srcs = srcs_renderer_mac_ceftests,
target_compatible_with = [ target_compatible_with = [