blob: bbede00daa4d09cdfc4a5a11220b02551387b81b [file] [log] [blame]
# Copyright 2022 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromecast_build.gni")
import("//build/config/linux/pkg_config.gni")
import("//build/config/sysroot.gni")
import("//ui/qt/qt.gni")
assert(use_qt)
assert(is_linux)
assert(!is_castos)
pkg_config("qt5_config") {
packages = [
"Qt5Core",
"Qt5Widgets",
]
}
config("qt_internal_config") {
if (is_clang) {
# libstdc++ headers are incompatible with -fcomplete-member-pointers.
cflags = [ "-fno-complete-member-pointers" ]
}
# It's OK to depend on the system libstdc++ since it's a dependency of QT, so
# it will get loaded into the process anyway.
libs = [ "stdc++" ]
configs = [
"//build/config/linux:runtime_library",
"//build/config/posix:runtime_library",
]
}
source_set("qt_interface") {
visibility = [ ":*" ]
configs -= [ "//build/config/compiler:runtime_library" ]
configs += [ ":qt_internal_config" ]
# Since `:qt` depends on `qt_shim` via data_deps, gn check would error-out
# if qt_interface.h was placed in `qt_shim`, so it's placed in a separate
# target instead.
public = [ "qt_interface.h" ]
sources = [ "qt_interface.cc" ]
}
if (!use_sysroot) {
action("generate_moc") {
script = "moc_wrapper.py"
inputs = [ "//ui/qt/qt_shim.h" ]
outputs = [ "$root_gen_dir/qt_shim_moc.cc" ]
args = rebase_path(inputs + outputs, root_build_dir)
}
}
shared_library("qt5_shim") {
visibility = [
":qt",
"//chrome/installer/linux:*",
]
# Since qt_shim is a shared library even in non-component builds, it shouldn't
# depend on any other targets since that would duplicate code between binaries
# leading to increased size and potential issues from duplicated global state.
no_default_deps = true
assert_no_deps = [
"//base",
"//buildtools/third_party/libc++",
]
deps = [ ":qt_interface" ]
configs -= [ "//build/config/compiler:runtime_library" ]
configs += [
":qt_internal_config",
":qt5_config",
]
public = []
sources = [
"qt_shim.cc",
"qt_shim.h",
]
if (use_sysroot) {
# This file is generated with gen_qt_shim_moc.sh on an amd64 system to
# avoid a build-time dependency on `moc` when using the sysroot.
sources += [ "qt_shim_moc.cc" ]
} else {
sources += get_target_outputs(":generate_moc")
deps += [ ":generate_moc" ]
}
}
component("qt") {
visibility = [ "//ui/linux:linux_ui_factory" ]
defines = [ "IS_QT_IMPL" ]
# qt_shim is in data_deps since we want to load it manually.
data_deps = [ ":qt5_shim" ]
deps = [
":qt_interface",
"//base",
"//printing/buildflags",
"//ui/base/ime/linux",
"//ui/color",
"//ui/color:mixers",
"//ui/gfx",
"//ui/linux:linux_ui",
"//ui/native_theme",
"//ui/shell_dialogs",
"//ui/views",
]
public_deps = [ "//skia" ]
sources = [
"qt_ui.cc",
"qt_ui.h",
]
}