Adding Peter Thatcher to the owners file.
[chromium-blink-merge.git] / chrome_elf / BUILD.gn
blob06cb9372091950666e4d363a9a9301b3f6f03fa7
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     "$target_gen_dir/chrome_elf_version.rc",
18     "chrome_elf_main.cc",
19     "chrome_elf_main.h",
20   ]
21   deps = [
22     ":blacklist",
23     ":breakpad",
24     ":lib",
25     ":chrome_elf_resources",
26   ]
27   configs += [ "//build/config/win:windowed" ]
28   configs -= [ "//build/config/win:console" ]
29   ldflags = [
30     "/NODEFAULTLIB:user32.lib",
31     "/DEF:" + rebase_path("chrome_elf.def"),
32   ]
33   if (current_cpu == "x86") {
34     # Don"t set an x64 base address (to avoid breaking HE-ASLR).
35     ldflags += [ "/BASE:0x01c20000" ]
36   }
39 source_set("lib") {
40   sources = [
41     "create_file/chrome_create_file.cc",
42     "create_file/chrome_create_file.h",
43     "ntdll_cache.cc",
44     "ntdll_cache.h",
45   ]
46   deps = [
47     ":common",
48     "//base:base_static",
49     "//sandbox",
50   ]
53 source_set("constants") {
54   sources = [
55     "chrome_elf_constants.cc",
56     "chrome_elf_constants.h",
57   ]
60 source_set("common") {
61   deps = [
62     ":constants",
63   ]
64   sources = [
65     "chrome_elf_types.h",
66     "chrome_elf_util.cc",
67     "chrome_elf_util.h",
68     "thunk_getter.cc",
69     "thunk_getter.h",
70   ]
73 source_set("breakpad") {
74   include_dirs = [ "$target_gen_dir" ]
75   sources = [
76     "breakpad.cc",
77     "breakpad.h",
78   ]
79   deps = [
80     ":common",
81     "//breakpad:breakpad_handler",
82     "//chrome:version_header",
83   ]
86 if (is_component_build) {
87   shared_library("chrome_redirects") {
88     sources = [
89       "chrome_redirects_main.cc",
90     ]
91     deps = [
92       ":lib",
93     ]
94     configs += [ "//build/config/win:windowed" ]
95     ldflags = [ "/DEF:" + rebase_path("chrome_redirects.def") ]
97     if (current_cpu == "x86") {
98       # Don't set an x64 base address (to avoid breaking HE-ASLR).
99       ldflags += [ "/BASE:0x01c20000" ]
100     }
101   }
104 source_set("dll_hash") {
105   deps = [
106     "//base",
107   ]
108   sources = [
109     "dll_hash/dll_hash.cc",
110     "dll_hash/dll_hash.h",
111   ]
114 executable("dll_hash_main") {
115   deps = [
116     ":dll_hash",
117   ]
118   sources = [
119     "dll_hash/dll_hash_main.cc",
120   ]
123 static_library("blacklist") {
124   sources = [
125     "blacklist/blacklist.cc",
126     "blacklist/blacklist.h",
127     "blacklist/blacklist_interceptions.cc",
128     "blacklist/blacklist_interceptions.h",
129   ]
130   deps = [
131     # Depend on base_static, but do NOT take a dependency on base.gyp:base
132     # as that would risk pulling in base's link-time dependencies which
133     # chrome_elf cannot do.
134     ":breakpad",
135     ":constants",
136     "//base:base_static",
137     "//sandbox:sandbox",
138   ]
141 test("chrome_elf_unittests") {
142   output_name = "chrome_elf_unittests"
143   sources = [
144     "blacklist/test/blacklist_test.cc",
145     "chrome_elf_util_unittest.cc",
146     "create_file/chrome_create_file_unittest.cc",
147     "elf_imports_unittest.cc",
148     "ntdll_cache_unittest.cc",
149   ]
150   include_dirs = [ "$target_gen_dir" ]
151   deps = [
152     ":blacklist",
153     ":blacklist_test_main_dll",
154     ":lib",
155     "//base",
156     "//base/test:run_all_unittests",
157     "//base/test:test_support",
158     "//sandbox",
159     "//testing/gtest",
160   ]
161   data_deps = [
162     ":blacklist_test_dll_1",
163     ":blacklist_test_dll_2",
164     ":blacklist_test_dll_3",
165     ":chrome_elf",
166     "//chrome",
167   ]
170 shared_library("blacklist_test_main_dll") {
171   sources = [
172     "blacklist/test/blacklist_test_main_dll.cc",
173   ]
174   deps = [
175     "//base",
176     ":blacklist",
177   ]
178   ldflags =
179       [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_main_dll.def",
180                               root_build_dir) ]
183 shared_library("blacklist_test_dll_1") {
184   sources = [
185     "blacklist/test/blacklist_test_dll_1.cc",
186   ]
187   ldflags = [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_dll_1.def",
188                                     root_build_dir) ]
191 shared_library("blacklist_test_dll_2") {
192   sources = [
193     "blacklist/test/blacklist_test_dll_2.cc",
194   ]
195   ldflags = [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_dll_2.def",
196                                     root_build_dir) ]
199 shared_library("blacklist_test_dll_3") {
200   sources = [
201     "blacklist/test/blacklist_test_dll_3.cc",
202   ]