Fix nullptr crash in OnEmbed
[chromium-blink-merge.git] / chrome / chrome_dll.gypi
blobf9ed3d02ac4b972c062b63844fa6ca899bfe85a2
1 # Copyright (c) 2012 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   'conditions': [
6     ['OS=="mac" or OS=="win"', {
7       'targets': [
8         {
9           'target_name': 'chrome_dll',
10           'type': 'none',
11           'dependencies': [
12             'chrome_main_dll',
13           ],
14           'conditions': [
15             ['OS=="mac" and component=="shared_library"', {
16               'type': 'shared_library',
17               'includes': [ 'chrome_dll_bundle.gypi' ],
18               'xcode_settings': {
19                 'OTHER_LDFLAGS': [
20                   '-Wl,-reexport_library,<(PRODUCT_DIR)/libchrome_main_dll.dylib',
21                 ],
22               },
23             }],  # OS=="mac"
24             ['chrome_multiple_dll==1', {
25               'dependencies': [
26                 'chrome_child_dll',
27               ],
28             }],
29             ['incremental_chrome_dll==1', {
30               # Linking to a different directory and then hardlinking back
31               # to OutDir is a workaround to avoid having the .ilk for
32               # chrome.exe and chrome.dll conflicting. See crbug.com/92528
33               # for more information. Done on the dll instead of the exe so
34               # that people launching from VS don't need to modify
35               # $(TargetPath) for the exe.
36               'actions': [
37                 {
38                   'action_name': 'hardlink_to_output',
39                   'inputs': [
40                     '$(OutDir)\\initial\\chrome.dll',
41                   ],
42                   'outputs': [
43                     '$(OutDir)\\chrome.dll',
44                   ],
45                   'action': ['tools\\build\\win\\hardlink_failsafe.bat',
46                              '$(OutDir)\\initial\\chrome.dll',
47                              '$(OutDir)\\chrome.dll'],
48                 },
49               ],
50               'conditions': [
51                 # Only hardlink pdb if we're generating debug info.
52                 ['fastbuild==0 or win_z7!=0', {
53                   'actions': [
54                     {
55                       'action_name': 'hardlink_pdb_to_output',
56                       'inputs': [
57                         # Not the pdb, since gyp doesn't know about it
58                         '$(OutDir)\\initial\\chrome.dll',
59                       ],
60                       'outputs': [
61                         '$(OutDir)\\chrome.dll.pdb',
62                       ],
63                       'action': ['tools\\build\\win\\hardlink_failsafe.bat',
64                                  '$(OutDir)\\initial\\chrome.dll.pdb',
65                                  '$(OutDir)\\chrome.dll.pdb'],
66                     }
67                   ]
68                 }]
69               ],
70             }],
71           ]
72         },
73         {
74           # GN version: //chrome:main_dll
75           'target_name': 'chrome_main_dll',
76           'type': 'shared_library',
77           'variables': {
78             'enable_wexit_time_destructors': 1,
79           },
80           'sources': [
81             '../base/win/dllmain.cc',
82             'app/chrome_command_ids.h',
83             'app/chrome_dll_resource.h',
84             'app/chrome_main.cc',
85             'app/chrome_main_delegate.cc',
86             'app/chrome_main_delegate.h',
87             'app/chrome_main_mac.h',
88             'app/chrome_main_mac.mm',
89             'app/close_handle_hook_win.cc',
90             'app/close_handle_hook_win.h',
91             'app/delay_load_hook_win.cc',
92             'app/delay_load_hook_win.h',
93           ],
94           'dependencies': [
95             '<@(chromium_browser_dependencies)',
96             '../content/content.gyp:content_app_browser',
97           ],
98           'conditions': [
99             ['OS=="win"', {
100               'dependencies': [
101                 '<(DEPTH)/chrome_elf/chrome_elf.gyp:chrome_elf',
102               ],
103             }],
104             ['OS=="win" and configuration_policy==1', {
105               'dependencies': [
106                 '<(DEPTH)/components/components.gyp:policy',
107               ],
108             }],
109             ['use_aura==1', {
110               'dependencies': [
111                 '../ui/compositor/compositor.gyp:compositor',
112               ],
113             }],
114             ['OS=="win" and target_arch=="ia32"', {
115               # Add a dependency to custom import library for user32 delay
116               # imports only in x86 builds.
117               'dependencies': [
118                 'chrome_user32_delay_imports',
119               ],
120             },],
121             ['OS=="win"', {
122               'product_name': 'chrome',
123               'dependencies': [
124                 # On Windows, link the dependencies (libraries) that make
125                 # up actual Chromium functionality into this .dll.
126                 'chrome_version_resources',
127                 '../base/trace_event/etw_manifest/etw_manifest.gyp:etw_manifest',
128                 '../chrome/chrome_resources.gyp:chrome_unscaled_resources',
129                 '../content/app/resources/content_resources.gyp:content_resources',
130                 '../crypto/crypto.gyp:crypto',
131                 '../net/net.gyp:net_resources',
132                 '../ui/views/views.gyp:views',
133               ],
134               'sources': [
135                 'app/chrome_dll.rc',
137                 # ETW Manifest.
138                 '<(SHARED_INTERMEDIATE_DIR)/base/trace_event/etw_manifest/chrome_events_win.rc',
140                 '<(SHARED_INTERMEDIATE_DIR)/chrome_version/chrome_dll_version.rc',
142                 # Cursors.
143                 '<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_unscaled_resources.rc',
144               ],
145               'include_dirs': [
146                 '<(DEPTH)/third_party/wtl/include',
147               ],
148               'configurations': {
149                 'Debug_Base': {
150                   'msvs_settings': {
151                     'VCLinkerTool': {
152                       'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
153                     },
154                   },
155                 },
156               },
157               'msvs_settings': {
158                 'VCLinkerTool': {
159                   'ImportLibrary': '$(OutDir)\\lib\\chrome_dll.lib',
160                   # Set /SUBSYSTEM:WINDOWS for chrome.dll (for consistency).
161                   'SubSystem': '2',
162                   'conditions': [
163                     ['incremental_chrome_dll==1', {
164                       'OutputFile': '$(OutDir)\\initial\\chrome.dll',
165                       'UseLibraryDependencyInputs': "true",
166                     }],
167                     ['target_arch=="ia32"', {
168                       # Don't set an x64 base address (to avoid breaking HE-ASLR).
169                       'BaseAddress': '0x01c30000',
170                       # Link against the XP-constrained user32 import library
171                       # instead of the platform-SDK provided one to avoid
172                       # inadvertently taking dependencies on post-XP user32
173                       # exports.
174                       'AdditionalDependencies!': [
175                         'user32.lib',
176                       ],
177                       'IgnoreDefaultLibraryNames': [
178                         'user32.lib',
179                       ],
180                       # Remove user32 delay load for chrome.dll.
181                       'DelayLoadDLLs!': [
182                         'user32.dll',
183                       ],
184                       'AdditionalDependencies': [
185                         'user32.winxp.lib',
186                       ],
187                       'DelayLoadDLLs': [
188                         'user32-delay.dll',
189                       ],
190                       'AdditionalLibraryDirectories': [
191                         '<(DEPTH)/build/win/importlibs/x86',
192                       ],
193                       'ForceSymbolReferences': [
194                         # Force the inclusion of the delay load hook in this
195                         # binary.
196                         '_ChromeDelayLoadHook@8',
197                       ],
198                     }],
199                   ],
200                   'DelayLoadDLLs': [
201                     'comdlg32.dll',
202                     'crypt32.dll',
203                     'cryptui.dll',
204                     'dhcpcsvc.dll',
205                     'imagehlp.dll',
206                     'imm32.dll',
207                     'iphlpapi.dll',
208                     'setupapi.dll',
209                     'urlmon.dll',
210                     'winhttp.dll',
211                     'wininet.dll',
212                     'winspool.drv',
213                     'ws2_32.dll',
214                     'wsock32.dll',
215                   ],
216                 },
217                 'VCManifestTool': {
218                   'AdditionalManifestFiles': [
219                     '$(ProjectDir)\\app\\chrome.dll.manifest',
220                   ],
221                 },
222               },
223               'conditions': [
224                 ['win_use_allocator_shim==1', {
225                   'dependencies': [
226                     '<(allocator_target)',
227                   ],
228                 }],
229                 ['enable_basic_printing==1 or enable_print_preview==1', {
230                   'dependencies': [
231                     '../printing/printing.gyp:printing',
232                   ],
233                 }],
234                 ['chrome_pgo_phase==1', {
235                   'msvs_settings': {
236                     'VCLinkerTool': {
237                       'LinkTimeCodeGeneration': '2',
238                       'AdditionalOptions': [
239                         '/PogoSafeMode',
240                       ],
241                     },
242                   },
243                 }],
244                 ['chrome_pgo_phase==2', {
245                   'msvs_settings': {
246                     'VCLinkerTool': {
247                       'LinkTimeCodeGeneration': '3',
248                     },
249                   },
250                 }],
251               ]
252             }],
253             ['chrome_multiple_dll==1', {
254               'defines': [
255                 'CHROME_MULTIPLE_DLL_BROWSER',
256               ],
257             }, {
258               'dependencies': [
259                 '<@(chromium_child_dependencies)',
260                 '../content/content.gyp:content_app_both',
261               ],
262               'dependencies!': [
263                 '../content/content.gyp:content_app_browser',
264               ],
265             }],
266             ['chrome_multiple_dll==0 and enable_plugins==1', {
267               'dependencies': [
268                 '../pdf/pdf.gyp:pdf',
269               ],
270             }],
271             ['cld_version==1', {
272               'dependencies': [
273                 '<(DEPTH)/third_party/cld/cld.gyp:cld',
274               ],
275             }],
276             ['cld_version==2', {
277               'dependencies': [
278                 '<(DEPTH)/third_party/cld_2/cld_2.gyp:cld_2',
279               ],
280             }],
281             ['OS=="mac" and component!="shared_library"', {
282               'includes': [ 'chrome_dll_bundle.gypi' ],
283             }],
284             ['OS=="mac" and component=="shared_library"', {
285               'xcode_settings': { 'OTHER_LDFLAGS': [ '-Wl,-ObjC' ], },
286             }],
287             ['OS=="mac"', {
288               'dependencies': [
289                 '../components/components.gyp:crash_component',
290                 '../components/components.gyp:policy',
291               ],
292               'sources': [
293                 'app/chrome_crash_reporter_client.cc',
294                 'app/chrome_crash_reporter_client.h',
295                 'app/chrome_crash_reporter_client_mac.mm',
296               ],
297               'xcode_settings': {
298                 # Define the order of symbols within the framework.  This
299                 # sets -order_file.
300                 'ORDER_FILE': 'app/framework.order',
301               },
302               'include_dirs': [
303                 '<(grit_out_dir)',
304               ],
305             }],
306             # This step currently fails when using LTO. TODO(pcc): Re-enable.
307             ['OS=="mac" and use_lto==0', {
308               'postbuilds': [
309                 {
310                   # This step causes an error to be raised if the .order file
311                   # does not account for all global text symbols.  It
312                   # validates the completeness of the .order file.
313                   'postbuild_name': 'Verify global text symbol order',
314                   'variables': {
315                     'verify_order_path': 'tools/build/mac/verify_order',
316                   },
317                   'action': [
318                     '<(verify_order_path)',
319                     '_ChromeMain',
320                     '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}',
321                   ],
322                 },
323               ],
324             }],  # OS=="mac"
325           ],  # conditions
326         },  # target chrome_main_dll
327       ],  # targets
328     }],  # OS=="mac" or OS=="win"
329     ['chrome_multiple_dll', {
330       'targets': [
331         {
332           # GN version: //chrome:chrome_child
333           'target_name': 'chrome_child_dll',
334           'type': 'shared_library',
335           'product_name': 'chrome_child',
336           'variables': {
337             'enable_wexit_time_destructors': 1,
338           },
339           'dependencies': [
340             '<@(chromium_child_dependencies)',
341             '../content/content.gyp:content_app_child',
342             'chrome_version_resources',
343             'policy_path_parser',
344           ],
345           'defines': [
346             'CHROME_MULTIPLE_DLL_CHILD',
347           ],
348           'sources': [
349             '<(SHARED_INTERMEDIATE_DIR)/chrome_version/chrome_dll_version.rc',
350             'app/chrome_main.cc',
351             'app/chrome_main_delegate.cc',
352             'app/chrome_main_delegate.h',
353             'app/close_handle_hook_win.cc',
354             'app/close_handle_hook_win.h',
355           ],
356           'conditions': [
357             ['OS=="win"', {
358               'conditions': [
359                 ['chrome_pgo_phase==1', {
360                   'msvs_settings': {
361                     'VCLinkerTool': {
362                       'LinkTimeCodeGeneration': '2',
363                       'AdditionalOptions': [
364                         '/PogoSafeMode',
365                       ],
366                     },
367                   },
368                 }],
369                 ['chrome_pgo_phase==2', {
370                   'msvs_settings': {
371                     'VCLinkerTool': {
372                       'LinkTimeCodeGeneration': '3',
373                     },
374                   },
375                 }],
376               ]
377             }],
378             ['enable_plugins==1', {
379               'dependencies': [
380                 '../pdf/pdf.gyp:pdf',
381               ],
382             }],
383           ],
384         },  # target chrome_child_dll
385       ],
386     }],
387   ],