mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
bazel: Add initial config for binary distribution (see #3757)
Add support for building the CEF binary distribution using Bazel and the default platform toolchain. Tested to work for Windows x64, MacOS ARM64 and x64 (cross-compile from ARM64), and Linux x64. Windows x86 (cross-compile from x64) is known to be broken, see https://github.com/bazelbuild/bazel/issues/22164. Includes minor changes to tests directory structure to meet Bazel build requirements.
This commit is contained in:
162
tools/bazel_util.py
Normal file
162
tools/bazel_util.py
Normal file
@@ -0,0 +1,162 @@
|
||||
# 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.
|
||||
|
||||
QUIET = False
|
||||
|
||||
|
||||
def bazel_set_quiet(quiet):
|
||||
global QUIET
|
||||
QUIET = quiet
|
||||
|
||||
|
||||
LAST_ERROR = None
|
||||
|
||||
|
||||
def bazel_last_error():
|
||||
return LAST_ERROR
|
||||
|
||||
|
||||
def _set_last_error(error):
|
||||
global LAST_ERROR
|
||||
LAST_ERROR = error
|
||||
|
||||
|
||||
def _print(label, data, pos, msg):
|
||||
data_to_pos = data[0:pos]
|
||||
line = data_to_pos.count('\n')
|
||||
pos_in_line = (pos - data_to_pos.rfind('\n') - 1) if line > 0 else pos
|
||||
|
||||
_set_last_error('ERROR: %s: %s at line %d:%d' % (label, msg, line + 1,
|
||||
pos_in_line + 1))
|
||||
if not QUIET:
|
||||
print(LAST_ERROR)
|
||||
|
||||
|
||||
def bazel_substitute(data,
|
||||
variables,
|
||||
var_delim_start='${',
|
||||
var_delim_end='}',
|
||||
path_list_delim=',\n ',
|
||||
path_relative_to=None,
|
||||
path_abs_prefix='//',
|
||||
label='data'):
|
||||
_set_last_error(None)
|
||||
|
||||
if not path_relative_to is None and len(path_relative_to) == 0:
|
||||
path_relative_to = None
|
||||
if not path_relative_to is None and path_relative_to[-1] != '/':
|
||||
path_relative_to += '/'
|
||||
|
||||
result = ''
|
||||
|
||||
epos = 0
|
||||
spos = data.find(var_delim_start, epos)
|
||||
while spos >= 0:
|
||||
result += data[epos:spos]
|
||||
epos = data.find(var_delim_end, spos + len(var_delim_start))
|
||||
if epos > spos:
|
||||
sub = ''
|
||||
var = data[spos + len(var_delim_start):epos]
|
||||
if var in variables:
|
||||
val = variables[var]
|
||||
if isinstance(val, list):
|
||||
# Assumed to be a list of file paths.
|
||||
paths = []
|
||||
for path in val:
|
||||
if not path_relative_to is None and path.startswith(
|
||||
path_relative_to):
|
||||
# Use only the remainder of the path.
|
||||
path = path[len(path_relative_to):]
|
||||
else:
|
||||
# Use a fully qualified path.
|
||||
path = path_abs_prefix + path
|
||||
paths.append('"%s"' % path)
|
||||
sub = path_list_delim.join(paths)
|
||||
else:
|
||||
# Direct replacement.
|
||||
sub = str(val)
|
||||
else:
|
||||
_print(label, data, spos,
|
||||
'No value for "%s%s%s"' % (var_delim_start, var, var_delim_end))
|
||||
if len(sub) > 0:
|
||||
result += sub
|
||||
epos += len(var_delim_end)
|
||||
else:
|
||||
_print(label, data, spos,
|
||||
'Missing close bracket for "%s..."' % (data[spos:spos + 5]))
|
||||
# Can't parse any further.
|
||||
break
|
||||
spos = data.find(var_delim_start, epos)
|
||||
|
||||
if epos >= 0:
|
||||
result += data[epos:]
|
||||
|
||||
return result
|
||||
|
||||
|
||||
# Test the module.
|
||||
if __name__ == "__main__":
|
||||
# Don't print error messages.
|
||||
bazel_set_quiet(True)
|
||||
|
||||
# No substitution
|
||||
assert (bazel_substitute('foobar', {}) == 'foobar')
|
||||
assert (bazel_last_error() == None)
|
||||
|
||||
# No matching variable
|
||||
assert (bazel_substitute('${a}foobar', {}) == 'foobar')
|
||||
assert (bazel_last_error() == 'ERROR: data: No value for "${a}" at line 1:1')
|
||||
assert (bazel_substitute('\nfoo${a}bar', {}) == '\nfoobar')
|
||||
assert (bazel_last_error() == 'ERROR: data: No value for "${a}" at line 2:4')
|
||||
assert (bazel_substitute('\n\nfoobar${a}', {}) == '\n\nfoobar')
|
||||
assert (bazel_last_error() == 'ERROR: data: No value for "${a}" at line 3:7')
|
||||
|
||||
# Missing end bracket.
|
||||
assert (bazel_substitute('${afoobar', {}) == '')
|
||||
assert (bazel_last_error() ==
|
||||
'ERROR: data: Missing close bracket for "${afo..." at line 1:1')
|
||||
assert (bazel_substitute('\nfoo${abar', {}) == '\nfoo')
|
||||
assert (bazel_last_error() ==
|
||||
'ERROR: data: Missing close bracket for "${aba..." at line 2:4')
|
||||
assert (bazel_substitute('\n\nfoobar${a', {}) == '\n\nfoobar')
|
||||
assert (bazel_last_error() ==
|
||||
'ERROR: data: Missing close bracket for "${a..." at line 3:7')
|
||||
|
||||
# Variable substitution
|
||||
assert (bazel_substitute('foo${choo}bar', {'choo': 'blah'}) == 'fooblahbar')
|
||||
assert (bazel_last_error() == None)
|
||||
assert (bazel_substitute('${ah}${choo}bar${ba}',
|
||||
{'ah': 'foo',
|
||||
'choo': 5,
|
||||
'ba': ''}) == 'foo5bar')
|
||||
assert (bazel_last_error() == None)
|
||||
|
||||
# Custom variable delimiters.
|
||||
assert (bazel_substitute(
|
||||
'$$ah$$$$choo$$bar$$ba$$', {'ah': 'foo',
|
||||
'choo': 5,
|
||||
'ba': ''},
|
||||
var_delim_start='$$',
|
||||
var_delim_end='$$') == 'foo5bar')
|
||||
assert (bazel_last_error() == None)
|
||||
|
||||
paths = [
|
||||
'path/to/a.ext',
|
||||
'path/to/b.ext',
|
||||
'another/path/c.ext',
|
||||
]
|
||||
|
||||
# All absolute paths.
|
||||
assert (bazel_substitute('[${paths}]', {'paths': paths}, path_list_delim=',')
|
||||
== '["//path/to/a.ext","//path/to/b.ext","//another/path/c.ext"]')
|
||||
assert (bazel_last_error() == None)
|
||||
|
||||
# Some relative paths.
|
||||
assert (bazel_substitute(
|
||||
'[${paths}]', {'paths': paths},
|
||||
path_list_delim=',',
|
||||
path_relative_to='path/to') == '["a.ext","b.ext","//another/path/c.ext"]')
|
||||
assert (bazel_last_error() == None)
|
||||
|
||||
print('Tests passed!')
|
@@ -230,11 +230,16 @@ class VersionFormatter:
|
||||
return self._get_old_version_parts()
|
||||
return self._get_version_parts()
|
||||
|
||||
def get_short_version_string(self, oldFormat=None):
|
||||
""" Returns the short CEF version number string based on current checkout
|
||||
state. """
|
||||
parts = self.get_version_parts(oldFormat=oldFormat)
|
||||
return "%d.%d.%d" % (parts['MAJOR'], parts['MINOR'], parts['PATCH'])
|
||||
|
||||
def get_plist_version_string(self, oldFormat=None):
|
||||
""" Returns the CEF version number string for plist files based on current
|
||||
checkout state. """
|
||||
parts = self.get_version_parts(oldFormat=oldFormat)
|
||||
return "%d.%d.%d.0" % (parts['MAJOR'], parts['MINOR'], parts['PATCH'])
|
||||
return self.get_short_version_string() + ".0"
|
||||
|
||||
def get_dylib_version_string(self, oldFormat=None):
|
||||
""" Returns the CEF version number string for dylib files based on current
|
||||
|
54
tools/distrib/bazel/.bazelrc
Executable file
54
tools/distrib/bazel/.bazelrc
Executable file
@@ -0,0 +1,54 @@
|
||||
# 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.
|
||||
|
||||
# Enable Bzlmod for every Bazel command.
|
||||
common --enable_bzlmod
|
||||
|
||||
# Enable build:{macos,linux,windows}.
|
||||
build --enable_platform_specific_config
|
||||
|
||||
#
|
||||
# Common configuration.
|
||||
#
|
||||
|
||||
# Build with C++17.
|
||||
build:linux --cxxopt='-std=c++17'
|
||||
build:macos --cxxopt='-std=c++17'
|
||||
build:macos --copt='-std=c++17'
|
||||
build:windows --cxxopt='/std:c++17'
|
||||
|
||||
#
|
||||
# MacOS configuration.
|
||||
#
|
||||
|
||||
build:macos --copt='-ObjC++'
|
||||
|
||||
#
|
||||
# Windows configuration.
|
||||
#
|
||||
|
||||
# Enable creation of symlinks for runfiles.
|
||||
build:windows --enable_runfiles
|
||||
|
||||
# Use /MT[d].
|
||||
build:windows --features=static_link_msvcrt
|
||||
|
||||
#
|
||||
# Linux configuration.
|
||||
#
|
||||
|
||||
# The cfi-icall attribute is not supported by the GNU C++ compiler.
|
||||
# TODO: Move to toolchain or add `--config=[gcc|llvm]` command-line option.
|
||||
build:linux --cxxopt=-Wno-attributes
|
||||
|
||||
# Use hardlinks instead of symlinks in sandboxes on Linux.
|
||||
# This is required for CEF binaries to run, and for copy_filegroups() to work
|
||||
# as expected on Linux.
|
||||
build:linux --experimental_use_hermetic_linux_sandbox
|
||||
build:linux --sandbox_add_mount_pair=/etc
|
||||
build:linux --sandbox_add_mount_pair=/usr
|
||||
## symlinks into /usr
|
||||
build:linux --sandbox_add_mount_pair=/usr/bin:/bin
|
||||
build:linux --sandbox_add_mount_pair=/usr/lib:/lib
|
||||
build:linux --sandbox_add_mount_pair=/usr/lib64:/lib64
|
1
tools/distrib/bazel/.bazelversion
Normal file
1
tools/distrib/bazel/.bazelversion
Normal file
@@ -0,0 +1 @@
|
||||
7.1.1
|
366
tools/distrib/bazel/BUILD.bazel
Executable file
366
tools/distrib/bazel/BUILD.bazel
Executable file
@@ -0,0 +1,366 @@
|
||||
# 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.
|
||||
|
||||
# Allow access from targets in other packages.
|
||||
package(default_visibility = [
|
||||
"//visibility:public",
|
||||
])
|
||||
|
||||
load("@bazel_skylib//lib:selects.bzl", "selects")
|
||||
load("@build_bazel_rules_apple//apple:apple.bzl", "apple_dynamic_framework_import")
|
||||
load("//bazel/win:variables.bzl",
|
||||
WIN_DLLS="DLLS",
|
||||
WIN_DLLS_X64="DLLS_X64",
|
||||
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",
|
||||
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",
|
||||
"CEF_FRAMEWORK_NAME",
|
||||
MAC_COMMON_COPTS="COMMON_COPTS",
|
||||
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.
|
||||
# See https://bazel.build/docs/configurable-attributes
|
||||
#
|
||||
# Normal build (ARM64 host):
|
||||
# % bazel build //tests/cefsimple [-c dbg]
|
||||
#
|
||||
# Cross-compile build (ARM64 host):
|
||||
# % bazel build //tests/cefsimple --cpu=darwin_x86_64 [-c dbg]
|
||||
#
|
||||
|
||||
config_setting(
|
||||
name = "dbg",
|
||||
values = {"compilation_mode": "dbg"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "fastbuild",
|
||||
values = {"compilation_mode": "fastbuild"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "opt",
|
||||
values = {"compilation_mode": "opt"},
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "windows_32",
|
||||
match_all = ["@platforms//os:windows", "@platforms//cpu:x86_32"],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "windows_64",
|
||||
match_all = ["@platforms//os:windows", "@platforms//cpu:x86_64"],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "windows_dbg",
|
||||
match_all = ["@platforms//os:windows", ":dbg"],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "windows_fastbuild",
|
||||
match_all = ["@platforms//os:windows", ":fastbuild"],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "windows_opt",
|
||||
match_all = ["@platforms//os:windows", ":opt"],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "linux_dbg",
|
||||
match_all = ["@platforms//os:linux", ":dbg"],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "linux_fastbuild",
|
||||
match_all = ["@platforms//os:linux", ":fastbuild"],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "linux_opt",
|
||||
match_all = ["@platforms//os:linux", ":opt"],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "macos_dbg",
|
||||
match_all = ["@platforms//os:macos", ":dbg"],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "macos_fastbuild",
|
||||
match_all = ["@platforms//os:macos", ":fastbuild"],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "macos_opt",
|
||||
match_all = ["@platforms//os:macos", ":opt"],
|
||||
)
|
||||
|
||||
#
|
||||
# Define common build targets.
|
||||
#
|
||||
|
||||
# Public headers for cef_wrapper here.
|
||||
# Seperated from the actual cef_wrapper since the *.mm file needs access to these as well.
|
||||
cc_library(
|
||||
name = "cef_wrapper_headers",
|
||||
hdrs = glob(
|
||||
[
|
||||
"include/**/*.h",
|
||||
],
|
||||
exclude = [
|
||||
"include/base/internal/**/*.*",
|
||||
"include/internal/**/*.*",
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
objc_library(
|
||||
name = "cef_wrapper_apple",
|
||||
srcs = [
|
||||
"libcef_dll/wrapper/cef_library_loader_mac.mm",
|
||||
],
|
||||
implementation_deps = [":cef_wrapper_headers"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "cef_wrapper",
|
||||
srcs = glob(
|
||||
[
|
||||
"libcef_dll/**/*.cc",
|
||||
"libcef_dll/**/*.h",
|
||||
"libcef_dll_wrapper/**/*.cc",
|
||||
"libcef_dll_wrapper/**/*.h",
|
||||
"include/base/internal/**/*.h",
|
||||
"include/base/internal/**/*.inc",
|
||||
"include/internal/**/*.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({
|
||||
":windows_opt": WIN_COMMON_COPTS_RELEASE,
|
||||
":windows_dbg": WIN_COMMON_COPTS_DEBUG,
|
||||
":windows_fastbuild": WIN_COMMON_COPTS_RELEASE,
|
||||
":linux_opt": LINUX_COMMON_COPTS_RELEASE,
|
||||
":linux_dbg": LINUX_COMMON_COPTS_DEBUG,
|
||||
":linux_fastbuild": LINUX_COMMON_COPTS_RELEASE,
|
||||
":macos_opt": MAC_COMMON_COPTS_RELEASE,
|
||||
":macos_dbg": MAC_COMMON_COPTS_DEBUG,
|
||||
":macos_fastbuild": MAC_COMMON_COPTS_RELEASE,
|
||||
"//conditions:default": None,
|
||||
}),
|
||||
defines = [
|
||||
"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({
|
||||
":windows_opt": WIN_COMMON_DEFINES_RELEASE,
|
||||
":windows_dbg": WIN_COMMON_DEFINES_DEBUG,
|
||||
":windows_fastbuild": WIN_COMMON_DEFINES_RELEASE,
|
||||
":linux_opt": LINUX_COMMON_DEFINES_RELEASE,
|
||||
":linux_dbg": LINUX_COMMON_DEFINES_DEBUG,
|
||||
":linux_fastbuild": LINUX_COMMON_DEFINES_RELEASE,
|
||||
":macos_opt": MAC_COMMON_DEFINES_RELEASE,
|
||||
":macos_dbg": MAC_COMMON_DEFINES_DEBUG,
|
||||
":macos_fastbuild": MAC_COMMON_DEFINES_RELEASE,
|
||||
"//conditions:default": None,
|
||||
}),
|
||||
deps = [":cef_wrapper_headers"] +
|
||||
select({
|
||||
"@platforms//os:macos": [":cef_wrapper_apple"],
|
||||
"@platforms//os:windows": [":cef"],
|
||||
"//conditions:default": None,
|
||||
}),
|
||||
)
|
||||
|
||||
# Only available on MacOS/Windows.
|
||||
cc_library(
|
||||
name = "cef_sandbox_linkflags",
|
||||
linkopts = select({
|
||||
"@platforms//os:macos": ["-lsandbox"],
|
||||
"@platforms//os:windows": [
|
||||
"/DEFAULTLIB:{}".format(lib) for lib in WIN_SANDBOX_LIBS
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
||||
cc_import(
|
||||
name = "cef_sandbox_debug",
|
||||
static_library = select({
|
||||
"@platforms//os:macos": "Debug/cef_sandbox.a",
|
||||
"@platforms//os:windows": "Debug/cef_sandbox.lib",
|
||||
"//conditions:default": None,
|
||||
}),
|
||||
deps = [":cef_sandbox_linkflags"],
|
||||
)
|
||||
|
||||
cc_import(
|
||||
name = "cef_sandbox_release",
|
||||
static_library = select({
|
||||
"@platforms//os:macos": "Release/cef_sandbox.a",
|
||||
"@platforms//os:windows": "Release/cef_sandbox.lib",
|
||||
"//conditions:default": None,
|
||||
}),
|
||||
deps = [":cef_sandbox_linkflags"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "cef_sandbox",
|
||||
actual = select({
|
||||
"//:dbg": ":cef_sandbox_debug",
|
||||
"//conditions:default": ":cef_sandbox_release",
|
||||
}),
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "dlls_opt",
|
||||
srcs = ["Release/{}".format(name) for name in WIN_DLLS] +
|
||||
select({
|
||||
"//:windows_64": ["Release/{}".format(name) for name in WIN_DLLS_X64],
|
||||
"//conditions:default": None,
|
||||
}),
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "dlls_dbg",
|
||||
srcs = ["Debug/{}".format(name) for name in WIN_DLLS] +
|
||||
select({
|
||||
"//:windows_64": ["Debug/{}".format(name) for name in WIN_DLLS_X64],
|
||||
"//conditions:default": None,
|
||||
}),
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "dlls",
|
||||
actual = select({
|
||||
"//:dbg": ":dlls_dbg",
|
||||
"//conditions:default": ":dlls_opt",
|
||||
})
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "sos_opt",
|
||||
srcs = ["Release/{}".format(name) for name in LINUX_SOS],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "sos_dbg",
|
||||
srcs = ["Debug/{}".format(name) for name in LINUX_SOS],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "sos",
|
||||
actual = select({
|
||||
"//:dbg": ":sos_dbg",
|
||||
"//conditions:default": ":sos_opt",
|
||||
})
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "resources_common",
|
||||
srcs = glob([
|
||||
"Resources/**",
|
||||
]),
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "resources_opt",
|
||||
srcs = [
|
||||
"Release/snapshot_blob.bin",
|
||||
"Release/v8_context_snapshot.bin",
|
||||
"Release/vk_swiftshader_icd.json",
|
||||
":resources_common",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "resources_dbg",
|
||||
srcs = [
|
||||
"Debug/snapshot_blob.bin",
|
||||
"Debug/v8_context_snapshot.bin",
|
||||
"Debug/vk_swiftshader_icd.json",
|
||||
":resources_common",
|
||||
],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "resources",
|
||||
actual = select({
|
||||
"//:opt": ":resources_opt",
|
||||
"//conditions:default": ":resources_dbg",
|
||||
})
|
||||
)
|
||||
|
||||
# Only available on Linux/Windows.
|
||||
cc_import(
|
||||
name = "cef_dbg",
|
||||
interface_library = select({
|
||||
"@platforms//os:windows": "Debug/libcef.lib",
|
||||
"//conditions:default": None,
|
||||
}),
|
||||
shared_library = select({
|
||||
"@platforms//os:linux": "Debug/libcef.so",
|
||||
"@platforms//os:windows": "Debug/libcef.dll",
|
||||
"//conditions:default": None,
|
||||
}),
|
||||
)
|
||||
|
||||
cc_import(
|
||||
name = "cef_opt",
|
||||
interface_library = select({
|
||||
"@platforms//os:windows": "Release/libcef.lib",
|
||||
"//conditions:default": None,
|
||||
}),
|
||||
shared_library = select({
|
||||
"@platforms//os:linux": "Release/libcef.so",
|
||||
"@platforms//os:windows": "Release/libcef.dll",
|
||||
"//conditions:default": None,
|
||||
}),
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "cef",
|
||||
actual = select({
|
||||
"//:dbg": ":cef_dbg",
|
||||
"//conditions:default": ":cef_opt",
|
||||
}),
|
||||
)
|
||||
|
||||
apple_dynamic_framework_import(
|
||||
name = "cef_framework",
|
||||
framework_imports = select({
|
||||
"//:dbg": glob(["Debug/{}.framework/**".format(CEF_FRAMEWORK_NAME)]),
|
||||
"//conditions:default": glob(["Release/{}.framework/**".format(CEF_FRAMEWORK_NAME)]),
|
||||
}),
|
||||
)
|
17
tools/distrib/bazel/MODULE.bazel.in
Normal file
17
tools/distrib/bazel/MODULE.bazel.in
Normal file
@@ -0,0 +1,17 @@
|
||||
# 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.
|
||||
|
||||
module(name = "cef", version = "${version_short}")
|
||||
|
||||
# Configure local MacOS toolchain.
|
||||
# See https://github.com/bazelbuild/apple_support/releases
|
||||
bazel_dep(name = "apple_support", version = "1.16.0", repo_name = "build_bazel_apple_support")
|
||||
# See https://github.com/bazelbuild/rules_apple/releases
|
||||
bazel_dep(name = "rules_apple", version = "3.6.0", repo_name = "build_bazel_rules_apple")
|
||||
|
||||
# Configure local C++ toolchain.
|
||||
# See https://github.com/bazelbuild/rules_cc/releases
|
||||
bazel_dep(name = "rules_cc", version = "0.0.9")
|
||||
|
||||
# Add other dependencies here.
|
55
tools/distrib/bazel/WORKSPACE
Executable file
55
tools/distrib/bazel/WORKSPACE
Executable file
@@ -0,0 +1,55 @@
|
||||
# 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.
|
||||
|
||||
workspace(name = "cef")
|
||||
|
||||
#
|
||||
# Windows configuration.
|
||||
#
|
||||
|
||||
# Configure windows SDK.
|
||||
load("//bazel/win:setup_sdk.bzl", "setup_sdk")
|
||||
setup_sdk(name = "winsdk")
|
||||
|
||||
#
|
||||
# Linux configuration.
|
||||
#
|
||||
|
||||
# Configure Linux using pkg-config.
|
||||
local_repository(name="pkg_config", path="bazel/linux/pkg_config")
|
||||
load("@pkg_config//:pkg_config.bzl", "pkg_config")
|
||||
|
||||
# Define packages used by cefclient.
|
||||
|
||||
pkg_config(
|
||||
name = "gmodule2",
|
||||
pkg_name = "gmodule-2.0",
|
||||
)
|
||||
|
||||
pkg_config(
|
||||
name = "gtk3",
|
||||
pkg_name = "gtk+-3.0",
|
||||
)
|
||||
|
||||
pkg_config(
|
||||
name = "gthread2",
|
||||
pkg_name = "gthread-2.0",
|
||||
)
|
||||
|
||||
pkg_config(
|
||||
name = "gtkprint3",
|
||||
pkg_name = "gtk+-unix-print-3.0",
|
||||
)
|
||||
|
||||
pkg_config(
|
||||
name = "xi",
|
||||
)
|
||||
|
||||
# Define packages used by ceftests.
|
||||
|
||||
pkg_config(
|
||||
name = "glib2",
|
||||
pkg_name = "glib-2.0",
|
||||
)
|
||||
|
8
tools/distrib/bazel/bazel-variables.bzl.in
Normal file
8
tools/distrib/bazel/bazel-variables.bzl.in
Normal file
@@ -0,0 +1,8 @@
|
||||
# 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.
|
||||
|
||||
# CEF version.
|
||||
VERSION_LONG="${version_long}"
|
||||
VERSION_SHORT="${version_short}"
|
||||
VERSION_PLIST="${version_plist}"
|
128
tools/distrib/bazel/tests-cefclient-BUILD.bazel.in
Normal file
128
tools/distrib/bazel/tests-cefclient-BUILD.bazel.in
Normal file
@@ -0,0 +1,128 @@
|
||||
# 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.
|
||||
|
||||
PRODUCT_NAME = "cefclient"
|
||||
PKG_NAME = "//tests/{}".format(PRODUCT_NAME)
|
||||
|
||||
# Allow access from subpackages only.
|
||||
package(default_visibility = [
|
||||
":__subpackages__",
|
||||
])
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library")
|
||||
|
||||
#
|
||||
# Source file lists.
|
||||
#
|
||||
|
||||
srcs_common = [
|
||||
${cefclient_sources_common}
|
||||
]
|
||||
|
||||
srcs_renderer = [
|
||||
${cefclient_sources_renderer}
|
||||
]
|
||||
|
||||
srcs_browser = [
|
||||
${cefclient_sources_browser}
|
||||
]
|
||||
|
||||
srcs_browser_linux = [
|
||||
${cefclient_sources_linux}
|
||||
]
|
||||
|
||||
srcs_browser_mac = [
|
||||
${cefclient_sources_mac}
|
||||
]
|
||||
|
||||
srcs_browser_win = [
|
||||
${cefclient_sources_win}
|
||||
]
|
||||
|
||||
srcs_resources = [
|
||||
${cefclient_sources_resources}
|
||||
]
|
||||
|
||||
filegroup(
|
||||
name = "Resources",
|
||||
srcs = srcs_resources,
|
||||
)
|
||||
|
||||
#
|
||||
# MacOS targets.
|
||||
#
|
||||
|
||||
objc_library(
|
||||
name = "BrowserLibMac",
|
||||
srcs = srcs_common + srcs_browser + srcs_browser_mac,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:macos",
|
||||
],
|
||||
deps = [
|
||||
"//:cef_wrapper",
|
||||
"//tests/shared:BrowserLibMac",
|
||||
],
|
||||
)
|
||||
|
||||
objc_library(
|
||||
name = "RendererLibMac",
|
||||
srcs = srcs_common + srcs_renderer,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:macos",
|
||||
],
|
||||
deps = [
|
||||
"//:cef_wrapper",
|
||||
"//tests/shared:RendererLibMac",
|
||||
],
|
||||
)
|
||||
|
||||
#
|
||||
# Windows targets.
|
||||
#
|
||||
|
||||
# Allow access from the declare_exe target.
|
||||
filegroup(
|
||||
name = "ResourceH",
|
||||
srcs = [
|
||||
"browser/resource.h"
|
||||
]
|
||||
)
|
||||
|
||||
# Include files directly in the declare_exe target. This simplifies the build
|
||||
# configuration and avoids issues with Windows discarding symbols (like WinMain)
|
||||
# when linking libraries.
|
||||
filegroup(
|
||||
name = "SrcsWin",
|
||||
srcs = srcs_common + srcs_browser + srcs_browser_win + srcs_renderer,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:windows",
|
||||
],
|
||||
)
|
||||
|
||||
#
|
||||
# Linux targets.
|
||||
#
|
||||
|
||||
# Include files directly in the declare_exe target. This simplifies the build
|
||||
# configuration.
|
||||
filegroup(
|
||||
name = "SrcsLinux",
|
||||
srcs = srcs_common + srcs_browser + srcs_browser_linux + srcs_renderer,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:linux",
|
||||
],
|
||||
)
|
||||
|
||||
#
|
||||
# Alias to platform-specific build targets.
|
||||
#
|
||||
|
||||
alias(
|
||||
name = PRODUCT_NAME,
|
||||
actual = select({
|
||||
"@platforms//os:linux": "{}/linux:{}".format(PKG_NAME, PRODUCT_NAME),
|
||||
"@platforms//os:macos": "{}/mac:{}".format(PKG_NAME, PRODUCT_NAME),
|
||||
"@platforms//os:windows": "{}/win:{}".format(PKG_NAME, PRODUCT_NAME),
|
||||
}),
|
||||
)
|
59
tools/distrib/bazel/tests-cefclient-linux-BUILD.bazel
Normal file
59
tools/distrib/bazel/tests-cefclient-linux-BUILD.bazel
Normal file
@@ -0,0 +1,59 @@
|
||||
# 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.
|
||||
|
||||
PRODUCT_NAME = "cefclient"
|
||||
PKG_NAME = "//tests/{}".format(PRODUCT_NAME)
|
||||
|
||||
# Allow access from the parent package only.
|
||||
package(default_visibility = [
|
||||
"{}:__pkg__".format(PKG_NAME),
|
||||
])
|
||||
|
||||
load("//bazel:copy_filegroups.bzl", "copy_filegroups")
|
||||
load("//bazel/linux:exe_helpers.bzl", "declare_exe")
|
||||
|
||||
#
|
||||
# Linux executable target.
|
||||
#
|
||||
|
||||
# Copy resources into the current project.
|
||||
copy_target = "{}_resources".format(PRODUCT_NAME)
|
||||
copy_filegroups(
|
||||
name = copy_target,
|
||||
filegroups = [
|
||||
"{}:Resources".format(PKG_NAME),
|
||||
"//tests/shared:Resources",
|
||||
],
|
||||
remove_prefixes = [
|
||||
"tests/{}/resources".format(PRODUCT_NAME),
|
||||
"tests/shared/resources",
|
||||
],
|
||||
add_prefix = "cefclient_files",
|
||||
)
|
||||
|
||||
declare_exe(
|
||||
name = PRODUCT_NAME,
|
||||
srcs = [
|
||||
"{}:SrcsLinux".format(PKG_NAME),
|
||||
"//tests/shared:SrcsLinux",
|
||||
],
|
||||
data = [
|
||||
":{}".format(copy_target),
|
||||
],
|
||||
copts = [
|
||||
"-Wno-deprecated-declarations",
|
||||
],
|
||||
linkopts = [
|
||||
"-lGL",
|
||||
],
|
||||
deps = [
|
||||
# Declared in the top-level WORKSPACE file.
|
||||
"@gmodule2//:lib",
|
||||
"@gtk3//:lib",
|
||||
"@gthread2//:lib",
|
||||
"@gtkprint3//:lib",
|
||||
"@xi//:lib",
|
||||
],
|
||||
)
|
||||
|
53
tools/distrib/bazel/tests-cefclient-mac-BUILD.bazel
Normal file
53
tools/distrib/bazel/tests-cefclient-mac-BUILD.bazel
Normal file
@@ -0,0 +1,53 @@
|
||||
# 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.
|
||||
|
||||
PRODUCT_NAME = "cefclient"
|
||||
PKG_NAME = "//tests/{}".format(PRODUCT_NAME)
|
||||
|
||||
# Allow access from the parent package only.
|
||||
package(default_visibility = [
|
||||
"{}:__pkg__".format(PKG_NAME),
|
||||
])
|
||||
|
||||
load("//bazel/mac:app_helpers.bzl", "declare_all_helper_apps", "declare_main_app")
|
||||
|
||||
#
|
||||
# MacOS app bundle target.
|
||||
#
|
||||
|
||||
filegroup(
|
||||
name = "ResourcesMac",
|
||||
srcs = [
|
||||
"English.lproj/InfoPlist.strings",
|
||||
"English.lproj/MainMenu.xib",
|
||||
"{}.icns".format(PRODUCT_NAME),
|
||||
],
|
||||
)
|
||||
|
||||
# Helper app bundles.
|
||||
declare_all_helper_apps(
|
||||
name = PRODUCT_NAME,
|
||||
info_plist = "helper-Info.plist.in",
|
||||
deps = [
|
||||
"{}:RendererLibMac".format(PKG_NAME),
|
||||
],
|
||||
)
|
||||
|
||||
# Main app bundle.
|
||||
declare_main_app(
|
||||
name = PRODUCT_NAME,
|
||||
info_plist = "Info.plist.in",
|
||||
deps = [
|
||||
"{}:BrowserLibMac".format(PKG_NAME),
|
||||
],
|
||||
linkopts = [
|
||||
"-framework IOSurface",
|
||||
"-framework OpenGL",
|
||||
],
|
||||
resources = [
|
||||
":ResourcesMac",
|
||||
"{}:Resources".format(PKG_NAME),
|
||||
"//tests/shared:Resources",
|
||||
]
|
||||
)
|
59
tools/distrib/bazel/tests-cefclient-win-BUILD.bazel
Normal file
59
tools/distrib/bazel/tests-cefclient-win-BUILD.bazel
Normal file
@@ -0,0 +1,59 @@
|
||||
# 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.
|
||||
|
||||
PRODUCT_NAME = "cefclient"
|
||||
PKG_NAME = "//tests/{}".format(PRODUCT_NAME)
|
||||
|
||||
# Allow access from the parent package only.
|
||||
package(default_visibility = [
|
||||
"{}:__pkg__".format(PKG_NAME),
|
||||
])
|
||||
|
||||
load("//bazel/win:exe_helpers.bzl", "declare_exe")
|
||||
|
||||
#
|
||||
# Windows executable target.
|
||||
#
|
||||
|
||||
LINK_LIBS = [
|
||||
"comdlg32.lib",
|
||||
"d3d11.lib",
|
||||
"glu32.lib",
|
||||
"imm32.lib",
|
||||
"opengl32.lib",
|
||||
]
|
||||
|
||||
DELAYLOAD_DLLS = [
|
||||
"comdlg32.dll",
|
||||
"glu32.dll",
|
||||
"oleaut32.dll",
|
||||
"opengl32.dll",
|
||||
]
|
||||
|
||||
declare_exe(
|
||||
name = PRODUCT_NAME,
|
||||
srcs = [
|
||||
"{}:SrcsWin".format(PKG_NAME),
|
||||
"//tests/shared:SrcsWin",
|
||||
],
|
||||
rc_file = "{}.rc".format(PRODUCT_NAME),
|
||||
manifest_srcs = [
|
||||
"compatibility.manifest",
|
||||
"{}.exe.manifest".format(PRODUCT_NAME),
|
||||
],
|
||||
resources_srcs = [
|
||||
"{}:ResourceH".format(PKG_NAME),
|
||||
"{}:Resources".format(PKG_NAME),
|
||||
"{}.ico".format(PRODUCT_NAME),
|
||||
"small.ico",
|
||||
"//tests/shared:Resources",
|
||||
],
|
||||
linkopts = [
|
||||
"/SUBSYSTEM:WINDOWS",
|
||||
] + [
|
||||
"/DEFAULTLIB:{}".format(lib) for lib in LINK_LIBS
|
||||
] + [
|
||||
"/DELOAYLOAD:{}".format(lib) for lib in DELAYLOAD_DLLS
|
||||
],
|
||||
)
|
113
tools/distrib/bazel/tests-cefsimple-BUILD.bazel.in
Normal file
113
tools/distrib/bazel/tests-cefsimple-BUILD.bazel.in
Normal file
@@ -0,0 +1,113 @@
|
||||
# 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.
|
||||
|
||||
PRODUCT_NAME = "cefsimple"
|
||||
PKG_NAME = "//tests/{}".format(PRODUCT_NAME)
|
||||
|
||||
# Allow access from subpackages only.
|
||||
package(default_visibility = [
|
||||
":__subpackages__",
|
||||
])
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library")
|
||||
|
||||
#
|
||||
# Source file lists.
|
||||
#
|
||||
|
||||
srcs_browser = [
|
||||
${cefsimple_sources_common}
|
||||
]
|
||||
|
||||
srcs_browser_linux = [
|
||||
${cefsimple_sources_linux}
|
||||
]
|
||||
|
||||
srcs_browser_mac = [
|
||||
${cefsimple_sources_mac}
|
||||
]
|
||||
|
||||
srcs_browser_win = [
|
||||
${cefsimple_sources_win}
|
||||
]
|
||||
|
||||
srcs_renderer_mac = [
|
||||
${cefsimple_sources_mac_helper}
|
||||
]
|
||||
|
||||
#
|
||||
# MacOS targets.
|
||||
#
|
||||
|
||||
objc_library(
|
||||
name = "BrowserLibMac",
|
||||
srcs = srcs_browser + srcs_browser_mac,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:macos",
|
||||
],
|
||||
deps = [
|
||||
"//:cef_wrapper",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "RendererLibMac",
|
||||
srcs = srcs_renderer_mac,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:macos",
|
||||
],
|
||||
deps = [
|
||||
"//:cef_wrapper",
|
||||
],
|
||||
)
|
||||
|
||||
#
|
||||
# Windows targets.
|
||||
#
|
||||
|
||||
# Allow access from the declare_exe target.
|
||||
filegroup(
|
||||
name = "ResourceH",
|
||||
srcs = [
|
||||
"resource.h"
|
||||
]
|
||||
)
|
||||
|
||||
# Include files directly in the declare_exe target. This simplifies the build
|
||||
# configuration and avoids issues with Windows discarding symbols (like WinMain)
|
||||
# when linking libraries.
|
||||
filegroup(
|
||||
name = "SrcsWin",
|
||||
srcs = srcs_browser + srcs_browser_win,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:windows",
|
||||
],
|
||||
)
|
||||
|
||||
#
|
||||
# Linux targets.
|
||||
#
|
||||
|
||||
# Include files directly in the declare_exe target. This simplifies the build
|
||||
# configuration.
|
||||
filegroup(
|
||||
name = "SrcsLinux",
|
||||
srcs = srcs_browser + srcs_browser_linux,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:linux",
|
||||
],
|
||||
)
|
||||
|
||||
#
|
||||
# Alias to platform-specific build targets.
|
||||
#
|
||||
|
||||
alias(
|
||||
name = PRODUCT_NAME,
|
||||
actual = select({
|
||||
"@platforms//os:linux": "{}/linux:{}".format(PKG_NAME, PRODUCT_NAME),
|
||||
"@platforms//os:macos": "{}/mac:{}".format(PKG_NAME, PRODUCT_NAME),
|
||||
"@platforms//os:windows": "{}/win:{}".format(PKG_NAME, PRODUCT_NAME),
|
||||
}),
|
||||
)
|
25
tools/distrib/bazel/tests-cefsimple-linux-BUILD.bazel
Normal file
25
tools/distrib/bazel/tests-cefsimple-linux-BUILD.bazel
Normal file
@@ -0,0 +1,25 @@
|
||||
# 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.
|
||||
|
||||
PRODUCT_NAME = "cefsimple"
|
||||
PKG_NAME = "//tests/{}".format(PRODUCT_NAME)
|
||||
|
||||
# Allow access from the parent package only.
|
||||
package(default_visibility = [
|
||||
"{}:__pkg__".format(PKG_NAME),
|
||||
])
|
||||
|
||||
load("//bazel/linux:exe_helpers.bzl", "declare_exe")
|
||||
|
||||
#
|
||||
# Linux executable target.
|
||||
#
|
||||
|
||||
declare_exe(
|
||||
name = PRODUCT_NAME,
|
||||
srcs = [
|
||||
"{}:SrcsLinux".format(PKG_NAME),
|
||||
],
|
||||
)
|
||||
|
48
tools/distrib/bazel/tests-cefsimple-mac-BUILD.bazel
Normal file
48
tools/distrib/bazel/tests-cefsimple-mac-BUILD.bazel
Normal file
@@ -0,0 +1,48 @@
|
||||
# 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.
|
||||
|
||||
PRODUCT_NAME = "cefsimple"
|
||||
PKG_NAME = "//tests/{}".format(PRODUCT_NAME)
|
||||
|
||||
# Allow access from the parent package only.
|
||||
package(default_visibility = [
|
||||
"{}:__pkg__".format(PKG_NAME),
|
||||
])
|
||||
|
||||
load("//bazel/mac:app_helpers.bzl", "declare_all_helper_apps", "declare_main_app")
|
||||
|
||||
#
|
||||
# MacOS app bundle target.
|
||||
#
|
||||
|
||||
filegroup(
|
||||
name = "ResourcesMac",
|
||||
srcs = [
|
||||
"English.lproj/InfoPlist.strings",
|
||||
"English.lproj/MainMenu.xib",
|
||||
"{}.icns".format(PRODUCT_NAME),
|
||||
],
|
||||
)
|
||||
|
||||
# Helper app bundles.
|
||||
declare_all_helper_apps(
|
||||
name = PRODUCT_NAME,
|
||||
info_plist = "helper-Info.plist.in",
|
||||
deps = [
|
||||
"{}:RendererLibMac".format(PKG_NAME),
|
||||
],
|
||||
)
|
||||
|
||||
# Main app bundle.
|
||||
declare_main_app(
|
||||
name = PRODUCT_NAME,
|
||||
info_plist = "Info.plist.in",
|
||||
deps = [
|
||||
"{}:BrowserLibMac".format(PKG_NAME),
|
||||
],
|
||||
linkopts = [],
|
||||
resources = [
|
||||
":ResourcesMac",
|
||||
]
|
||||
)
|
37
tools/distrib/bazel/tests-cefsimple-win-BUILD.bazel
Normal file
37
tools/distrib/bazel/tests-cefsimple-win-BUILD.bazel
Normal file
@@ -0,0 +1,37 @@
|
||||
# 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.
|
||||
|
||||
PRODUCT_NAME = "cefsimple"
|
||||
PKG_NAME = "//tests/{}".format(PRODUCT_NAME)
|
||||
|
||||
# Allow access from the parent package only.
|
||||
package(default_visibility = [
|
||||
"{}:__pkg__".format(PKG_NAME),
|
||||
])
|
||||
|
||||
load("//bazel/win:exe_helpers.bzl", "declare_exe")
|
||||
|
||||
#
|
||||
# Windows executable target.
|
||||
#
|
||||
|
||||
declare_exe(
|
||||
name = PRODUCT_NAME,
|
||||
srcs = [
|
||||
"{}:SrcsWin".format(PKG_NAME),
|
||||
],
|
||||
rc_file = "{}.rc".format(PRODUCT_NAME),
|
||||
manifest_srcs = [
|
||||
"compatibility.manifest",
|
||||
"{}.exe.manifest".format(PRODUCT_NAME),
|
||||
],
|
||||
resources_srcs = [
|
||||
"{}:ResourceH".format(PKG_NAME),
|
||||
"{}.ico".format(PRODUCT_NAME),
|
||||
"small.ico",
|
||||
],
|
||||
linkopts = [
|
||||
"/SUBSYSTEM:WINDOWS",
|
||||
],
|
||||
)
|
128
tools/distrib/bazel/tests-ceftests-BUILD.bazel.in
Normal file
128
tools/distrib/bazel/tests-ceftests-BUILD.bazel.in
Normal file
@@ -0,0 +1,128 @@
|
||||
# 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.
|
||||
|
||||
PRODUCT_NAME = "ceftests"
|
||||
PKG_NAME = "//tests/{}".format(PRODUCT_NAME)
|
||||
|
||||
# Allow access from subpackages only.
|
||||
package(default_visibility = [
|
||||
":__subpackages__",
|
||||
])
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library")
|
||||
|
||||
#
|
||||
# Source file lists.
|
||||
#
|
||||
|
||||
srcs_renderer_mac = [
|
||||
${ceftests_sources_mac_helper}
|
||||
]
|
||||
|
||||
srcs_browser = [
|
||||
${ceftests_sources_common}
|
||||
]
|
||||
|
||||
srcs_browser_linux = [
|
||||
${ceftests_sources_linux}
|
||||
]
|
||||
|
||||
srcs_browser_mac = [
|
||||
${ceftests_sources_mac}
|
||||
]
|
||||
|
||||
srcs_browser_win = [
|
||||
${ceftests_sources_win}
|
||||
]
|
||||
|
||||
filegroup(
|
||||
name = "Resources",
|
||||
srcs = glob(["resources/**"]),
|
||||
)
|
||||
|
||||
#
|
||||
# MacOS targets.
|
||||
#
|
||||
|
||||
# Copy the 'net' folder into app bundle Resources.
|
||||
filegroup(
|
||||
name = "ResourcesMac",
|
||||
srcs = ["resources/net"],
|
||||
)
|
||||
|
||||
objc_library(
|
||||
name = "BrowserLibMac",
|
||||
srcs = srcs_browser + srcs_browser_mac,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:macos",
|
||||
],
|
||||
deps = [
|
||||
"//:cef_wrapper",
|
||||
"//tests/gtest",
|
||||
"//tests/shared:BrowserLibMacCefTests",
|
||||
],
|
||||
)
|
||||
|
||||
objc_library(
|
||||
name = "RendererLibMac",
|
||||
srcs = srcs_renderer_mac,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:macos",
|
||||
],
|
||||
deps = [
|
||||
"//:cef_wrapper",
|
||||
"//tests/gtest",
|
||||
"//tests/shared:RendererLibMacCefTests",
|
||||
],
|
||||
)
|
||||
|
||||
#
|
||||
# Windows targets.
|
||||
#
|
||||
|
||||
# Allow access from the declare_exe target.
|
||||
filegroup(
|
||||
name = "ResourceH",
|
||||
srcs = [
|
||||
"resource.h"
|
||||
]
|
||||
)
|
||||
|
||||
# Include files directly in the declare_exe target. This simplifies the build
|
||||
# configuration and avoids issues with Windows discarding symbols (like WinMain)
|
||||
# when linking libraries.
|
||||
filegroup(
|
||||
name = "SrcsWin",
|
||||
srcs = srcs_browser + srcs_browser_win,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:windows",
|
||||
],
|
||||
)
|
||||
|
||||
#
|
||||
# Linux targets.
|
||||
#
|
||||
|
||||
# Include files directly in the declare_exe target. This simplifies the build
|
||||
# configuration.
|
||||
filegroup(
|
||||
name = "SrcsLinux",
|
||||
srcs = srcs_browser + srcs_browser_linux,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:linux",
|
||||
],
|
||||
)
|
||||
|
||||
#
|
||||
# Alias to platform-specific build targets.
|
||||
#
|
||||
|
||||
alias(
|
||||
name = PRODUCT_NAME,
|
||||
actual = select({
|
||||
"@platforms//os:linux": "{}/linux:{}".format(PKG_NAME, PRODUCT_NAME),
|
||||
"@platforms//os:macos": "{}/mac:{}".format(PKG_NAME, PRODUCT_NAME),
|
||||
"@platforms//os:windows": "{}/win:{}".format(PKG_NAME, PRODUCT_NAME),
|
||||
}),
|
||||
)
|
53
tools/distrib/bazel/tests-ceftests-linux-BUILD.bazel
Normal file
53
tools/distrib/bazel/tests-ceftests-linux-BUILD.bazel
Normal file
@@ -0,0 +1,53 @@
|
||||
# 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.
|
||||
|
||||
PRODUCT_NAME = "ceftests"
|
||||
PKG_NAME = "//tests/{}".format(PRODUCT_NAME)
|
||||
|
||||
# Allow access from the parent package only.
|
||||
package(default_visibility = [
|
||||
"{}:__pkg__".format(PKG_NAME),
|
||||
])
|
||||
|
||||
load("//bazel:copy_filegroups.bzl", "copy_filegroups")
|
||||
load("//bazel/linux:exe_helpers.bzl", "declare_exe")
|
||||
|
||||
#
|
||||
# Linux executable target.
|
||||
#
|
||||
|
||||
# Copy resources into the current project.
|
||||
copy_target = "{}_resources".format(PRODUCT_NAME)
|
||||
copy_filegroups(
|
||||
name = copy_target,
|
||||
filegroups = [
|
||||
"{}:Resources".format(PKG_NAME),
|
||||
"//tests/shared:Resources",
|
||||
],
|
||||
remove_prefixes = [
|
||||
"tests/{}/resources".format(PRODUCT_NAME),
|
||||
"tests/shared/resources",
|
||||
],
|
||||
add_prefix = "ceftests_files",
|
||||
)
|
||||
|
||||
declare_exe(
|
||||
name = PRODUCT_NAME,
|
||||
srcs = [
|
||||
"{}:SrcsLinux".format(PKG_NAME),
|
||||
"//tests/shared:SrcsLinux",
|
||||
],
|
||||
data = [
|
||||
":{}".format(copy_target),
|
||||
],
|
||||
copts = [
|
||||
"-Wno-comments",
|
||||
],
|
||||
deps = [
|
||||
"//tests/gtest",
|
||||
# Declared in the top-level WORKSPACE file.
|
||||
"@glib2//:lib",
|
||||
],
|
||||
)
|
||||
|
53
tools/distrib/bazel/tests-ceftests-mac-BUILD.bazel
Normal file
53
tools/distrib/bazel/tests-ceftests-mac-BUILD.bazel
Normal file
@@ -0,0 +1,53 @@
|
||||
# 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.
|
||||
|
||||
PRODUCT_NAME = "ceftests"
|
||||
PKG_NAME = "//tests/{}".format(PRODUCT_NAME)
|
||||
|
||||
# Allow access from the parent package only.
|
||||
package(default_visibility = [
|
||||
"{}:__pkg__".format(PKG_NAME),
|
||||
])
|
||||
|
||||
load("//bazel/mac:app_helpers.bzl", "declare_all_helper_apps", "declare_main_app")
|
||||
|
||||
#
|
||||
# MacOS app bundle target.
|
||||
#
|
||||
|
||||
filegroup(
|
||||
name = "ResourcesMac",
|
||||
srcs = [
|
||||
"English.lproj/InfoPlist.strings",
|
||||
"English.lproj/MainMenu.xib",
|
||||
"{}.icns".format(PRODUCT_NAME),
|
||||
],
|
||||
)
|
||||
|
||||
# Helper app bundles.
|
||||
declare_all_helper_apps(
|
||||
name = PRODUCT_NAME,
|
||||
info_plist = "helper-Info.plist.in",
|
||||
deps = [
|
||||
"{}:RendererLibMac".format(PKG_NAME),
|
||||
],
|
||||
)
|
||||
|
||||
# Main app bundle.
|
||||
declare_main_app(
|
||||
name = PRODUCT_NAME,
|
||||
info_plist = "Info.plist.in",
|
||||
deps = [
|
||||
"{}:BrowserLibMac".format(PKG_NAME),
|
||||
],
|
||||
linkopts = [
|
||||
"-framework IOSurface",
|
||||
"-framework OpenGL",
|
||||
],
|
||||
resources = [
|
||||
":ResourcesMac",
|
||||
"{}:ResourcesMac".format(PKG_NAME),
|
||||
"//tests/shared:Resources",
|
||||
]
|
||||
)
|
59
tools/distrib/bazel/tests-ceftests-win-BUILD.bazel
Normal file
59
tools/distrib/bazel/tests-ceftests-win-BUILD.bazel
Normal file
@@ -0,0 +1,59 @@
|
||||
# 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.
|
||||
|
||||
PRODUCT_NAME = "ceftests"
|
||||
PKG_NAME = "//tests/{}".format(PRODUCT_NAME)
|
||||
|
||||
# Allow access from the parent package only.
|
||||
package(default_visibility = [
|
||||
"{}:__pkg__".format(PKG_NAME),
|
||||
])
|
||||
|
||||
load("//bazel:copy_filegroups.bzl", "copy_filegroups")
|
||||
load("//bazel/win:exe_helpers.bzl", "declare_exe")
|
||||
|
||||
#
|
||||
# Windows executable target.
|
||||
#
|
||||
|
||||
# Copy resources into the current project.
|
||||
copy_target = "{}_resources".format(PRODUCT_NAME)
|
||||
copy_filegroups(
|
||||
name = copy_target,
|
||||
filegroups = [
|
||||
"{}:Resources".format(PKG_NAME),
|
||||
],
|
||||
remove_prefixes = [
|
||||
"tests/{}/resources".format(PRODUCT_NAME),
|
||||
],
|
||||
add_prefix = "ceftests_files",
|
||||
)
|
||||
|
||||
declare_exe(
|
||||
name = PRODUCT_NAME,
|
||||
srcs = [
|
||||
"{}:SrcsWin".format(PKG_NAME),
|
||||
"//tests/shared:SrcsWin",
|
||||
],
|
||||
deps = [
|
||||
"//tests/gtest",
|
||||
],
|
||||
rc_file = "{}.rc".format(PRODUCT_NAME),
|
||||
manifest_srcs = [
|
||||
"compatibility.manifest",
|
||||
"{}.exe.manifest".format(PRODUCT_NAME),
|
||||
],
|
||||
resources_srcs = [
|
||||
"{}:ResourceH".format(PKG_NAME),
|
||||
"{}.ico".format(PRODUCT_NAME),
|
||||
"small.ico",
|
||||
"//tests/shared:Resources",
|
||||
],
|
||||
linkopts = [
|
||||
"/SUBSYSTEM:CONSOLE",
|
||||
],
|
||||
data = [
|
||||
":{}".format(copy_target),
|
||||
],
|
||||
)
|
71
tools/distrib/bazel/tests-gtest-BUILD.bazel
Normal file
71
tools/distrib/bazel/tests-gtest-BUILD.bazel
Normal file
@@ -0,0 +1,71 @@
|
||||
# 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_LINKOPTS="COMMON_LINKOPTS",
|
||||
WIN_COMMON_COPTS="COMMON_COPTS",
|
||||
WIN_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
|
||||
WIN_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG")
|
||||
load("//bazel/linux:variables.bzl",
|
||||
LINUX_COMMON_LINKOPTS="COMMON_LINKOPTS",
|
||||
LINUX_COMMON_COPTS="COMMON_COPTS",
|
||||
LINUX_COMMON_COPTS_RELEASE="COMMON_COPTS_RELEASE",
|
||||
LINUX_COMMON_COPTS_DEBUG="COMMON_COPTS_DEBUG")
|
||||
load("//bazel/mac:variables.bzl",
|
||||
MAC_COMMON_LINKOPTS="COMMON_LINKOPTS",
|
||||
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")
|
||||
|
||||
# Allow access from targets in other packages.
|
||||
package(default_visibility = [
|
||||
"//visibility:public",
|
||||
])
|
||||
|
||||
cc_library(
|
||||
name = "gtest",
|
||||
srcs = [
|
||||
"include/gtest/gtest.h",
|
||||
"src/gtest-all.cc",
|
||||
"teamcity/include/teamcity_gtest.h",
|
||||
"teamcity/src/teamcity_gtest.cpp",
|
||||
"teamcity/src/teamcity_messages.cpp",
|
||||
"teamcity/src/teamcity_messages.h",
|
||||
],
|
||||
local_defines = [
|
||||
# In order to allow regex matches in gtest to be shared between Windows
|
||||
# and other systems we tell gtest to always use it's internal engine.
|
||||
"GTEST_HAS_POSIX_RE=0",
|
||||
"GTEST_LANG_CXX11=1",
|
||||
],
|
||||
defines = [
|
||||
# All dependent targets are unit tests.
|
||||
"UNIT_TEST",
|
||||
],
|
||||
includes = [
|
||||
# The gtest-all.cc file uses #include "gtest/gtest.h"
|
||||
"include",
|
||||
],
|
||||
copts = select({
|
||||
"@platforms//os:windows": [
|
||||
# Disable unused variable warning.
|
||||
"/wd4800",
|
||||
] + WIN_COMMON_COPTS,
|
||||
"@platforms//os:linux": LINUX_COMMON_COPTS,
|
||||
"@platforms//os:macos": MAC_COMMON_COPTS,
|
||||
"//conditions:default": None,
|
||||
}) + select({
|
||||
"//:windows_opt": WIN_COMMON_COPTS_RELEASE,
|
||||
"//:windows_dbg": WIN_COMMON_COPTS_DEBUG,
|
||||
"//:windows_fastbuild": WIN_COMMON_COPTS_DEBUG,
|
||||
"//:linux_opt": LINUX_COMMON_COPTS_RELEASE,
|
||||
"//:linux_dbg": LINUX_COMMON_COPTS_DEBUG,
|
||||
"//:linux_fastbuild": LINUX_COMMON_COPTS_DEBUG,
|
||||
"//:macos_opt": MAC_COMMON_COPTS_RELEASE,
|
||||
"//:macos_dbg": MAC_COMMON_COPTS_DEBUG,
|
||||
"//:macos_fastbuild": MAC_COMMON_COPTS_DEBUG,
|
||||
"//conditions:default": None,
|
||||
}),
|
||||
)
|
144
tools/distrib/bazel/tests-shared-BUILD.bazel.in
Normal file
144
tools/distrib/bazel/tests-shared-BUILD.bazel.in
Normal file
@@ -0,0 +1,144 @@
|
||||
# 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("@rules_cc//cc:defs.bzl", "cc_library", "objc_library")
|
||||
|
||||
# Allow access from all //tests packages.
|
||||
package(default_visibility = [
|
||||
"//tests:__subpackages__",
|
||||
])
|
||||
|
||||
#
|
||||
# Source file lists.
|
||||
#
|
||||
|
||||
srcs_common = [
|
||||
${shared_sources_common}
|
||||
]
|
||||
|
||||
srcs_browser = [
|
||||
${shared_sources_browser}
|
||||
]
|
||||
|
||||
srcs_browser_linux = [
|
||||
${shared_sources_linux}
|
||||
]
|
||||
|
||||
srcs_browser_mac = [
|
||||
${shared_sources_mac}
|
||||
]
|
||||
|
||||
srcs_browser_mac_ceftests = [
|
||||
${ceftests_sources_mac_browser_shared}
|
||||
]
|
||||
|
||||
srcs_browser_win = [
|
||||
${shared_sources_win}
|
||||
]
|
||||
|
||||
srcs_renderer = [
|
||||
${shared_sources_renderer}
|
||||
]
|
||||
|
||||
srcs_renderer_mac = [
|
||||
${shared_sources_mac_helper}
|
||||
]
|
||||
|
||||
srcs_renderer_mac_ceftests = [
|
||||
${ceftests_sources_mac_helper_shared}
|
||||
]
|
||||
|
||||
srcs_resources = [
|
||||
${shared_sources_resources}
|
||||
]
|
||||
|
||||
filegroup(
|
||||
name = "Resources",
|
||||
srcs = srcs_resources,
|
||||
)
|
||||
|
||||
#
|
||||
# MacOS targets.
|
||||
#
|
||||
|
||||
objc_library(
|
||||
name = "BrowserLibMac",
|
||||
srcs = srcs_common + srcs_browser + srcs_browser_mac,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:macos",
|
||||
],
|
||||
deps = [
|
||||
"//:cef_wrapper",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "RendererLibMac",
|
||||
srcs = srcs_common + srcs_renderer + srcs_renderer_mac,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:macos",
|
||||
],
|
||||
deps = [
|
||||
"//:cef_wrapper",
|
||||
],
|
||||
)
|
||||
|
||||
# Same as above, but adding additional files for ceftests. This is a workaround
|
||||
# for ceftests including browser and renderer test code in the same cc files.
|
||||
# Needs to be defined here because Bazel disallows direct access to files
|
||||
# outside of the package directory.
|
||||
|
||||
objc_library(
|
||||
name = "BrowserLibMacCefTests",
|
||||
srcs = srcs_browser_mac_ceftests,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:macos",
|
||||
],
|
||||
deps = [
|
||||
"//:cef_wrapper",
|
||||
":BrowserLibMac",
|
||||
],
|
||||
)
|
||||
|
||||
objc_library(
|
||||
name = "RendererLibMacCefTests",
|
||||
srcs = srcs_renderer_mac_ceftests,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:macos",
|
||||
],
|
||||
deps = [
|
||||
"//:cef_wrapper",
|
||||
":RendererLibMac",
|
||||
],
|
||||
)
|
||||
|
||||
#
|
||||
# Windows targets.
|
||||
#
|
||||
|
||||
# Include files directly in the declare_exe target. This simplifies the build
|
||||
# configuration and avoids issues with Windows discarding symbols (like WinMain)
|
||||
# when linking libraries.
|
||||
filegroup(
|
||||
name = "SrcsWin",
|
||||
srcs = srcs_common + srcs_browser + srcs_browser_win + srcs_renderer,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:windows",
|
||||
],
|
||||
)
|
||||
|
||||
#
|
||||
# Linux targets.
|
||||
#
|
||||
|
||||
# Include files directly in the declare_exe target. This simplifies the build
|
||||
# configuration.
|
||||
filegroup(
|
||||
name = "SrcsLinux",
|
||||
srcs = srcs_common + srcs_browser + srcs_browser_linux + srcs_renderer,
|
||||
target_compatible_with = [
|
||||
"@platforms//os:linux",
|
||||
],
|
||||
)
|
||||
|
@@ -1,6 +1,8 @@
|
||||
CONTENTS
|
||||
--------
|
||||
|
||||
bazel Contains Bazel configuration files shared by all targets.
|
||||
|
||||
cmake Contains CMake configuration files shared by all targets.
|
||||
|
||||
include Contains all required CEF header files.
|
||||
@@ -23,6 +25,11 @@ Building using CMake:
|
||||
CMake can be used to generate project files in many different formats. See
|
||||
usage instructions at the top of the CMakeLists.txt file.
|
||||
|
||||
Building using Bazel:
|
||||
Bazel can be used to build CEF-based applications. CEF support for Bazel is
|
||||
considered experimental. For current development status see
|
||||
https://github.com/chromiumembedded/cef/issues/3757.
|
||||
|
||||
Please visit the CEF Website for additional usage information.
|
||||
|
||||
https://bitbucket.org/chromiumembedded/cef/
|
||||
|
@@ -1,6 +1,8 @@
|
||||
CONTENTS
|
||||
--------
|
||||
|
||||
bazel Contains Bazel configuration files shared by all targets.
|
||||
|
||||
cmake Contains CMake configuration files shared by all targets.
|
||||
|
||||
Debug Contains libcef.so and other components required to run the debug
|
||||
@@ -47,6 +49,28 @@ Building using CMake:
|
||||
CMake can be used to generate project files in many different formats. See
|
||||
usage instructions at the top of the CMakeLists.txt file.
|
||||
|
||||
Building using Bazel:
|
||||
Bazel can be used to build CEF-based applications. CEF support for Bazel is
|
||||
considered experimental. For current development status see
|
||||
https://github.com/chromiumembedded/cef/issues/3757.
|
||||
|
||||
To build the bundled cefclient sample application using Bazel:
|
||||
|
||||
1. Install Bazelisk [https://github.com/bazelbuild/bazelisk/blob/master/README.md]
|
||||
2. Install the patchelf package:
|
||||
$ sudo apt install patchelf
|
||||
3. Build using Bazel:
|
||||
$ bazel build //tests/cefclient
|
||||
4. Run using Bazel:
|
||||
$ bazel run //tests/cefclient
|
||||
|
||||
Other sample applications (cefsimple, ceftests) can be built in the same way.
|
||||
|
||||
Additional notes:
|
||||
- To generate a Debug build add `-c dbg` (both `build` and `run`
|
||||
command-line).
|
||||
- To pass arguments using the `run` command add `-- [...]` at the end.
|
||||
|
||||
Please visit the CEF Website for additional usage information.
|
||||
|
||||
https://bitbucket.org/chromiumembedded/cef/
|
||||
|
@@ -1,6 +1,8 @@
|
||||
CONTENTS
|
||||
--------
|
||||
|
||||
bazel Contains Bazel configuration files shared by all targets.
|
||||
|
||||
cmake Contains CMake configuration files shared by all targets.
|
||||
|
||||
include Contains all required CEF header files.
|
||||
@@ -20,6 +22,11 @@ Building using CMake:
|
||||
CMake can be used to generate project files in many different formats. See
|
||||
usage instructions at the top of the CMakeLists.txt file.
|
||||
|
||||
Building using Bazel:
|
||||
Bazel can be used to build CEF-based applications. CEF support for Bazel is
|
||||
considered experimental. For current development status see
|
||||
https://github.com/chromiumembedded/cef/issues/3757.
|
||||
|
||||
Please visit the CEF Website for additional usage information.
|
||||
|
||||
https://bitbucket.org/chromiumembedded/cef/
|
||||
|
@@ -6,7 +6,7 @@ the "required" section must be redistributed with all applications using CEF.
|
||||
Components listed under the "optional" section may be excluded if the related
|
||||
features will not be used.
|
||||
|
||||
Applications using CEF on OS X must follow a specific app bundle structure.
|
||||
Applications using CEF on MacOS must follow a specific app bundle structure.
|
||||
Replace "cefclient" in the below example with your application name.
|
||||
|
||||
cefclient.app/
|
||||
|
@@ -1,6 +1,8 @@
|
||||
CONTENTS
|
||||
--------
|
||||
|
||||
bazel Contains Bazel configuration files shared by all targets.
|
||||
|
||||
cmake Contains CMake configuration files shared by all targets.
|
||||
|
||||
Debug Contains the "Chromium Embedded Framework.framework" and other
|
||||
@@ -41,6 +43,30 @@ Building using CMake:
|
||||
CMake can be used to generate project files in many different formats. See
|
||||
usage instructions at the top of the CMakeLists.txt file.
|
||||
|
||||
Building using Bazel:
|
||||
Bazel can be used to build CEF-based applications. CEF support for Bazel is
|
||||
considered experimental. For current development status see
|
||||
https://github.com/chromiumembedded/cef/issues/3757.
|
||||
|
||||
To build the bundled cefclient sample application using Bazel:
|
||||
|
||||
1. Install Bazelisk [https://github.com/bazelbuild/bazelisk/blob/master/README.md]
|
||||
2. Build using Bazel:
|
||||
$ bazel build //tests/cefclient
|
||||
3. Run using Bazel:
|
||||
$ bazel run //tests/cefclient
|
||||
|
||||
Other sample applications (cefsimple, ceftests) can be built in the same way.
|
||||
|
||||
Additional notes:
|
||||
- To generate a Debug build add `-c dbg` (both `build` and `run`
|
||||
command-line).
|
||||
- To generate an Intel 64-bit cross-compile build on an ARM64 host add
|
||||
`--cpu=darwin_x86_64` (both `build` and `run` command-line).
|
||||
- To generate an ARM64 cross-compile build on an Intel 64-bit host add
|
||||
`--cpu=darwin_arm64` (both `build` and `run` command-line).
|
||||
- To pass arguments using the `run` command add `-- [...]` at the end.
|
||||
|
||||
Please visit the CEF Website for additional usage information.
|
||||
|
||||
https://bitbucket.org/chromiumembedded/cef/
|
||||
|
@@ -1,6 +1,8 @@
|
||||
CONTENTS
|
||||
--------
|
||||
|
||||
bazel Contains Bazel configuration files shared by all targets.
|
||||
|
||||
cmake Contains CMake configuration files shared by all targets.
|
||||
|
||||
include Contains all required CEF header files.
|
||||
@@ -24,6 +26,11 @@ Building using CMake:
|
||||
CMake can be used to generate project files in many different formats. See
|
||||
usage instructions at the top of the CMakeLists.txt file.
|
||||
|
||||
Building using Bazel:
|
||||
Bazel can be used to build CEF-based applications. CEF support for Bazel is
|
||||
considered experimental. For current development status see
|
||||
https://github.com/chromiumembedded/cef/issues/3757.
|
||||
|
||||
Please visit the CEF Website for additional usage information.
|
||||
|
||||
https://bitbucket.org/chromiumembedded/cef/
|
||||
|
@@ -1,6 +1,8 @@
|
||||
CONTENTS
|
||||
--------
|
||||
|
||||
bazel Contains Bazel configuration files shared by all targets.
|
||||
|
||||
cmake Contains CMake configuration files shared by all targets.
|
||||
|
||||
Debug Contains libcef.dll, libcef.lib and other components required to
|
||||
@@ -47,6 +49,28 @@ Building using CMake:
|
||||
CMake can be used to generate project files in many different formats. See
|
||||
usage instructions at the top of the CMakeLists.txt file.
|
||||
|
||||
Building using Bazel:
|
||||
Bazel can be used to build CEF-based applications. CEF support for Bazel is
|
||||
considered experimental. For current development status see
|
||||
https://github.com/chromiumembedded/cef/issues/3757.
|
||||
|
||||
To build the bundled cefclient sample application using Bazel:
|
||||
|
||||
1. Install Bazelisk [https://github.com/bazelbuild/bazelisk/blob/master/README.md]
|
||||
2. Build using Bazel:
|
||||
$ bazel build //tests/cefclient
|
||||
3. Run using Bazel:
|
||||
$ bazel run //tests/cefclient/win:cefclient.exe
|
||||
|
||||
Other sample applications (cefsimple, ceftests) can be built in the same way.
|
||||
|
||||
Additional notes:
|
||||
- To generate a Debug build add `-c dbg` (both `build` and `run`
|
||||
command-line).
|
||||
- To pass arguments using the `run` command add `-- [...]` at the end.
|
||||
- Windows x86 and ARM64 builds using Bazel may be broken, see
|
||||
https://github.com/bazelbuild/bazel/issues/22164.
|
||||
|
||||
Please visit the CEF Website for additional usage information.
|
||||
|
||||
https://bitbucket.org/chromiumembedded/cef/
|
||||
|
@@ -12,14 +12,14 @@
|
||||
[
|
||||
{
|
||||
'source' : '../build/win/compatibility.manifest',
|
||||
'target' : 'tests/cefclient/resources/win/compatibility.manifest',
|
||||
'target' : 'tests/cefclient/win/compatibility.manifest',
|
||||
},
|
||||
{
|
||||
'source' : '../build/win/compatibility.manifest',
|
||||
'target' : 'tests/cefsimple/compatibility.manifest',
|
||||
'target' : 'tests/cefsimple/win/compatibility.manifest',
|
||||
},
|
||||
{
|
||||
'source' : '../build/win/compatibility.manifest',
|
||||
'target' : 'tests/ceftests/resources/win/compatibility.manifest',
|
||||
'target' : 'tests/ceftests/win/compatibility.manifest',
|
||||
},
|
||||
]
|
||||
|
@@ -4,6 +4,7 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
from bazel_util import bazel_substitute, bazel_last_error, bazel_set_quiet
|
||||
from cef_version import VersionFormatter
|
||||
from date_util import *
|
||||
from exec_util import exec_cmd
|
||||
@@ -357,6 +358,64 @@ def transfer_tools_files(script_dir, build_dirs, output_dir):
|
||||
copy_files_list(os.path.join(script_dir, 'distrib', 'tools'), output_dir, files)
|
||||
|
||||
|
||||
def copy_bazel_file_with_substitution(path, target_path, variables, relative_path):
|
||||
data = read_file(path)
|
||||
bazel_set_quiet(True)
|
||||
result = bazel_substitute(data, variables, path_relative_to=relative_path, label=path)
|
||||
last_error = bazel_last_error()
|
||||
bazel_set_quiet(False)
|
||||
if not last_error is None:
|
||||
raise Exception(last_error)
|
||||
if not options.quiet:
|
||||
sys.stdout.write('Writing %s file.\n' % target_path)
|
||||
write_file(target_path, result)
|
||||
|
||||
|
||||
def transfer_bazel_files(bazel_dir, output_dir, variables, require_parent_dir):
|
||||
# All input files.
|
||||
bazel_files = get_files(os.path.join(bazel_dir, '*')) + get_files(os.path.join(bazel_dir, '.*'))
|
||||
|
||||
# Map of path component to required platform.
|
||||
platform_map = {
|
||||
'linux': 'linux',
|
||||
'mac': 'mac',
|
||||
'win': 'windows',
|
||||
}
|
||||
|
||||
for path in bazel_files:
|
||||
name = os.path.split(path)[1]
|
||||
|
||||
# |name| uses hyphens to indicate directory components.
|
||||
directory_parts = name.split('-')[:-1]
|
||||
|
||||
# Skip files that don't apply for the current platform.
|
||||
skip = False
|
||||
for part in directory_parts:
|
||||
if part in platform_map and platform_map[part] != platform:
|
||||
skip = True
|
||||
break
|
||||
if skip:
|
||||
sys.stdout.write('Skipping %s file.\n' % path)
|
||||
continue
|
||||
|
||||
target_path = os.path.join(output_dir, name.replace('-', '/'))
|
||||
target_dir = os.path.split(target_path)[0]
|
||||
if not os.path.isdir(target_dir):
|
||||
parent_dir = os.path.split(target_dir)[0]
|
||||
if not os.path.isdir(parent_dir) and require_parent_dir:
|
||||
# Don't write tests/* files if the tests/ directory is missing.
|
||||
sys.stdout.write('Skipping %s file.\n' % path)
|
||||
continue
|
||||
make_dir(target_dir)
|
||||
if target_path.endswith('.in'):
|
||||
# Copy with variable substitution.
|
||||
relative_path = '/'.join(directory_parts)
|
||||
copy_bazel_file_with_substitution(path, target_path[:-3], variables, relative_path)
|
||||
else:
|
||||
# Copy as-is.
|
||||
copy_file(path, target_path, options.quiet)
|
||||
|
||||
|
||||
def normalize_headers(file, new_path=''):
|
||||
""" Normalize headers post-processing. Remove the path component from any
|
||||
project include directives. """
|
||||
@@ -623,6 +682,12 @@ parser.add_option(
|
||||
dest='noarchive',
|
||||
default=False,
|
||||
help='don\'t create archives for output directories')
|
||||
parser.add_option(
|
||||
'--no-sandbox',
|
||||
action='store_true',
|
||||
dest='nosandbox',
|
||||
default=False,
|
||||
help='don\'t create cef_sandbox files')
|
||||
parser.add_option(
|
||||
'--ninja-build',
|
||||
action='store_true',
|
||||
@@ -751,9 +816,9 @@ chromium_rev = git.get_hash(src_dir)
|
||||
date = get_date()
|
||||
|
||||
# format version strings
|
||||
formatter = VersionFormatter()
|
||||
cef_ver = formatter.get_version_string()
|
||||
chromium_ver = formatter.get_chromium_version_string()
|
||||
version_formatter = VersionFormatter()
|
||||
cef_ver = version_formatter.get_version_string()
|
||||
chromium_ver = version_formatter.get_chromium_version_string()
|
||||
|
||||
# list of output directories to be archived
|
||||
archive_dirs = []
|
||||
@@ -1084,7 +1149,7 @@ elif platform == 'windows':
|
||||
|
||||
# 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'):
|
||||
if mode in ('standard', 'minimal', 'sandbox') and not options.nosandbox:
|
||||
dirs = {
|
||||
'Debug': (build_dir_debug + '_sandbox', build_dir_debug),
|
||||
'Release': (build_dir_release + '_sandbox', build_dir_release)
|
||||
@@ -1162,21 +1227,21 @@ elif platform == 'windows':
|
||||
'tests/shared/', shared_dir, options.quiet)
|
||||
|
||||
# transfer cefclient files
|
||||
transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_win'], \
|
||||
'tests/cefclient/', cefclient_dir, options.quiet)
|
||||
transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_resources_win'], \
|
||||
transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_win'] +
|
||||
cef_paths2['cefclient_sources_resources_win'] +
|
||||
cef_paths2['cefclient_sources_resources_win_rc'],
|
||||
'tests/cefclient/', cefclient_dir, options.quiet)
|
||||
|
||||
# transfer cefsimple files
|
||||
transfer_gypi_files(cef_dir, cef_paths2['cefsimple_sources_win'], \
|
||||
'tests/cefsimple/', cefsimple_dir, options.quiet)
|
||||
transfer_gypi_files(cef_dir, cef_paths2['cefsimple_sources_resources_win'], \
|
||||
transfer_gypi_files(cef_dir, cef_paths2['cefsimple_sources_win'] +
|
||||
cef_paths2['cefsimple_sources_resources_win'] +
|
||||
cef_paths2['cefsimple_sources_resources_win_rc'],
|
||||
'tests/cefsimple/', cefsimple_dir, options.quiet)
|
||||
|
||||
# transfer ceftests files
|
||||
transfer_gypi_files(cef_dir, cef_paths2['ceftests_sources_win'], \
|
||||
'tests/ceftests/', ceftests_dir, options.quiet)
|
||||
transfer_gypi_files(cef_dir, cef_paths2['ceftests_sources_resources_win'], \
|
||||
transfer_gypi_files(cef_dir, cef_paths2['ceftests_sources_win'] +
|
||||
cef_paths2['ceftests_sources_resources_win'] +
|
||||
cef_paths2['ceftests_sources_resources_win_rc'],
|
||||
'tests/ceftests/', ceftests_dir, options.quiet)
|
||||
|
||||
elif platform == 'mac':
|
||||
@@ -1201,7 +1266,7 @@ elif platform == 'mac':
|
||||
|
||||
# Generate the cef_sandbox.a merged library. A separate *_sandbox build
|
||||
# should exist when GN is_official_build=true.
|
||||
if mode in ('standard', 'minimal', 'sandbox'):
|
||||
if mode in ('standard', 'minimal', 'sandbox') and not options.nosandbox:
|
||||
dirs = {
|
||||
'Debug': (build_dir_debug + '_sandbox', build_dir_debug),
|
||||
'Release': (build_dir_release + '_sandbox', build_dir_release)
|
||||
@@ -1314,9 +1379,9 @@ elif platform == 'mac':
|
||||
transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_mac'], \
|
||||
'tests/cefclient/', cefclient_dir, options.quiet)
|
||||
|
||||
# transfer cefclient/resources/mac files
|
||||
copy_dir(os.path.join(cef_dir, 'tests/cefclient/resources/mac'), \
|
||||
os.path.join(cefclient_dir, 'resources/mac'), \
|
||||
# transfer cefclient/mac files
|
||||
copy_dir(os.path.join(cef_dir, 'tests/cefclient/mac'), \
|
||||
os.path.join(cefclient_dir, 'mac'), \
|
||||
options.quiet)
|
||||
|
||||
# transfer cefsimple files
|
||||
@@ -1336,9 +1401,9 @@ elif platform == 'mac':
|
||||
transfer_gypi_files(cef_dir, cef_paths2['ceftests_sources_mac_helper'], \
|
||||
'tests/ceftests/', ceftests_dir, options.quiet)
|
||||
|
||||
# transfer ceftests/resources/mac files
|
||||
copy_dir(os.path.join(cef_dir, 'tests/ceftests/resources/mac'), \
|
||||
os.path.join(ceftests_dir, 'resources/mac'), \
|
||||
# transfer ceftests/mac files
|
||||
copy_dir(os.path.join(cef_dir, 'tests/ceftests/mac'), \
|
||||
os.path.join(ceftests_dir, 'mac'), \
|
||||
options.quiet)
|
||||
|
||||
elif platform == 'linux':
|
||||
@@ -1433,6 +1498,24 @@ elif platform == 'linux':
|
||||
transfer_gypi_files(cef_dir, cef_paths2['ceftests_sources_linux'], \
|
||||
'tests/ceftests/', ceftests_dir, options.quiet)
|
||||
|
||||
if mode == 'standard' or mode == 'minimal':
|
||||
variables = {
|
||||
'version_long': version_formatter.get_version_string(),
|
||||
'version_short': version_formatter.get_short_version_string(),
|
||||
'version_plist': version_formatter.get_plist_version_string(),
|
||||
}
|
||||
variables.update(cef_paths2)
|
||||
|
||||
copy_dir(
|
||||
os.path.join(cef_dir, 'bazel'),
|
||||
os.path.join(output_dir, 'bazel'), options.quiet)
|
||||
|
||||
transfer_bazel_files(
|
||||
os.path.join(script_dir, 'distrib', 'bazel'),
|
||||
output_dir,
|
||||
variables,
|
||||
require_parent_dir=(mode != 'standard'))
|
||||
|
||||
if not options.noarchive:
|
||||
# create an archive for each output directory
|
||||
archive_format = os.getenv('CEF_ARCHIVE_FORMAT', 'zip')
|
||||
|
Reference in New Issue
Block a user