2016-12-12 11:05:29 +01:00
|
|
|
# Copyright 2016 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.
|
|
|
|
|
|
|
|
import("//build/buildflag_header.gni")
|
|
|
|
import("//cef/libcef/features/features.gni")
|
|
|
|
|
|
|
|
# This file is in a separate directory so all targets in the build can refer to
|
|
|
|
# the buildflag header to get the necessary preprocessor defines without
|
|
|
|
# bringing in any CEF targets. Other targets can depend on this target
|
2017-12-07 22:44:24 +01:00
|
|
|
# regardless of whether CEF is being built. Set the `enable_cef=false` GN arg to
|
|
|
|
# disable the CEF changes when building Chrome.
|
|
|
|
#
|
|
|
|
# Example usage:
|
|
|
|
#
|
|
|
|
# 1. An existing GN configuration file at path/to/foo/BUILD.gn:
|
|
|
|
#
|
|
|
|
# # Import the `enable_cef` arg.
|
|
|
|
# import("//cef/libcef/features/features.gni")
|
|
|
|
# ...
|
|
|
|
#
|
|
|
|
# # An existing target that is modified for CEF.
|
|
|
|
# # The target type might instead be `component`, `source_set`, etc.
|
|
|
|
# static_library("foo") {
|
|
|
|
# sources = [ ... ]
|
|
|
|
#
|
|
|
|
# deps = [
|
|
|
|
# # Always include the CEF features.
|
|
|
|
# "//cef/libcef/features",
|
|
|
|
# ...
|
|
|
|
# ]
|
|
|
|
#
|
|
|
|
# if (enable_cef) {
|
|
|
|
# # Actions to perform when the CEF build is enabled.
|
|
|
|
#
|
|
|
|
# # Optionally include CEF source files directly in this target. This
|
|
|
|
# # approach is required for targets that are either directly or
|
|
|
|
# # indirectly included in a `component` target (otherwise
|
|
|
|
# # `is_component_build=true` builds will fail). Keep in mind that these
|
|
|
|
# # files are part of this target instead of the `libcef_static` target
|
|
|
|
# # and therefore subject to any target-specific configuration settings
|
|
|
|
# # such as include paths, defines, compiler flags, etc.
|
|
|
|
# sources += [
|
|
|
|
# "//cef/libcef/browser/foo_helper.cc",
|
|
|
|
# "//cef/libcef/browser/foo_helper.h",
|
|
|
|
# ]
|
|
|
|
#
|
|
|
|
# # Always include the CEF configuration.
|
|
|
|
# configs += [ "//cef/libcef/features:config" ]
|
|
|
|
# }
|
|
|
|
# ...
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
# 2. An existing C++ source file at path/to/foo/foo.cc:
|
|
|
|
#
|
|
|
|
# // Include the `BUILDFLAG(ENABLE_CEF)` definition.
|
|
|
|
# #include "cef/libcef/features/features.h"
|
|
|
|
# ...
|
|
|
|
#
|
|
|
|
# #if BUILDFLAG(ENABLE_CEF)
|
|
|
|
# // CEF headers here...
|
|
|
|
# #include "cef/libcef/browser/foo_helper.h"
|
|
|
|
# #else
|
|
|
|
# // Chrome headers here...
|
|
|
|
# #endif
|
|
|
|
#
|
|
|
|
# // An existing function that is modified for CEF.
|
|
|
|
# void DoFoo() {
|
|
|
|
# #if BUILDFLAG(ENABLE_CEF)
|
|
|
|
# // CEF implementation here...
|
|
|
|
# cef_foo_helper::DoFoo();
|
|
|
|
# #else
|
|
|
|
# // Chrome implementation here...
|
|
|
|
# #endif // !BUILDFLAG(ENABLE_CEF)
|
|
|
|
# }
|
|
|
|
# ...
|
|
|
|
#
|
2016-12-12 11:05:29 +01:00
|
|
|
|
|
|
|
buildflag_header("features") {
|
|
|
|
header = "features.h"
|
|
|
|
|
|
|
|
flags = [
|
2024-04-30 03:09:17 +02:00
|
|
|
"ENABLE_ALLOY_BOOTSTRAP=$enable_alloy_bootstrap",
|
2016-12-12 11:05:29 +01:00
|
|
|
"ENABLE_CEF=$enable_cef",
|
2019-10-01 13:30:07 +02:00
|
|
|
"IS_CEF_SANDBOX_BUILD=$is_cef_sandbox_build",
|
2016-12-12 11:05:29 +01:00
|
|
|
]
|
|
|
|
}
|
2017-12-07 22:44:24 +01:00
|
|
|
|
|
|
|
# Configuration for all targets that include CEF source code library-side.
|
2024-04-30 18:03:59 +02:00
|
|
|
# See //cef/libcef_includes_config for CEF client-side configuration.
|
2017-12-07 22:44:24 +01:00
|
|
|
config("config") {
|
2022-02-08 19:12:52 +01:00
|
|
|
include_dirs = [
|
2024-04-30 18:03:59 +02:00
|
|
|
# cef/include/ directory uses #includes relative to the cef/ directory.
|
2022-02-08 19:12:52 +01:00
|
|
|
"//cef",
|
|
|
|
|
2024-04-30 18:03:59 +02:00
|
|
|
# CEF generated header files that also need to be discoverable.
|
|
|
|
# These #includes from library-side code will always be prefixed with cef/.
|
2022-02-09 22:52:26 +01:00
|
|
|
"$root_build_dir/includes",
|
2022-02-08 19:12:52 +01:00
|
|
|
]
|
2017-12-07 22:44:24 +01:00
|
|
|
defines = [
|
|
|
|
"BUILDING_CEF_SHARED",
|
|
|
|
"USING_CHROMIUM_INCLUDES",
|
|
|
|
]
|
|
|
|
}
|