[email protected] | 4223f8d | 2012-06-07 01:10:06 | [diff] [blame] | 1 | # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 1f081e7a | 2011-12-01 19:33:21 | [diff] [blame] | 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | # This GYP file defines untrusted (NaCl) targets. All targets in this |
| 6 | # file should be conditionally depended upon via 'disable_nacl!=1' to avoid |
| 7 | # requiring NaCl sources for building. |
| 8 | |
| 9 | { |
| 10 | 'includes': [ |
| 11 | '../native_client/build/untrusted.gypi', |
| 12 | 'ppapi_sources.gypi', |
| 13 | ], |
| 14 | 'targets': [ |
| 15 | { |
| 16 | 'target_name': 'ppapi_cpp_lib', |
| 17 | 'type': 'none', |
| 18 | 'variables': { |
| 19 | 'nlib_target': 'libppapi_cpp.a', |
[email protected] | ee82fab | 2012-09-24 22:14:34 | [diff] [blame] | 20 | 'nso_target': 'libppapi_cpp.so', |
[email protected] | 4223f8d | 2012-06-07 01:10:06 | [diff] [blame] | 21 | 'build_glibc': 1, |
[email protected] | 1f081e7a | 2011-12-01 19:33:21 | [diff] [blame] | 22 | 'build_newlib': 1, |
[email protected] | f7c2871 | 2013-01-24 23:11:33 | [diff] [blame] | 23 | 'build_pnacl_newlib': 1, |
[email protected] | 1f081e7a | 2011-12-01 19:33:21 | [diff] [blame] | 24 | 'sources': [ |
[email protected] | 7091950 | 2011-12-16 02:30:03 | [diff] [blame] | 25 | '<@(cpp_source_files)', |
[email protected] | 1f081e7a | 2011-12-01 19:33:21 | [diff] [blame] | 26 | 'cpp/module_embedder.h', |
| 27 | 'cpp/ppp_entrypoints.cc', |
| 28 | ], |
| 29 | }, |
| 30 | 'dependencies': [ |
| 31 | '<(DEPTH)/native_client/tools.gyp:prep_toolchain', |
| 32 | ], |
| 33 | }, |
| 34 | { |
[email protected] | ff92200c | 2012-09-10 21:58:16 | [diff] [blame] | 35 | 'target_name': 'ppapi_gles2_lib', |
| 36 | 'type': 'none', |
| 37 | 'variables': { |
| 38 | 'nlib_target': 'libppapi_gles2.a', |
[email protected] | ee82fab | 2012-09-24 22:14:34 | [diff] [blame] | 39 | 'nso_target': 'libppapi_gles2.so', |
[email protected] | ff92200c | 2012-09-10 21:58:16 | [diff] [blame] | 40 | 'build_glibc': 1, |
| 41 | 'build_newlib': 1, |
[email protected] | f7c2871 | 2013-01-24 23:11:33 | [diff] [blame] | 42 | 'build_pnacl_newlib': 1, |
[email protected] | ff92200c | 2012-09-10 21:58:16 | [diff] [blame] | 43 | 'include_dirs': [ |
| 44 | 'lib/gl/include', |
| 45 | ], |
| 46 | 'sources': [ |
| 47 | 'lib/gl/gles2/gl2ext_ppapi.c', |
| 48 | 'lib/gl/gles2/gl2ext_ppapi.h', |
| 49 | 'lib/gl/gles2/gles2.c', |
| 50 | ], |
| 51 | }, |
| 52 | 'dependencies': [ |
| 53 | '<(DEPTH)/native_client/tools.gyp:prep_toolchain', |
| 54 | ], |
| 55 | }, |
| 56 | { |
[email protected] | 1f081e7a | 2011-12-01 19:33:21 | [diff] [blame] | 57 | 'target_name': 'ppapi_nacl_tests', |
| 58 | 'type': 'none', |
| 59 | 'dependencies': [ |
[email protected] | ee82fab | 2012-09-24 22:14:34 | [diff] [blame] | 60 | '<(DEPTH)/native_client/src/untrusted/nacl/nacl.gyp:nacl_lib', |
[email protected] | 1f081e7a | 2011-12-01 19:33:21 | [diff] [blame] | 61 | 'ppapi_cpp_lib', |
| 62 | 'native_client/native_client.gyp:ppapi_lib', |
[email protected] | 3b74078c | 2012-08-03 01:01:52 | [diff] [blame] | 63 | ], |
[email protected] | 1f081e7a | 2011-12-01 19:33:21 | [diff] [blame] | 64 | 'variables': { |
[email protected] | 3b74078c | 2012-08-03 01:01:52 | [diff] [blame] | 65 | # TODO(bradnelson): Remove this compile flag once new nacl_rev is |
| 66 | # above 9362. |
| 67 | 'compile_flags': [ |
| 68 | '-DGL_GLEXT_PROTOTYPES', |
| 69 | ], |
[email protected] | a070d168 | 2013-03-27 07:40:56 | [diff] [blame^] | 70 | # Speed up pnacl linking by not generating debug info for tests. |
| 71 | # We compile with --strip-all under extra_args so debug info is |
| 72 | # discarded anyway. Remove this and the --strip-all flag if |
| 73 | # debug info is really needed. |
| 74 | 'compile_flags!': [ |
| 75 | '-g', |
| 76 | ], |
[email protected] | 3b74078c | 2012-08-03 01:01:52 | [diff] [blame] | 77 | 'defines': [ |
| 78 | 'GL_GLEXT_PROTOTYPES', |
| 79 | ], |
[email protected] | 1f081e7a | 2011-12-01 19:33:21 | [diff] [blame] | 80 | 'nexe_target': 'ppapi_nacl_tests', |
[email protected] | 1f081e7a | 2011-12-01 19:33:21 | [diff] [blame] | 81 | 'build_newlib': 1, |
| 82 | 'include_dirs': [ |
| 83 | 'lib/gl/include', |
| 84 | '..', |
| 85 | ], |
| 86 | 'link_flags': [ |
| 87 | '-lppapi_cpp', |
| 88 | '-lppapi', |
[email protected] | ad854a8ca | 2012-11-19 22:20:29 | [diff] [blame] | 89 | '-pthread', |
[email protected] | 1f081e7a | 2011-12-01 19:33:21 | [diff] [blame] | 90 | ], |
[email protected] | a070d168 | 2013-03-27 07:40:56 | [diff] [blame^] | 91 | 'link_flags!': [ |
| 92 | '-O3', |
| 93 | ], |
| 94 | 'translate_flags': [ |
| 95 | '-O0', |
| 96 | ], |
[email protected] | ebd08aa | 2012-05-22 19:54:38 | [diff] [blame] | 97 | # TODO(bradchen): get rid of extra_deps64 and extra_deps32 |
| 98 | # once native_client/build/untrusted.gypi no longer needs them. |
[email protected] | ebd08aa | 2012-05-22 19:54:38 | [diff] [blame] | 99 | 'extra_deps_newlib64': [ |
| 100 | '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppapi_cpp.a', |
| 101 | '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppapi.a', |
| 102 | ], |
| 103 | 'extra_deps_newlib32': [ |
| 104 | '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libppapi_cpp.a', |
| 105 | '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libppapi.a', |
| 106 | ], |
| 107 | 'extra_deps_glibc64': [ |
[email protected] | e816cc5 | 2012-11-22 03:15:06 | [diff] [blame] | 108 | '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libppapi_cpp.so', |
| 109 | '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libppapi.so', |
[email protected] | ebd08aa | 2012-05-22 19:54:38 | [diff] [blame] | 110 | ], |
| 111 | 'extra_deps_glibc32': [ |
[email protected] | e816cc5 | 2012-11-22 03:15:06 | [diff] [blame] | 112 | '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libppapi_cpp.so', |
| 113 | '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libppapi.so', |
[email protected] | ebd08aa | 2012-05-22 19:54:38 | [diff] [blame] | 114 | ], |
[email protected] | 5386cb24 | 2012-04-03 16:14:52 | [diff] [blame] | 115 | 'extra_deps_arm': [ |
| 116 | '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libppapi_cpp.a', |
| 117 | '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libppapi.a', |
| 118 | ], |
[email protected] | 1e40ba00 | 2013-03-07 22:07:33 | [diff] [blame] | 119 | 'extra_deps_pnacl': [ |
| 120 | '<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_newlib/lib/libppapi_cpp.a', |
| 121 | '<(SHARED_INTERMEDIATE_DIR)/tc_pnacl_newlib/lib/libppapi.a', |
| 122 | ], |
[email protected] | 1f081e7a | 2011-12-01 19:33:21 | [diff] [blame] | 123 | 'sources': [ |
[email protected] | 7091950 | 2011-12-16 02:30:03 | [diff] [blame] | 124 | '<@(test_common_source_files)', |
| 125 | '<@(test_nacl_source_files)', |
[email protected] | 1f081e7a | 2011-12-01 19:33:21 | [diff] [blame] | 126 | ], |
[email protected] | 8eca7f0 | 2013-01-26 06:06:31 | [diff] [blame] | 127 | 'extra_args': [ |
| 128 | '--strip-all', |
| 129 | ], |
[email protected] | 1f081e7a | 2011-12-01 19:33:21 | [diff] [blame] | 130 | }, |
[email protected] | 4223f8d | 2012-06-07 01:10:06 | [diff] [blame] | 131 | 'conditions': [ |
[email protected] | 46c9a05 | 2012-06-27 19:27:26 | [diff] [blame] | 132 | ['target_arch!="arm"', { |
[email protected] | 1e40ba00 | 2013-03-07 22:07:33 | [diff] [blame] | 133 | # This is user code (vs IRT code), so tls accesses do not |
| 134 | # need to be indirect through a function call. |
| 135 | # For PNaCl, the -mtls-use-call flag is localized to the |
| 136 | # IRT's translation command, so it is unnecessary to |
| 137 | # counteract that flag here. |
[email protected] | 46c9a05 | 2012-06-27 19:27:26 | [diff] [blame] | 138 | 'variables': { |
[email protected] | 1e40ba00 | 2013-03-07 22:07:33 | [diff] [blame] | 139 | 'gcc_compile_flags': [ |
[email protected] | 46c9a05 | 2012-06-27 19:27:26 | [diff] [blame] | 140 | '-mno-tls-use-call', |
[email protected] | 2ed9c04 | 2012-12-04 07:23:35 | [diff] [blame] | 141 | ], |
[email protected] | 46c9a05 | 2012-06-27 19:27:26 | [diff] [blame] | 142 | }, |
| 143 | }], |
[email protected] | 2f7da67 | 2012-06-21 08:38:32 | [diff] [blame] | 144 | ['target_arch!="arm" and disable_glibc==0', { |
[email protected] | 4223f8d | 2012-06-07 01:10:06 | [diff] [blame] | 145 | 'variables': { |
| 146 | 'build_glibc': 1, |
| 147 | # NOTE: Use /lib, not /lib64 here; it is a symbolic link which |
| 148 | # doesn't work on Windows. |
| 149 | 'libdir_glibc64': '>(nacl_glibc_tc_root)/x86_64-nacl/lib', |
| 150 | 'libdir_glibc32': '>(nacl_glibc_tc_root)/x86_64-nacl/lib32', |
| 151 | 'nacl_objdump': '>(nacl_glibc_tc_root)/bin/x86_64-nacl-objdump', |
| 152 | 'nmf_glibc%': '<(PRODUCT_DIR)/>(nexe_target)_glibc.nmf', |
| 153 | }, |
| 154 | 'actions': [ |
| 155 | { |
| 156 | 'action_name': 'Generate GLIBC NMF and copy libs', |
| 157 | 'inputs': ['>(out_glibc64)', '>(out_glibc32)'], |
| 158 | # NOTE: There is no explicit dependency for the lib32 |
| 159 | # and lib64 directories created in the PRODUCT_DIR. |
| 160 | # They are created as a side-effect of NMF creation. |
| 161 | 'outputs': ['>(nmf_glibc)'], |
| 162 | 'action': [ |
| 163 | 'python', |
| 164 | '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py', |
| 165 | '>@(_inputs)', |
| 166 | '--objdump=>(nacl_objdump)', |
| 167 | '--library-path=>(libdir_glibc64)', |
| 168 | '--library-path=>(libdir_glibc32)', |
[email protected] | ee82fab | 2012-09-24 22:14:34 | [diff] [blame] | 169 | '--library-path=<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32', |
| 170 | '--library-path=<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64', |
[email protected] | 4223f8d | 2012-06-07 01:10:06 | [diff] [blame] | 171 | '--output=>(nmf_glibc)', |
| 172 | '--stage-dependencies=<(PRODUCT_DIR)', |
| 173 | ], |
[email protected] | 8801db19 | 2012-12-17 22:23:53 | [diff] [blame] | 174 | 'msvs_cygwin_shell': 1, |
[email protected] | 4223f8d | 2012-06-07 01:10:06 | [diff] [blame] | 175 | }, |
| 176 | ], |
| 177 | }], |
[email protected] | 1e40ba00 | 2013-03-07 22:07:33 | [diff] [blame] | 178 | # Test PNaCl pre-translated code (pre-translated to save bot time). |
| 179 | # We only care about testing that code generation is correct, |
| 180 | # and in-browser translation is tested elsewhere. |
| 181 | # NOTE: native_client/build/untrusted.gypi dictates that |
| 182 | # PNaCl only generate x86-32 and x86-64 on x86 platforms, |
| 183 | # or ARM on ARM platforms, not all versions always. |
| 184 | # The same goes for the PNaCl shims. So, we have two variations here. |
| 185 | ['disable_pnacl==0 and target_arch!="arm"', { |
| 186 | 'variables': { |
| 187 | 'build_pnacl_newlib': 1, |
| 188 | 'nmf_pnacl%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl.nmf', |
| 189 | }, |
| 190 | # Shim is a dependency for the nexe because we pre-translate. |
| 191 | 'dependencies': [ |
| 192 | '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim', |
| 193 | ], |
| 194 | 'actions': [ |
| 195 | { |
| 196 | 'action_name': 'Generate PNACL NEWLIB NMF', |
| 197 | 'inputs': ['>(out_pnacl_newlib_x86_32_nexe)', |
| 198 | '>(out_pnacl_newlib_x86_64_nexe)'], |
| 199 | 'outputs': ['>(nmf_pnacl)'], |
| 200 | 'action': [ |
| 201 | 'python', |
| 202 | '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py', |
| 203 | '>@(_inputs)', |
| 204 | '--output=>(nmf_pnacl)', |
| 205 | ], |
| 206 | }, |
| 207 | ], |
| 208 | }], |
| 209 | ['disable_pnacl==0 and target_arch=="arm"', { |
| 210 | 'variables': { |
| 211 | 'build_pnacl_newlib': 1, |
| 212 | 'nmf_pnacl%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl.nmf', |
| 213 | }, |
| 214 | # Shim is a dependency for the nexe because we pre-translate. |
| 215 | 'dependencies': [ |
| 216 | '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim', |
| 217 | ], |
| 218 | 'actions': [ |
| 219 | { |
| 220 | 'action_name': 'Generate PNACL NEWLIB NMF', |
| 221 | 'inputs': ['>(out_pnacl_newlib_arm_nexe)'], |
| 222 | 'outputs': ['>(nmf_pnacl)'], |
| 223 | 'action': [ |
| 224 | 'python', |
| 225 | '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py', |
| 226 | '>@(_inputs)', |
| 227 | '--output=>(nmf_pnacl)', |
| 228 | ], |
| 229 | }, |
| 230 | ], |
| 231 | }], |
[email protected] | 4223f8d | 2012-06-07 01:10:06 | [diff] [blame] | 232 | ], |
[email protected] | 1f081e7a | 2011-12-01 19:33:21 | [diff] [blame] | 233 | }, |
| 234 | ], |
| 235 | } |