kMaxBlockSize -> kMaxHeaderBlockSize to avoid shadowing warning on VS2015
[chromium-blink-merge.git] / components / nacl.gyp
blobf6d7e26d7de5cde9e0fc7b18a0301da999872a38
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.
6   'variables': {
7     'chromium_code': 1,
8   },
9   'includes': [
10     'nacl/nacl_defines.gypi',
11   ],
12   'target_defaults': {
13     'variables': {
14       'nacl_target': 0,
15     },
16     'target_conditions': [
17       # This part is shared between the targets defined below. Only files and
18       # settings relevant for building the Win64 target should be added here.
19       ['nacl_target==1', {
20         'include_dirs': [
21           '<(INTERMEDIATE_DIR)',
22         ],
23         'defines': [
24           '<@(nacl_defines)',
25         ],
26         'sources': [
27           # .cc, .h, and .mm files under nacl that are used on all
28           # platforms, including both 32-bit and 64-bit Windows.
29           # Test files are also not included.
30           'nacl/loader/nacl_ipc_adapter.cc',
31           'nacl/loader/nacl_ipc_adapter.h',
32           'nacl/loader/nacl_main.cc',
33           'nacl/loader/nacl_main_platform_delegate.h',
34           'nacl/loader/nacl_main_platform_delegate_linux.cc',
35           'nacl/loader/nacl_main_platform_delegate_mac.mm',
36           'nacl/loader/nacl_main_platform_delegate_win.cc',
37           'nacl/loader/nacl_listener.cc',
38           'nacl/loader/nacl_listener.h',
39           'nacl/loader/nacl_trusted_listener.cc',
40           'nacl/loader/nacl_trusted_listener.h',
41           'nacl/loader/nacl_validation_db.h',
42           'nacl/loader/nacl_validation_query.cc',
43           'nacl/loader/nacl_validation_query.h',
44         ],
45         # TODO(gregoryd): consider switching NaCl to use Chrome OS defines
46         'conditions': [
47           ['OS=="win"', {
48             'defines': [
49               '__STDC_LIMIT_MACROS=1',
50             ],
51             'include_dirs': [
52               '<(DEPTH)/third_party/wtl/include',
53             ],
54           },],
55           ['OS=="linux"', {
56             'defines': [
57               '__STDC_LIMIT_MACROS=1',
58             ],
59             'sources': [
60               '../components/nacl/common/nacl_paths.cc',
61               '../components/nacl/common/nacl_paths.h',
62             ],
63           },],
64         ],
65       }],
66     ],
67   },
68   'conditions': [
69     ['disable_nacl!=1', {
70       'targets': [
71         {
72           'target_name': 'nacl',
73           'type': 'static_library',
74           'variables': {
75             'nacl_target': 1,
76           },
77           'dependencies': [
78             '../base/base.gyp:base',
79             '../base/base.gyp:base_static',
80             '../ipc/ipc.gyp:ipc',
81             '../mojo/mojo_nacl.gyp:monacl_syscall',
82             '../ppapi/ppapi_internal.gyp:ppapi_shared',
83             '../ppapi/ppapi_internal.gyp:ppapi_ipc',
84             '../native_client/src/trusted/service_runtime/service_runtime.gyp:sel_main_chrome',
85             '../third_party/mojo/mojo_edk.gyp:mojo_system_impl',
86           ],
87           'conditions': [
88             ['disable_nacl_untrusted==0', {
89               'dependencies': [
90                 '../ppapi/native_client/native_client.gyp:nacl_irt',
91                 '../ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp:pnacl_support_extension',
92               ],
93             }],
94           ],
95           'direct_dependent_settings': {
96             'defines': [
97               '<@(nacl_defines)',
98             ],
99           },
100         },
101         {
102           'target_name': 'nacl_browser',
103           'type': 'static_library',
104           'sources': [
105             'nacl/browser/nacl_broker_host_win.cc',
106             'nacl/browser/nacl_broker_host_win.h',
107             'nacl/browser/nacl_broker_service_win.cc',
108             'nacl/browser/nacl_broker_service_win.h',
109             'nacl/browser/nacl_browser.cc',
110             'nacl/browser/nacl_browser.h',
111             'nacl/browser/nacl_file_host.cc',
112             'nacl/browser/nacl_file_host.h',
113             'nacl/browser/nacl_host_message_filter.cc',
114             'nacl/browser/nacl_host_message_filter.h',
115             'nacl/browser/nacl_process_host.cc',
116             'nacl/browser/nacl_process_host.h',
117             'nacl/browser/nacl_validation_cache.cc',
118             'nacl/browser/nacl_validation_cache.h',
119             'nacl/browser/pnacl_host.cc',
120             'nacl/browser/pnacl_host.h',
121             'nacl/browser/pnacl_translation_cache.cc',
122             'nacl/browser/pnacl_translation_cache.h',
123             'nacl/common/nacl_debug_exception_handler_win.cc',
124             'nacl/common/nacl_debug_exception_handler_win.h',
125           ],
126           'include_dirs': [
127             '..',
128           ],
129           'dependencies': [
130             'nacl_common',
131             'nacl_switches',
132             '../native_client/src/trusted/service_runtime/service_runtime.gyp:sel',
133             '../content/content.gyp:content_browser',
134           ],
135           'defines': [
136             '<@(nacl_defines)',
137           ],
138           # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
139           'msvs_disabled_warnings': [4267, ],
140           'conditions': [
141             ['OS=="linux"', {
142               'sources': [
143                 '../components/nacl/zygote/nacl_fork_delegate_linux.cc',
144                 '../components/nacl/zygote/nacl_fork_delegate_linux.h',
145               ],
146               'dependencies': [
147                 # Required by nacl_fork_delegate_linux.cc.
148                 '../sandbox/sandbox.gyp:suid_sandbox_client',
149               ]
150             }],
151           ],
152         },
153         {
154           'target_name': 'nacl_renderer',
155           'type': 'static_library',
156           'sources': [
157             'nacl/renderer/file_downloader.cc',
158             'nacl/renderer/file_downloader.h',
159             'nacl/renderer/histogram.cc',
160             'nacl/renderer/histogram.h',
161             'nacl/renderer/manifest_downloader.cc',
162             'nacl/renderer/manifest_downloader.h',
163             'nacl/renderer/manifest_service_channel.cc',
164             'nacl/renderer/manifest_service_channel.h',
165             'nacl/renderer/nacl_helper.cc',
166             'nacl/renderer/nacl_helper.h',
167             'nacl/renderer/json_manifest.cc',
168             'nacl/renderer/json_manifest.h',
169             'nacl/renderer/nexe_load_manager.cc',
170             'nacl/renderer/nexe_load_manager.h',
171             'nacl/renderer/platform_info.cc',
172             'nacl/renderer/platform_info.h',
173             'nacl/renderer/pnacl_translation_resource_host.cc',
174             'nacl/renderer/pnacl_translation_resource_host.h',
175             'nacl/renderer/ppb_nacl_private_impl.cc',
176             'nacl/renderer/ppb_nacl_private_impl.h',
177             'nacl/renderer/progress_event.cc',
178             'nacl/renderer/progress_event.h',
179             'nacl/renderer/trusted_plugin_channel.cc',
180             'nacl/renderer/trusted_plugin_channel.h',
181           ],
182           'include_dirs': [
183             '..',
184           ],
185           'dependencies': [
186             'nacl_common',
187             '../content/content.gyp:content_renderer',
188             '../components/nacl/renderer/plugin/plugin.gyp:nacl_trusted_plugin',
189             '../third_party/jsoncpp/jsoncpp.gyp:jsoncpp',
190             '../third_party/WebKit/public/blink.gyp:blink',
191           ],
192           'defines': [
193             '<@(nacl_defines)',
194           ],
195           'direct_dependent_settings': {
196             'defines': [
197               '<@(nacl_defines)',
198             ],
199           },
200         },
201         {
202           'target_name': 'nacl_loader_unittests',
203           'type': '<(gtest_target_type)',
204           'sources': [
205             'nacl/loader/run_all_unittests.cc',
206           ],
207           'dependencies': [
208             'nacl',
209             '../base/base.gyp:test_support_base',
210             '../testing/gtest.gyp:gtest',
211           ],
212           'conditions': [
213             ['OS=="linux"', {
214               'sources': [
215                 # TODO(mazda): Move this to browser_tests once we have
216                 # established a way to run browser_tests on ARM Chrome OS
217                 # devices (http://crbug.com/364729).
218                 'nacl/loader/nonsfi/irt_icache_unittest.cc',
219                 # TODO(hamaji): Currently, we build them twice. Stop building
220                 # them for components_unittests. See crbug.com/364751
221                 'nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc',
222                 'nacl/loader/nonsfi/nonsfi_sandbox_sigsys_unittest.cc',
223               ],
224               'dependencies': [
225                 'nacl_linux',
226                 '../sandbox/sandbox.gyp:sandbox_linux_test_utils',
227               ],
228             }],
229           ],
230         },
231       ],
232       'conditions': [
233         ['OS=="linux"', {
234           'targets': [
235             {
236               'target_name': 'nacl_helper',
237               'type': 'executable',
238               'include_dirs': [
239                 '..',
240               ],
241               'sources': [
242                 'nacl/loader/nacl_helper_linux.cc',
243                 'nacl/loader/nacl_helper_linux.h',
244               ],
245               'dependencies': [
246                 'nacl_linux',
247               ],
248               'cflags': ['-fPIE'],
249               'ldflags!': [
250                 # Do not pick the default ASan options from
251                 # build/sanitizers/sanitizer_options.cc to avoid a conflict with
252                 # those in nacl/nacl_helper_linux.cc.
253                 '-Wl,-u_sanitizer_options_link_helper',
254               ],
255               'link_settings': {
256                 'ldflags': ['-pie'],
257               },
258             }, {
259               'target_name': 'nacl_linux',
260               'type': 'static_library',
261               'include_dirs': [
262                 '..',
263               ],
264               'defines': [
265                 '<@(nacl_defines)',
266                 # Allow .cc files to know if they're being compiled as part
267                 # of nacl_helper.
268                 'IN_NACL_HELPER=1',
269               ],
270               'sources': [
271                 'nacl/loader/nonsfi/abi_conversion.cc',
272                 'nacl/loader/nonsfi/abi_conversion.h',
273                 'nacl/loader/nonsfi/elf_loader.cc',
274                 'nacl/loader/nonsfi/elf_loader.h',
275                 'nacl/loader/nonsfi/irt_basic.cc',
276                 'nacl/loader/nonsfi/irt_clock.cc',
277                 'nacl/loader/nonsfi/irt_exception_handling.cc',
278                 'nacl/loader/nonsfi/irt_fdio.cc',
279                 'nacl/loader/nonsfi/irt_futex.cc',
280                 'nacl/loader/nonsfi/irt_icache.cc',
281                 'nacl/loader/nonsfi/irt_interfaces.cc',
282                 'nacl/loader/nonsfi/irt_interfaces.h',
283                 'nacl/loader/nonsfi/irt_memory.cc',
284                 'nacl/loader/nonsfi/irt_ppapi.cc',
285                 'nacl/loader/nonsfi/irt_random.cc',
286                 'nacl/loader/nonsfi/irt_resource_open.cc',
287                 'nacl/loader/nonsfi/irt_thread.cc',
288                 'nacl/loader/nonsfi/irt_util.h',
289                 'nacl/loader/nonsfi/nonsfi_listener.cc',
290                 'nacl/loader/nonsfi/nonsfi_listener.h',
291                 'nacl/loader/nonsfi/nonsfi_main.cc',
292                 'nacl/loader/nonsfi/nonsfi_main.h',
293                 'nacl/loader/nonsfi/nonsfi_sandbox.cc',
294                 'nacl/loader/nonsfi/nonsfi_sandbox.h',
295                 'nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc',
296                 'nacl/loader/sandbox_linux/nacl_sandbox_linux.cc',
297                 '../ppapi/nacl_irt/irt_manifest.h',
298                 '../ppapi/nacl_irt/manifest_service.cc',
299                 '../ppapi/nacl_irt/manifest_service.h',
300                 '../ppapi/nacl_irt/plugin_main.cc',
301                 '../ppapi/nacl_irt/plugin_main.h',
302                 '../ppapi/nacl_irt/plugin_startup.cc',
303                 '../ppapi/nacl_irt/plugin_startup.h',
304                 '../ppapi/nacl_irt/ppapi_dispatcher.cc',
305                 '../ppapi/nacl_irt/ppapi_dispatcher.h',
306               ],
307               'dependencies': [
308                 'nacl',
309                 'nacl_common',
310                 'nacl_switches',
311                 '../components/tracing.gyp:tracing',
312                 '../crypto/crypto.gyp:crypto',
313                 '../sandbox/sandbox.gyp:libc_urandom_override',
314                 '../sandbox/sandbox.gyp:sandbox',
315                 '../ppapi/ppapi_internal.gyp:ppapi_proxy',
316               ],
317               'conditions': [
318                 ['use_glib == 1', {
319                   'dependencies': [
320                     '../build/linux/system.gyp:glib',
321                   ],
322                 }],
323                 ['os_posix == 1 and OS != "mac"', {
324                   'conditions': [
325                     ['use_allocator!="none"', {
326                       'dependencies': [
327                         '../base/allocator/allocator.gyp:allocator',
328                       ],
329                     }],
330                   ],
331                 }],
332                 ['use_seccomp_bpf == 0', {
333                   'sources!': [
334                     '../content/common/sandbox_linux/sandbox_bpf_base_policy_linux.cc',
335                     '../content/common/sandbox_linux/sandbox_init_linux.cc',
336                   ],
337                 }, {
338                   'defines': ['USE_SECCOMP_BPF'],
339                 }],
340               ],
341               'cflags': ['-fPIE'],
342             },
343           ],
344         }],
345         ['OS=="win" and target_arch=="ia32"', {
346           'targets': [
347             {
348               'target_name': 'nacl_win64',
349               'type': 'static_library',
350               'variables': {
351                 'nacl_target': 1,
352               },
353               'dependencies': [
354                 'nacl_common_win64',
355                 '../mojo/mojo_nacl.gyp:monacl_syscall_win64',
356                 '../native_client/src/trusted/service_runtime/service_runtime.gyp:sel_main_chrome64',
357                 '../ppapi/ppapi_internal.gyp:ppapi_shared_win64',
358                 '../ppapi/ppapi_internal.gyp:ppapi_ipc_win64',
359                 '../third_party/mojo/mojo_edk.gyp:mojo_system_impl_win64',
360               ],
361               'export_dependent_settings': [
362                 '../ppapi/ppapi_internal.gyp:ppapi_ipc_win64',
363               ],
364               'sources': [
365                 '../components/nacl/broker/nacl_broker_listener.cc',
366                 '../components/nacl/broker/nacl_broker_listener.h',
367                 '../components/nacl/common/nacl_debug_exception_handler_win.cc',
368                 '../components/nacl/loader/nacl_helper_win_64.cc',
369                 '../components/nacl/loader/nacl_helper_win_64.h',
370               ],
371               'include_dirs': [
372                 '..',
373               ],
374               'defines': [
375                 '<@(nacl_win64_defines)',
376                 'COMPILE_CONTENT_STATICALLY',
377               ],
378               'configurations': {
379                 'Common_Base': {
380                   'msvs_target_platform': 'x64',
381                 },
382               },
383               'direct_dependent_settings': {
384                 'defines': [
385                   '<@(nacl_defines)',
386                 ],
387               },
388             },
389             {
390               'target_name': 'nacl_switches_win64',
391               'type': 'static_library',
392               'sources': [
393                 'nacl/common/nacl_switches.cc',
394                 'nacl/common/nacl_switches.h',
395               ],
396               'include_dirs': [
397                 '..',
398               ],
399               'configurations': {
400                 'Common_Base': {
401                   'msvs_target_platform': 'x64',
402                 },
403               },
404             },
405             {
406               'target_name': 'nacl_common_win64',
407               'type': 'static_library',
408               'defines': [
409                 'COMPILE_CONTENT_STATICALLY',
410               ],
411               'sources': [
412                 'nacl/common/nacl_cmd_line.cc',
413                 'nacl/common/nacl_cmd_line.h',
414                 'nacl/common/nacl_constants.cc',
415                 'nacl/common/nacl_constants.h',
416                 'nacl/common/nacl_messages.cc',
417                 'nacl/common/nacl_messages.h',
418                 'nacl/common/nacl_renderer_messages.h',
419                 'nacl/common/nacl_renderer_messages.cc',
420                 'nacl/common/nacl_types.cc',
421                 'nacl/common/nacl_types.h',
422                 'nacl/common/nacl_types_param_traits.cc',
423                 'nacl/common/nacl_types_param_traits.h',
424               ],
425               'include_dirs': [
426                 '..',
427               ],
428               'configurations': {
429                 'Common_Base': {
430                   'msvs_target_platform': 'x64',
431                 },
432               },
433             },
434           ],
435         }],
436       ],
437     }, {  # else (disable_nacl==1)
438       'targets': [
439         {
440           'target_name': 'nacl',
441           'type': 'none',
442           'sources': [],
443         },
444       ],
445       'conditions': [
446         ['OS=="win"', {
447           'targets': [
448             {
449               'target_name': 'nacl_win64',
450               'type': 'none',
451               'sources': [],
452             },
453             {
454               'target_name': 'nacl_switches_win64',
455               'type': 'none',
456               'sources': [],
457             },
458           ],
459         }],
460       ],
461     }],
462     ['disable_nacl!=1 and test_isolation_mode!="noop"', {
463       'targets': [
464         {
465           'target_name': 'nacl_loader_unittests_run',
466           'type': 'none',
467           'dependencies': [
468             'nacl_loader_unittests',
469           ],
470           'includes': [
471             '../build/isolate.gypi',
472           ],
473           'sources': [
474             'nacl_loader_unittests.isolate',
475           ],
476         },
477       ],
478     }],
479   ],
480   'targets': [
481     {
482       'target_name': 'nacl_switches',
483       'type': 'static_library',
484       'sources': [
485         'nacl/common/nacl_switches.cc',
486         'nacl/common/nacl_switches.h',
487     ],
488       'include_dirs': [
489         '..',
490       ],
491     },
492     {
493       'target_name': 'nacl_common',
494       'type': 'static_library',
495       'sources': [
496         'nacl/common/nacl_cmd_line.cc',
497         'nacl/common/nacl_cmd_line.h',
498         'nacl/common/nacl_constants.cc',
499         'nacl/common/nacl_constants.h',
500         'nacl/common/nacl_host_messages.h',
501         'nacl/common/nacl_host_messages.cc',
502         'nacl/common/nacl_messages.cc',
503         'nacl/common/nacl_messages.h',
504         'nacl/common/nacl_nonsfi_util.cc',
505         'nacl/common/nacl_nonsfi_util.h',
506         'nacl/common/nacl_process_type.h',
507         'nacl/common/nacl_renderer_messages.h',
508         'nacl/common/nacl_renderer_messages.cc',
509         'nacl/common/nacl_sandbox_type_mac.h',
510         'nacl/common/nacl_types.cc',
511         'nacl/common/nacl_types.h',
512         'nacl/common/nacl_types_param_traits.cc',
513         'nacl/common/nacl_types_param_traits.h',
514         'nacl/common/pnacl_types.cc',
515         'nacl/common/pnacl_types.h',
516       ],
517       'include_dirs': [
518         '..',
519       ],
520       'dependencies': [
521         '../content/content.gyp:content_common',
522       ],
523     },
524   ]