-
Notifications
You must be signed in to change notification settings - Fork 467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Bazel config for building CEF binary distribution #3757
Comments
Initial Bazel support is considered complete (working) in version Building with Bazel works as follows:
Platform-specific instructions are included in the binary distribution See cef-project for an example Bazel project that utilizes the CEF binary distribution as an external dependency. Notes:
|
In-progress PR: https://bitbucket.org/chromiumembedded/cef/pull-requests/786 |
Remaining work:
Related to C++ compiler/toolchain configuration:
|
(For background see https://bazel.build/external/overview) The http_archive rule allows us to download an archive file, and optionally override the associated BUILD and/or WORKSPACE file. We'll need a convenient way to collect download URLs and |
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 bazelbuild/bazel#22164. Includes minor changes to tests directory structure to meet Bazel build requirements.
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 bazelbuild/bazel#22164. Includes minor changes to tests directory structure to meet Bazel build requirements.
The Spotify builder now provides |
Unfortunately this approach has a number of limitations. For example:
We will therefore provide a separate script for downloading the CEF binary distribution and writing a
|
Here's an example of this approach for future reference:
|
There's also a middle ground where the script writes the platform but Bazel still performs the download:
|
Unqualified target labels don't resolve correctly when the disribution is loaded as an external repo. Mapping, if necessary, can be performed using the `repo_mapping` parameter to http_archive() or local_repository().
Unqualified target labels don't resolve correctly when the disribution is loaded as an external repo. Mapping, if necessary, can be performed using the `repo_mapping` parameter to http_archive() or local_repository().
Unqualified target labels don't resolve correctly when the disribution is loaded as an external repo. Mapping, if necessary, can be performed using the `repo_mapping` parameter to http_archive() or local_repository().
- Headers that are included by .rc files need to be supplied to `declare_exe` via the `resources_deps` attribute (passed as the `deps attribute to `compile_rc`). The headers must be part of a cc_library target via either the `hdrs` or `srcs` attribute. - File paths for CEF resources are prefixed with "external/<repo>" when CEF is loaded as an external repo. Update `copy_filegroups` to work with these paths.
- Headers that are included by .rc files need to be supplied to `declare_exe` via the `resources_deps` attribute (passed as the `deps attribute to `compile_rc`). The headers must be part of a cc_library target via either the `hdrs` or `srcs` attribute. - File paths for CEF resources are prefixed with "external/<repo>" when CEF is loaded as an external repo. Update `copy_filegroups` to work with these paths.
- Headers that are included by .rc files need to be supplied to `declare_exe` via the `resources_deps` attribute (passed as the `deps attribute to `compile_rc`). The headers must be part of a cc_library target via either the `hdrs` or `srcs` attribute. - File paths for CEF resources are prefixed with "external/<repo>" when CEF is loaded as an external repo. Update `copy_filegroups` to work with these paths.
Bazel can be used to build CEF-based applications. CEF support for Bazel is considered experimental. For current development status see chromiumembedded/cef#3757 . For updated build and usage instructions see the README.md.
Bazel build support has been added to cef-project, see instructions. |
Fixes "file not found with <angled> include" errors.
Fixes "file not found with <angled> include" errors.
Fixes "file not found with <angled> include" errors.
- 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.
- 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.
- 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.
Copy the CEF framework into the app bundle but do not link it. See https://groups.google.com/g/cef-announce/c/Fith0A3kWtw/m/6ds_mJVMCQAJ for background. Use `**kwargs` to pass all other arguments to the actual `macos_application` target declaration.
Copy the CEF framework into the app bundle but do not link it. See https://groups.google.com/g/cef-announce/c/Fith0A3kWtw/m/6ds_mJVMCQAJ for background. Use `**kwargs` to pass all other arguments to the actual `macos_application` target declaration.
Copy the CEF framework into the app bundle but do not link it. See https://groups.google.com/g/cef-announce/c/Fith0A3kWtw/m/6ds_mJVMCQAJ for background. Use `**kwargs` to pass all other arguments to the actual `macos_application` target declaration.
The Bazel
CEF provides Debug and Release configs. CEF currently treats We therefore recommend that users avoid |
We may revisit the cc_import shared_library config that currently copies libcef.dll as a transitive dependency. This seems to cause issues with complex dependency graphs, and it may be better to instead explicitly link libcef.lib and explicitly copy libcef.dll. |
Using cc_import + interface_library/shared_library to link libcef.lib causes libcef.dll to be copied as a transitive dependency, leading to issues with complex Bazel configs. Instead, we explicitly link libcef.lib in the binary target (cc_binary + linkopts/additional_linker_inputs) and explicitly copy libcef.dll to the target directory.
Is your feature request related to a problem? Please describe.
Bazel is a popular alternative to CMake for building applications. We should provide sample configurations for Bazel as part of the CEF binary distribution.
Describe the solution you'd like
Build the CEF sample apps in a binary distribution using Bazel and the default platform toolchain.
Additional context
Bazel default platform toolchains are tested to work for Windows x64, MacOS ARM64 and x64 (cross-compile from ARM64), and Linux x64. They are known to be broken for Windows x86 (cross-compile from x64). Other platforms/architectures are untested and may require custom toolchain definitions (Linux examples here).
The text was updated successfully, but these errors were encountered: