More MD downloads tweaks
[chromium-blink-merge.git] / chrome_elf / BUILD.gn
blobc97a4110e39170a037a0405bb7e4a717592a36c5
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("//build/config/win/manifest.gni")
6 import("//chrome/version.gni")
7 import("//testing/test.gni")
9 process_version("chrome_elf_resources") {
10   sources = [
11     "chrome_elf.ver",
12   ]
13   output = "$target_gen_dir/chrome_elf_version.rc"
16 # This manifest matches what GYP produces. It may not even be necessary.
17 windows_manifest("chrome_elf_manifest") {
18   sources = [
19     as_invoker_manifest,
20   ]
21   type = "dll"
24 shared_library("chrome_elf") {
25   sources = [
26     "chrome_elf_main.cc",
27     "chrome_elf_main.h",
28   ]
29   deps = [
30     ":blacklist",
31     ":breakpad",
32     ":chrome_elf_manifest",
33     ":lib",
34     ":chrome_elf_resources",
35   ]
36   configs += [ "//build/config/win:windowed" ]
37   configs -= [ "//build/config/win:console" ]
38   ldflags = [
39     "/NODEFAULTLIB:user32.lib",
40     "/DEF:" + rebase_path("chrome_elf.def"),
41   ]
42   if (current_cpu == "x86") {
43     # Don"t set an x64 base address (to avoid breaking HE-ASLR).
44     ldflags += [ "/BASE:0x01c20000" ]
45   }
48 source_set("lib") {
49   sources = [
50     "create_file/chrome_create_file.cc",
51     "create_file/chrome_create_file.h",
52     "ntdll_cache.cc",
53     "ntdll_cache.h",
54   ]
55   deps = [
56     ":common",
57     "//base:base_static",
58     "//sandbox",
59   ]
62 source_set("constants") {
63   sources = [
64     "chrome_elf_constants.cc",
65     "chrome_elf_constants.h",
66   ]
69 source_set("common") {
70   deps = [
71     ":constants",
72   ]
73   sources = [
74     "chrome_elf_types.h",
75     "chrome_elf_util.cc",
76     "chrome_elf_util.h",
77     "thunk_getter.cc",
78     "thunk_getter.h",
79   ]
82 source_set("breakpad") {
83   include_dirs = [ "$target_gen_dir" ]
84   sources = [
85     "breakpad.cc",
86     "breakpad.h",
87   ]
88   deps = [
89     ":common",
90     "//breakpad:breakpad_handler",
91     "//chrome:version_header",
92   ]
95 if (is_component_build) {
96   shared_library("chrome_redirects") {
97     sources = [
98       "chrome_redirects_main.cc",
99     ]
100     deps = [
101       ":lib",
102     ]
103     configs += [ "//build/config/win:windowed" ]
104     ldflags = [ "/DEF:" + rebase_path("chrome_redirects.def") ]
106     if (current_cpu == "x86") {
107       # Don't set an x64 base address (to avoid breaking HE-ASLR).
108       ldflags += [ "/BASE:0x01c20000" ]
109     }
110   }
113 source_set("dll_hash") {
114   deps = [
115     "//base",
116   ]
117   sources = [
118     "dll_hash/dll_hash.cc",
119     "dll_hash/dll_hash.h",
120   ]
123 executable("dll_hash_main") {
124   deps = [
125     ":dll_hash",
126   ]
127   sources = [
128     "dll_hash/dll_hash_main.cc",
129   ]
132 static_library("blacklist") {
133   sources = [
134     "blacklist/blacklist.cc",
135     "blacklist/blacklist.h",
136     "blacklist/blacklist_interceptions.cc",
137     "blacklist/blacklist_interceptions.h",
138   ]
139   deps = [
140     # Depend on base_static, but do NOT take a dependency on base.gyp:base
141     # as that would risk pulling in base's link-time dependencies which
142     # chrome_elf cannot do.
143     ":breakpad",
144     ":constants",
145     "//base:base_static",
146     "//sandbox:sandbox",
147   ]
150 test("chrome_elf_unittests") {
151   output_name = "chrome_elf_unittests"
152   sources = [
153     "blacklist/test/blacklist_test.cc",
154     "chrome_elf_util_unittest.cc",
155     "create_file/chrome_create_file_unittest.cc",
156     "elf_imports_unittest.cc",
157     "ntdll_cache_unittest.cc",
158   ]
159   include_dirs = [ "$target_gen_dir" ]
160   deps = [
161     ":blacklist",
162     ":blacklist_test_main_dll",
163     ":lib",
164     "//base",
165     "//base/test:run_all_unittests",
166     "//base/test:test_support",
167     "//sandbox",
168     "//testing/gtest",
169   ]
170   data_deps = [
171     ":blacklist_test_dll_1",
172     ":blacklist_test_dll_2",
173     ":blacklist_test_dll_3",
174     ":chrome_elf",
175     "//chrome",
176   ]
179 shared_library("blacklist_test_main_dll") {
180   sources = [
181     "blacklist/test/blacklist_test_main_dll.cc",
182   ]
183   deps = [
184     "//base",
185     ":blacklist",
186   ]
187   ldflags =
188       [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_main_dll.def",
189                               root_build_dir) ]
192 shared_library("blacklist_test_dll_1") {
193   sources = [
194     "blacklist/test/blacklist_test_dll_1.cc",
195   ]
196   ldflags = [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_dll_1.def",
197                                     root_build_dir) ]
200 shared_library("blacklist_test_dll_2") {
201   sources = [
202     "blacklist/test/blacklist_test_dll_2.cc",
203   ]
204   ldflags = [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_dll_2.def",
205                                     root_build_dir) ]
208 shared_library("blacklist_test_dll_3") {
209   sources = [
210     "blacklist/test/blacklist_test_dll_3.cc",
211   ]