cef/libcef/features/BUILD.gn

105 lines
3.3 KiB
Plaintext
Raw Normal View History

# 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
# 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)
# }
# ...
#
buildflag_header("features") {
header = "features.h"
flags = [
"ENABLE_ALLOY_BOOTSTRAP=$enable_alloy_bootstrap",
"ENABLE_CEF=$enable_cef",
"IS_CEF_SANDBOX_BUILD=$is_cef_sandbox_build",
]
}
# Configuration for all targets that include CEF source code library-side.
# See //cef/libcef_includes_config for CEF client-side configuration.
config("config") {
include_dirs = [
# cef/include/ directory uses #includes relative to the cef/ directory.
"//cef",
# CEF generated header files that also need to be discoverable.
# These #includes from library-side code will always be prefixed with cef/.
"$root_build_dir/includes",
]
defines = [
"BUILDING_CEF_SHARED",
"USING_CHROMIUM_INCLUDES",
]
}