libchromiumcontent/chromiumcontent/BUILD.gn

341 строка
8.5 KiB
Plaintext

import("//build/split_static_library.gni")
group("targets") {
deps = []
# Build these targets when building libchromiumcontent's
# "static_library" or "shared_library"
if (is_electron_build) {
deps += [
"//components/prefs",
"//components/cdm/renderer",
"//components/cookie_config",
"//components/security_state/content",
"//components/security_state/core",
"//content",
"//content:sandbox_helper_win",
"//content/public/app:both",
"//content/shell:pak",
"//content/shell:copy_shell_resources",
"//pdf",
"//ppapi/cpp",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/shared_impl",
"//net:net_with_v8",
"//third_party/libyuv",
"//third_party/webrtc/modules/desktop_capture",
"//third_party/widevine/cdm:headers",
"//third_party/widevine/cdm:widevinecdmadapter",
"//ui/content_accelerators",
"//ui/display",
"//ui/display/util",
"//ui/latency",
"//ui/views",
"//ui/views/controls/webview",
]
if (is_linux) {
deps += [ "//chrome/browser/ui/libgtkui:libgtk3ui" ]
}
if (is_component_build) {
deps += [
":desktop_capture",
":fx_agg",
":fx_lcms2",
":fx_libopenjpeg",
":fx_zlib",
":libjpeg",
":libyuv",
":ppapi_cpp_objects",
":ppapi_internal_module",
":security_state",
":system_wrappers",
":webrtc_common",
]
if (is_linux) {
deps += [ ":libgtkui" ]
}
if (is_win) {
deps += [ ":sandbox_helper_win" ]
}
}
}
# These produce executables we distribute as part of libchromiumcontent.
# Statically linked versions of them are built correctly only when the build
# configuration is not tweaked for the purposes of statically linked
# Electron.
if (!is_electron_build || is_component_build) {
deps += [
"//chrome/test/chromedriver",
"//v8",
]
}
# We build FFMPEG separately in the default non-component configuration
if (!is_electron_build && !is_component_build) {
deps += [ "//third_party/ffmpeg" ]
}
}
if (is_electron_build && is_component_build) {
# Electron needs some APIs which are not exported from shared libraries
# produced by a component build. So we put a copy of the needed symbols in
# this set of static libraries. Most can just depend on the respective
# source_set target.
static_library("desktop_capture") {
complete_static_lib = true
deps = [ "//third_party/webrtc/modules/desktop_capture" ]
}
static_library("fx_agg") {
complete_static_lib = true
deps = [ "//third_party/pdfium/third_party:fx_agg" ]
}
static_library("fx_lcms2") {
complete_static_lib = true
deps = [ "//third_party/pdfium/third_party:fx_lcms2" ]
}
static_library("fx_libopenjpeg") {
complete_static_lib = true
deps = [ "//third_party/pdfium/third_party:fx_libopenjpeg" ]
}
static_library("fx_zlib") {
complete_static_lib = true
deps = [ "//third_party/zlib:zlib" ]
}
static_library("libjpeg") {
complete_static_lib = true
deps = [ "//third_party:jpeg" ]
}
static_library("libyuv") {
complete_static_lib = true
deps = [ "//third_party/libyuv" ]
}
static_library("ppapi_cpp_objects") {
complete_static_lib = true
deps = [ "//ppapi/cpp:objects" ]
}
static_library("ppapi_internal_module") {
complete_static_lib = true
deps = [ "//ppapi/cpp/private:internal_module" ]
}
static_library("security_state") {
complete_static_lib = true
deps = [
"//components/security_state/content",
"//components/security_state/core",
]
}
static_library("system_wrappers") {
complete_static_lib = true
deps = [ "//third_party/webrtc/system_wrappers" ]
}
static_library("webrtc_common") {
complete_static_lib = true
deps = [ "//third_party/webrtc:webrtc_common" ]
}
if (is_linux) {
# The original libgtkui target is a shared library, so we must list
# the object files instead of just depending on it.
static_library("libgtkui") {
complete_static_lib = true
sources = [
"$root_out_dir/obj/chrome/browser/ui/libgtkui/libgtk3ui/app_indicator_icon.o",
"$root_out_dir/obj/chrome/browser/ui/libgtkui/libgtk3ui/app_indicator_icon_menu.o",
"$root_out_dir/obj/chrome/browser/ui/libgtkui/libgtk3ui/gtk_util.o",
"$root_out_dir/obj/chrome/browser/ui/libgtkui/libgtk3ui/gtk_status_icon.o",
"$root_out_dir/obj/chrome/browser/ui/libgtkui/libgtk3ui/menu_util.o",
"$root_out_dir/obj/chrome/browser/ui/libgtkui/libgtk3ui/skia_utils_gtk.o",
"$root_out_dir/obj/chrome/browser/ui/libgtkui/libgtk3ui/unity_service.o",
]
}
}
if (is_win) {
static_library("sandbox_helper_win") {
complete_static_lib = true
deps = [ "//content:sandbox_helper_win" ]
}
}
}
if (is_electron_build && !is_component_build) {
# This is where we build statically linked libchromiumcontent.
# After all dependent targets are built, we use a script to collect
# all required object files into an "objects.gni" file and re-run
# ninja. Because "objects.gni" is a GN input file, it will cause it
# to re-generate the targets and produce the static libraries we want.
is_second_pass = (getenv("CHROMIUMCONTENT_2ND_PASS") != "")
# Make sure the .gni file exists, otherwise it cannot be imported
if (!is_second_pass) {
write_file("$target_out_dir/objects.gni", "")
}
import("$target_out_dir/objects.gni")
action("chromiumcontent") {
outputs = [ "$target_out_dir/build_libs.done" ]
script = "build_libs.py"
args = [ "-o", rebase_path("$target_out_dir/objects.gni"),
"-s", rebase_path(outputs[0]),
"-t", target_cpu ]
deps = [ ":targets" ]
}
# Normally we would just put everything in a single library plus V8. But
# toolchains have various limitations that we would hit - e.g. MSVC cannot
# produce a .lib file bigger than 4 GB, LLVM has a limit on the number of
# object files on the command line. So we produce multiple libraries.
group("libs") {
if (is_second_pass) {
deps = [
":libchromiumcontent",
":base",
":cc",
":components",
":ppapi",
":media",
":net",
":services",
":skia",
":angle",
":pdfium",
":webkit",
":webkitcore",
":webkitbindings",
":webkitmodules",
":webrtc",
":v8",
":v8base",
]
}
}
if (is_second_pass) {
static_library("libchromiumcontent") {
complete_static_lib = true
sources = obj_libchromiumcontent
}
static_library("base") {
complete_static_lib = true
sources = obj_base
}
static_library("cc") {
complete_static_lib = true
sources = obj_cc
}
static_library("components") {
complete_static_lib = true
sources = obj_components
}
static_library("ppapi") {
complete_static_lib = true
sources = obj_ppapi
}
static_library("media") {
complete_static_lib = true
sources = obj_media
}
static_library("net") {
complete_static_lib = true
sources = obj_net
}
static_library("services") {
complete_static_lib = true
sources = obj_services
}
static_library("skia") {
complete_static_lib = true
sources = obj_skia
}
static_library("angle") {
complete_static_lib = true
sources = obj_angle
}
static_library("pdfium") {
complete_static_lib = true
sources = obj_pdfium
}
static_library("webkit") {
complete_static_lib = true
sources = obj_webkit
}
static_library("webkitbindings") {
complete_static_lib = true
sources = obj_webkitbindings
}
static_library("webkitcore") {
complete_static_lib = true
sources = obj_webkitcore
}
static_library("webkitmodules") {
complete_static_lib = true
sources = obj_webkitmodules
}
static_library("webrtc") {
complete_static_lib = true
sources = obj_webrtc
}
static_library("v8") {
complete_static_lib = true
sources = obj_v8
}
split_static_library("v8base") {
complete_static_lib = true
sources = obj_v8base
if (is_win) {
split_count = 2
} else {
split_count = 1
}
}
}
} else {
group("chromiumcontent") {
deps = [ ":targets" ]
}
}