forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD.gn
151 lines (133 loc) · 3.76 KB
/
BUILD.gn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# 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("//printing/buildflags/buildflags.gni")
import("//ui/qt/qt.gni")
assert(use_qt)
assert(is_linux)
assert(!is_castos)
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" ]
}
template("qt_shim") {
if (!use_sysroot) {
action("generate_moc" + invoker.qt_version) {
script = "moc_wrapper.py"
inputs = [ "//ui/qt/qt_shim.h" ]
outputs = [ "$root_gen_dir/qt" + invoker.qt_version + "/qt_shim_moc.cc" ]
args = rebase_path(inputs + outputs, root_build_dir)
if (invoker.moc_qt_path != "") {
args += [
"--path",
invoker.moc_qt_path,
]
}
}
}
pkg_config("qt" + invoker.qt_version + "_config") {
packages = [
"Qt" + invoker.qt_version + "Core",
"Qt" + invoker.qt_version + "Widgets",
]
}
shared_library(target_name) {
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",
":qt" + invoker.qt_version + "_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" + invoker.qt_version + "_shim_moc.cc" ]
} else {
sources += get_target_outputs(":generate_moc" + invoker.qt_version)
deps += [ ":generate_moc" + invoker.qt_version ]
}
}
}
qt_shim("qt5_shim") {
qt_version = "5"
if (!use_sysroot) {
moc_qt_path = "$moc_qt5_path"
}
}
if (use_qt6) {
qt_shim("qt6_shim") {
qt_version = "6"
if (!use_sysroot) {
moc_qt_path = "$moc_qt6_path"
}
}
}
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" ]
if (use_qt6) {
data_deps += [ ":qt6_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" ]
if (enable_printing) {
public_deps += [ "//printing" ]
}
sources = [
"qt_ui.cc",
"qt_ui.h",
]
}