Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: native_client_sdk/src/build_tools/build.scons

Issue 8785002: Updated SDK scons files to handle new gyp file format in ppapi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #! -*- python -*- 1 #! -*- python -*-
2 # 2 #
3 # Copyright (c) 2011 The Native Client Authors. All rights reserved. 3 # Copyright (c) 2011 The Native Client Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Build file for running scripts in the build_tools directory 7 """Build file for running scripts in the build_tools directory
8 8
9 Adapted from scons documentation: http://www.scons.org/wiki/UnitTests 9 Adapted from scons documentation: http://www.scons.org/wiki/UnitTests
10 and from ../project_templates/test.scons 10 and from ../project_templates/test.scons
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 if env['IS_WINDOWS']: 125 if env['IS_WINDOWS']:
126 AddPythonUnitTest('run_install_nsis_test', 'tests/install_nsis_test.py') 126 AddPythonUnitTest('run_install_nsis_test', 'tests/install_nsis_test.py')
127 AddPythonUnitTest('run_nsis_script_test', 'tests/nsis_script_test.py') 127 AddPythonUnitTest('run_nsis_script_test', 'tests/nsis_script_test.py')
128 128
129 129
130 #------------------------------------------------------------------------------ 130 #------------------------------------------------------------------------------
131 # Put together the toolchain 131 # Put together the toolchain
132 132
133 import gyp_extract 133 import gyp_extract
134 import re
135
136 def GypSources(gyp_data, pattern):
137 """Extract a sources from a target matching a given pattern.
138
139 Args:
140 gyp_data: list containing sources from gyp file.
141 pattern: re pattern that sources must match.
142 Returns:
143 A list of strings containing source filenames.
144 """
145 # Extract source files that match.
146 re_compiled = re.compile(pattern)
147 return [source_file for source_file in gyp_data
148 if re_compiled.match(source_file)]
134 149
135 ppapi_base = os.path.join(env['SRC_DIR'], 'ppapi') 150 ppapi_base = os.path.join(env['SRC_DIR'], 'ppapi')
136 151
152 # Unfortunately gyp_extract does not handle variables or includes so we must
153 # pull the list of sources from ppapi_sources.gypi directly.
154 ppapi_sources_gypi = open(os.path.join(ppapi_base,
155 'ppapi_sources.gypi'), 'r').read()
156 ppapi_sources_map = eval(ppapi_sources_gypi)['variables']
157
137 # Load ppapi_cpp.gypi 158 # Load ppapi_cpp.gypi
138 ppapi_cpp_gypi = gyp_extract.LoadGypFile(os.path.join(ppapi_base, 159 ppapi_cpp_gypi = gyp_extract.LoadGypFile(os.path.join(ppapi_base,
139 'ppapi_cpp.gypi')) 160 'ppapi_cpp.gypi'))
140 161
141 # Load ppapi_gl.gypi 162 # Load ppapi_gl.gypi
142 ppapi_gl_gypi = gyp_extract.LoadGypFile(os.path.join(ppapi_base, 163 ppapi_gl_gypi = gyp_extract.LoadGypFile(os.path.join(ppapi_base,
143 'ppapi_gl.gypi')) 164 'ppapi_gl.gypi'))
144 165
145 # From ppapi_cpp.gypi:ppapi_c:c/[^/]*\.h 166 # From ppapi_cpp.gypi:ppapi_c:c/[^/]*\.h
146 c_headers = gyp_extract.GypTargetSources( 167 c_headers = GypSources(ppapi_sources_map['c_sources'], 'c/[^/]*\.h')
147 ppapi_cpp_gypi, 'ppapi_c', 'c/[^/]*\.h')
148 168
149 # From ppapi_cpp.gypi:ppapi_c:c/dev/[^/]*\.h 169 # From ppapi_cpp.gypi:ppapi_c:c/dev/[^/]*\.h
150 c_dev_headers = gyp_extract.GypTargetSources( 170 c_dev_headers = GypSources(ppapi_sources_map['c_sources'], 'c/dev/[^/]*\.h')
151 ppapi_cpp_gypi, 'ppapi_c', 'c/dev/[^/]*\.h')
152 171
153 # From ppapi_cpp.gypi:ppapi_cpp_objects:cpp/[^/]*\.h 172 # From ppapi_cpp.gypi:ppapi_cpp_objects:cpp/[^/]*\.h
154 # From ppapi_cpp.gypi:ppapi_cpp:cpp/[^/]*\.h 173 # From ppapi_cpp.gypi:ppapi_cpp:cpp/[^/]*\.h
155 cpp_headers = ( 174 cpp_headers = (
156 gyp_extract.GypTargetSources( 175 GypSources(ppapi_sources_map['cpp_sources'], 'cpp/[^/]*\.h') +
157 ppapi_cpp_gypi, 'ppapi_cpp_objects', 'cpp/[^/]*\.h') +
158 gyp_extract.GypTargetSources( 176 gyp_extract.GypTargetSources(
159 ppapi_cpp_gypi, 'ppapi_cpp', 'cpp/[^/]*\.h') 177 ppapi_cpp_gypi, 'ppapi_cpp', 'cpp/[^/]*\.h')
160 ) 178 )
161 179
162 # From ppapi_cpp.gypi:ppapi_cpp_objects:cpp/dev/[^/]*\.h 180 # From ppapi_cpp.gypi:ppapi_cpp_objects:cpp/dev/[^/]*\.h
163 cpp_dev_headers = gyp_extract.GypTargetSources( 181 cpp_dev_headers = GypSources(ppapi_sources_map['cpp_sources'],
164 ppapi_cpp_gypi, 'ppapi_cpp_objects', 'cpp/dev/[^/]*\.h') 182 'cpp/dev/[^/]*\.h')
165 183
166 # From ppapi_gl.gypi:ppapi_gles2:.*\.h 184 # From ppapi_gl.gypi:ppapi_gles2:.*\.h
167 gles2_headers = gyp_extract.GypTargetSources( 185 gles2_headers = gyp_extract.GypTargetSources(
168 ppapi_gl_gypi, 'ppapi_gles2', '.*\.h') 186 ppapi_gl_gypi, 'ppapi_gles2', '.*\.h')
169 187
170 188
171 c_header_install = env.AddHeaderToSdk( 189 c_header_install = env.AddHeaderToSdk(
172 [os.path.join(ppapi_base, h) for h in c_headers], os.path.join('ppapi', 'c')) 190 [os.path.join(ppapi_base, h) for h in c_headers], os.path.join('ppapi', 'c'))
173 c_dev_header_install = env.AddHeaderToSdk( 191 c_dev_header_install = env.AddHeaderToSdk(
174 [os.path.join(ppapi_base, h) for h in c_dev_headers], 192 [os.path.join(ppapi_base, h) for h in c_dev_headers],
175 os.path.join('ppapi', 'c', 'dev')) 193 os.path.join('ppapi', 'c', 'dev'))
176 cpp_header_install = env.AddHeaderToSdk( 194 cpp_header_install = env.AddHeaderToSdk(
177 [os.path.join(ppapi_base, h) for h in cpp_headers], 195 [os.path.join(ppapi_base, h) for h in cpp_headers],
178 os.path.join('ppapi', 'cpp')) 196 os.path.join('ppapi', 'cpp'))
179 cpp_dev_header_install = env.AddHeaderToSdk( 197 cpp_dev_header_install = env.AddHeaderToSdk(
180 [os.path.join(ppapi_base, h) for h in cpp_dev_headers], 198 [os.path.join(ppapi_base, h) for h in cpp_dev_headers],
181 os.path.join('ppapi', 'cpp', 'dev')) 199 os.path.join('ppapi', 'cpp', 'dev'))
182 200
183 # TODO(dspringer): Remove these lines when trusted ppapi builds are no longer 201 # TODO(dspringer): Remove these lines when trusted ppapi builds are no longer
184 # needed for debugging. 202 # needed for debugging.
185 # -------- 8< Cut here -------- 203 # -------- 8< Cut here --------
186 # From ppapi_cpp.gypi:ppapi_cpp_objects:cpp/[^/]*\.cc 204 # From ppapi_cpp.gypi:ppapi_cpp_objects:cpp/[^/]*\.cc
187 # From ppapi_cpp.gypi:ppapi_cpp:cpp/[^/]*\.cc 205 # From ppapi_cpp.gypi:ppapi_cpp:cpp/[^/]*\.cc
188 cpp_trusted_sources = ( 206 cpp_trusted_sources = (
189 gyp_extract.GypTargetSources( 207 GypSources(ppapi_sources_map['cpp_sources'], 'cpp/[^/]*\.cc') +
190 ppapi_cpp_gypi, 'ppapi_cpp_objects', 'cpp/[^/]*\.cc') +
191 gyp_extract.GypTargetSources( 208 gyp_extract.GypTargetSources(
192 ppapi_cpp_gypi, 'ppapi_cpp', 'cpp/[^/]*\.cc') 209 ppapi_cpp_gypi, 'ppapi_cpp', 'cpp/[^/]*\.cc')
193 ) 210 )
194 211
195 cpp_trusted_source_install = env.AddHeaderToSdk( 212 cpp_trusted_source_install = env.AddHeaderToSdk(
196 [os.path.join(ppapi_base, cpp) for cpp in cpp_trusted_sources], 213 [os.path.join(ppapi_base, cpp) for cpp in cpp_trusted_sources],
197 subdir=os.path.join('ppapi', 'cpp'), 214 subdir=os.path.join('ppapi', 'cpp'),
198 base_dirs=[os.path.join(env['ROOT_DIR'], 'third_party')]) 215 base_dirs=[os.path.join(env['ROOT_DIR'], 'third_party')])
199 # -------- 8< Cut here -------- 216 # -------- 8< Cut here --------
200 217
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 for dir in env['NACL_TOOLCHAIN_ROOTS'].values(): 294 for dir in env['NACL_TOOLCHAIN_ROOTS'].values():
278 all_tools += [os.path.join(dir, tool) for tool in tools] 295 all_tools += [os.path.join(dir, tool) for tool in tools]
279 296
280 nacl_tools_cmd = env.Command(all_tools, 297 nacl_tools_cmd = env.Command(all_tools,
281 ['make_nacl_tools.py', 298 ['make_nacl_tools.py',
282 os.path.join(env['SRC_DIR'], 'DEPS')], 299 os.path.join(env['SRC_DIR'], 'DEPS')],
283 build_nacl_tools) 300 build_nacl_tools)
284 env.Depends(nacl_tools_cmd, env.GetHeadersNode()) 301 env.Depends(nacl_tools_cmd, env.GetHeadersNode())
285 env.Depends(env.GetToolchainNode(), nacl_tools_cmd) 302 env.Depends(env.GetToolchainNode(), nacl_tools_cmd)
286 env.AddCleanAction([], build_nacl_tools, ['toolchain', 'bot'], nacl_tools_cmd) 303 env.AddCleanAction([], build_nacl_tools, ['toolchain', 'bot'], nacl_tools_cmd)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698