Break LoFi UMA by connection type
[chromium-blink-merge.git] / chrome_elf / BUILD.gn
blobee00fa8d631122fb5953767fb7b562a232c33afe
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//chrome/version.gni")
6 import("//testing/test.gni")
8 process_version("chrome_elf_resources") {
9   sources = [
10     "chrome_elf.ver",
11   ]
12   output = "$target_gen_dir/chrome_elf_version.rc"
15 shared_library("chrome_elf") {
16   sources = [
17     "chrome_elf_main.cc",
18     "chrome_elf_main.h",
19   ]
20   deps = [
21     ":blacklist",
22     ":breakpad",
23     ":lib",
24     ":chrome_elf_resources",
25   ]
26   configs += [ "//build/config/win:windowed" ]
27   configs -= [ "//build/config/win:console" ]
28   ldflags = [
29     "/NODEFAULTLIB:user32.lib",
30     "/DEF:" + rebase_path("chrome_elf.def"),
31   ]
32   if (current_cpu == "x86") {
33     # Don"t set an x64 base address (to avoid breaking HE-ASLR).
34     ldflags += [ "/BASE:0x01c20000" ]
35   }
38 source_set("lib") {
39   sources = [
40     "create_file/chrome_create_file.cc",
41     "create_file/chrome_create_file.h",
42     "ntdll_cache.cc",
43     "ntdll_cache.h",
44   ]
45   deps = [
46     ":common",
47     "//base:base_static",
48     "//sandbox",
49   ]
52 source_set("constants") {
53   sources = [
54     "chrome_elf_constants.cc",
55     "chrome_elf_constants.h",
56   ]
59 source_set("common") {
60   deps = [
61     ":constants",
62   ]
63   sources = [
64     "chrome_elf_types.h",
65     "chrome_elf_util.cc",
66     "chrome_elf_util.h",
67     "thunk_getter.cc",
68     "thunk_getter.h",
69   ]
72 source_set("breakpad") {
73   include_dirs = [ "$target_gen_dir" ]
74   sources = [
75     "breakpad.cc",
76     "breakpad.h",
77   ]
78   deps = [
79     ":common",
80     "//breakpad:breakpad_handler",
81     "//chrome:version_header",
82   ]
85 if (is_component_build) {
86   shared_library("chrome_redirects") {
87     sources = [
88       "chrome_redirects_main.cc",
89     ]
90     deps = [
91       ":lib",
92     ]
93     configs += [ "//build/config/win:windowed" ]
94     ldflags = [ "/DEF:" + rebase_path("chrome_redirects.def") ]
96     if (current_cpu == "x86") {
97       # Don't set an x64 base address (to avoid breaking HE-ASLR).
98       ldflags += [ "/BASE:0x01c20000" ]
99     }
100   }
103 source_set("dll_hash") {
104   deps = [
105     "//base",
106   ]
107   sources = [
108     "dll_hash/dll_hash.cc",
109     "dll_hash/dll_hash.h",
110   ]
113 executable("dll_hash_main") {
114   deps = [
115     ":dll_hash",
116   ]
117   sources = [
118     "dll_hash/dll_hash_main.cc",
119   ]
122 static_library("blacklist") {
123   sources = [
124     "blacklist/blacklist.cc",
125     "blacklist/blacklist.h",
126     "blacklist/blacklist_interceptions.cc",
127     "blacklist/blacklist_interceptions.h",
128   ]
129   deps = [
130     # Depend on base_static, but do NOT take a dependency on base.gyp:base
131     # as that would risk pulling in base's link-time dependencies which
132     # chrome_elf cannot do.
133     ":breakpad",
134     ":constants",
135     "//base:base_static",
136     "//sandbox:sandbox",
137   ]
140 test("chrome_elf_unittests") {
141   output_name = "chrome_elf_unittests"
142   sources = [
143     "blacklist/test/blacklist_test.cc",
144     "chrome_elf_util_unittest.cc",
145     "create_file/chrome_create_file_unittest.cc",
146     "elf_imports_unittest.cc",
147     "ntdll_cache_unittest.cc",
148   ]
149   include_dirs = [ "$target_gen_dir" ]
150   deps = [
151     ":blacklist",
152     ":blacklist_test_main_dll",
153     ":lib",
154     "//base",
155     "//base/test:run_all_unittests",
156     "//base/test:test_support",
157     "//sandbox",
158     "//testing/gtest",
159   ]
160   data_deps = [
161     ":blacklist_test_dll_1",
162     ":blacklist_test_dll_2",
163     ":blacklist_test_dll_3",
164     ":chrome_elf",
165     "//chrome",
166   ]
169 shared_library("blacklist_test_main_dll") {
170   sources = [
171     "blacklist/test/blacklist_test_main_dll.cc",
172   ]
173   deps = [
174     "//base",
175     ":blacklist",
176   ]
177   ldflags =
178       [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_main_dll.def",
179                               root_build_dir) ]
182 shared_library("blacklist_test_dll_1") {
183   sources = [
184     "blacklist/test/blacklist_test_dll_1.cc",
185   ]
186   ldflags = [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_dll_1.def",
187                                     root_build_dir) ]
190 shared_library("blacklist_test_dll_2") {
191   sources = [
192     "blacklist/test/blacklist_test_dll_2.cc",
193   ]
194   ldflags = [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_dll_2.def",
195                                     root_build_dir) ]
198 shared_library("blacklist_test_dll_3") {
199   sources = [
200     "blacklist/test/blacklist_test_dll_3.cc",
201   ]