Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / chrome_elf / chrome_elf.gyp
blob0b612a87c6ec5e73c2d58b5915cf63822b6f9ec2
1 # Copyright 2013 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   'variables': {
6     'chromium_code': 1,
7   },
8   'includes': [
9     '../build/util/version.gypi',
10     '../build/win_precompile.gypi',
11     'blacklist.gypi',
12     'dll_hash.gypi',
13   ],
14   'targets': [
15     {
16       'target_name': 'chrome_elf_resources',
17       'type': 'none',
18       'conditions': [
19         ['branding == "Chrome"', {
20           'variables': {
21              'branding_path': '../chrome/app/theme/google_chrome/BRANDING',
22           },
23         }, { # else branding!="Chrome"
24           'variables': {
25              'branding_path': '../chrome/app/theme/chromium/BRANDING',
26           },
27         }],
28       ],
29       'variables': {
30         'output_dir': 'chrome_elf',
31         'template_input_path': '../chrome/app/chrome_version.rc.version',
32       },
33       'sources': [
34         'chrome_elf.ver',
35       ],
36       'includes': [
37         '../chrome/version_resource_rules.gypi',
38       ],
39     },
40     {
41       'target_name': 'chrome_elf',
42       'type': 'shared_library',
43       'include_dirs': [
44         '..',
45       ],
46       'sources': [
47         'chrome_elf.def',
48         'chrome_elf_main.cc',
49         'chrome_elf_main.h',
50         '<(SHARED_INTERMEDIATE_DIR)/chrome_elf/chrome_elf_version.rc',
51       ],
52       'dependencies': [
53         'blacklist',
54         'chrome_elf_breakpad',
55         'chrome_elf_lib',
56         'chrome_elf_resources',
57       ],
58       'msvs_settings': {
59         'VCLinkerTool': {
60           'conditions': [
61             ['target_arch=="ia32"', {
62               # Don't set an x64 base address (to avoid breaking HE-ASLR).
63               'BaseAddress': '0x01c20000',
64             }],
65           ],
66           # Set /SUBSYSTEM:WINDOWS.
67           'SubSystem': '2',
68           'AdditionalDependencies!': [
69             'user32.lib',
70           ],
71           'IgnoreDefaultLibraryNames': [
72             'user32.lib',
73           ],
74         },
75       },
76     },
77     {
78       'target_name': 'chrome_elf_unittests_exe',
79       'product_name': 'chrome_elf_unittests',
80       'type': 'executable',
81       'sources': [
82         'blacklist/test/blacklist_test.cc',
83         'chrome_elf_util_unittest.cc',
84         'create_file/chrome_create_file_unittest.cc',
85         'elf_imports_unittest.cc',
86         'ntdll_cache_unittest.cc',
87       ],
88       'include_dirs': [
89         '..',
90         '<(SHARED_INTERMEDIATE_DIR)',
91       ],
92       'dependencies': [
93         'chrome_elf_lib',
94         '../base/base.gyp:base',
95         '../base/base.gyp:run_all_unittests',
96         '../base/base.gyp:test_support_base',
97         '../sandbox/sandbox.gyp:sandbox',
98         '../testing/gtest.gyp:gtest',
99         'blacklist',
100         'blacklist_test_dll_1',
101         'blacklist_test_dll_2',
102         'blacklist_test_dll_3',
103         'blacklist_test_main_dll',
104       ],
105     },
106     {
107       # A dummy target to ensure that chrome_elf.dll and chrome.exe gets built
108       # when building chrome_elf_unittests.exe without introducing an
109       # explicit runtime dependency.
110       'target_name': 'chrome_elf_unittests',
111       'type': 'none',
112       'dependencies': [
113         '../chrome/chrome.gyp:chrome',
114         'chrome_elf',
115         'chrome_elf_unittests_exe',
116       ],
117     },
118     {
119       'target_name': 'chrome_elf_lib',
120       'type': 'static_library',
121       'include_dirs': [
122         '..',
123       ],
124       'sources': [
125         'create_file/chrome_create_file.cc',
126         'create_file/chrome_create_file.h',
127         'ntdll_cache.cc',
128         'ntdll_cache.h',
129       ],
130       'dependencies': [
131         'chrome_elf_common',
132         '../base/base.gyp:base_static',
133         '../sandbox/sandbox.gyp:sandbox',
134       ],
135     },
136     {
137       'target_name': 'chrome_elf_constants',
138       'type': 'static_library',
139       'include_dirs': [
140         '..',
141       ],
142       'sources': [
143         'chrome_elf_constants.cc',
144         'chrome_elf_constants.h',
145       ],
146     },
147     {
148       'target_name': 'chrome_elf_common',
149       'type': 'static_library',
150       'dependencies': [
151         'chrome_elf_constants',
152       ],
153       'include_dirs': [
154         '..',
155       ],
156       'sources': [
157         'chrome_elf_types.h',
158         'chrome_elf_util.cc',
159         'chrome_elf_util.h',
160         'thunk_getter.cc',
161         'thunk_getter.h',
162       ],
163     },
164     {
165       'target_name': 'chrome_elf_breakpad',
166       'type': 'static_library',
167       'include_dirs': [
168         '..',
169         '<(SHARED_INTERMEDIATE_DIR)',
170       ],
171       'sources': [
172         'breakpad.cc',
173         'breakpad.h',
174       ],
175       'dependencies': [
176         'chrome_elf_common',
177         '../breakpad/breakpad.gyp:breakpad_handler',
178         '../chrome/chrome.gyp:chrome_version_header',
179       ],
180     },
181   ], # targets
182   'conditions': [
183     ['component=="shared_library"', {
184       'targets': [
185         {
186           'target_name': 'chrome_redirects',
187           'type': 'shared_library',
188           'include_dirs': [
189             '..',
190           ],
191           'sources': [
192             'chrome_redirects.def',
193             'chrome_redirects_main.cc',
194           ],
195           'dependencies': [
196             'chrome_elf_lib',
197           ],
198           'msvs_settings': {
199             'VCLinkerTool': {
200               'conditions': [
201                 ['target_arch=="ia32"', {
202                   # Don't set an x64 base address (to avoid breaking HE-ASLR).
203                   'BaseAddress': '0x01c20000',
204                 }],
205               ],
206               # Set /SUBSYSTEM:WINDOWS.
207               'SubSystem': '2',
208             },
209           },
210         },
211       ],
212     }],
213   ],