| OLD | NEW |
| 1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import gyp | 5 import gyp |
| 6 import gyp.common | 6 import gyp.common |
| 7 import gyp.SCons as SCons | 7 import gyp.SCons as SCons |
| 8 import os.path | 8 import os.path |
| 9 import pprint | 9 import pprint |
| 10 import re | 10 import re |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 This provides the main translation between the (lower-case) gyp settings | 207 This provides the main translation between the (lower-case) gyp settings |
| 208 keywords and the (upper-case) SCons construction variables. | 208 keywords and the (upper-case) SCons construction variables. |
| 209 """ | 209 """ |
| 210 var_mapping = { | 210 var_mapping = { |
| 211 'ASFLAGS' : 'asflags', | 211 'ASFLAGS' : 'asflags', |
| 212 'CCFLAGS' : 'cflags', | 212 'CCFLAGS' : 'cflags', |
| 213 'CFLAGS' : 'cflags_c', | 213 'CFLAGS' : 'cflags_c', |
| 214 'CXXFLAGS' : 'cflags_cc', | 214 'CXXFLAGS' : 'cflags_cc', |
| 215 'CPPDEFINES' : 'defines', | 215 'CPPDEFINES' : 'defines', |
| 216 'CPPPATH' : 'include_dirs', | 216 'CPPPATH' : 'include_dirs', |
| 217 'LIBPATH' : 'library_dirs', |
| 217 # Add the ldflags value to $LINKFLAGS, but not $SHLINKFLAGS. | 218 # Add the ldflags value to $LINKFLAGS, but not $SHLINKFLAGS. |
| 218 # SCons defines $SHLINKFLAGS to incorporate $LINKFLAGS, so | 219 # SCons defines $SHLINKFLAGS to incorporate $LINKFLAGS, so |
| 219 # listing both here would case 'ldflags' to get appended to | 220 # listing both here would case 'ldflags' to get appended to |
| 220 # both, and then have it show up twice on the command line. | 221 # both, and then have it show up twice on the command line. |
| 221 'LINKFLAGS' : 'ldflags', | 222 'LINKFLAGS' : 'ldflags', |
| 222 } | 223 } |
| 223 postamble='\n%s],\n' % indent | 224 postamble='\n%s],\n' % indent |
| 224 for scons_var in sorted(var_mapping.keys()): | 225 for scons_var in sorted(var_mapping.keys()): |
| 225 gyp_var = var_mapping[scons_var] | 226 gyp_var = var_mapping[scons_var] |
| 226 value = config.get(gyp_var) | 227 value = config.get(gyp_var) |
| 227 if value: | 228 if value: |
| 228 if gyp_var in ('defines',): | 229 if gyp_var in ('defines',): |
| 229 value = [EscapeCppDefine(v) for v in value] | 230 value = [EscapeCppDefine(v) for v in value] |
| 230 if gyp_var in ('include_dirs',): | 231 if gyp_var in ('library_dirs', 'include_dirs',): |
| 231 if src_dir and not src_dir.endswith('/'): | 232 if src_dir and not src_dir.endswith('/'): |
| 232 src_dir += '/' | 233 src_dir += '/' |
| 233 result = [] | 234 result = [] |
| 234 for v in value: | 235 for v in value: |
| 235 v = FixPath(v, src_dir) | 236 v = FixPath(v, src_dir) |
| 236 # Force SCons to evaluate the CPPPATH directories at | 237 # Force SCons to evaluate the CPPPATH directories at |
| 237 # SConscript-read time, so delayed evaluation of $SRC_DIR | 238 # SConscript-read time, so delayed evaluation of $SRC_DIR |
| 238 # doesn't point it to the --generator-output= directory. | 239 # doesn't point it to the --generator-output= directory. |
| 239 result.append('env.Dir(%r)' % v) | 240 result.append('env.Dir(%r)' % v) |
| 240 value = result | 241 value = result |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 bf, target = gyp.common.ParseQualifiedTarget(t)[:2] | 1039 bf, target = gyp.common.ParseQualifiedTarget(t)[:2] |
| 1039 target_filename = TargetFilename(target, bf, options.suffix) | 1040 target_filename = TargetFilename(target, bf, options.suffix) |
| 1040 tpath = gyp.common.RelativePath(target_filename, output_dir) | 1041 tpath = gyp.common.RelativePath(target_filename, output_dir) |
| 1041 sconscript_files[target] = tpath | 1042 sconscript_files[target] = tpath |
| 1042 | 1043 |
| 1043 output_filename = output_path(output_filename) | 1044 output_filename = output_path(output_filename) |
| 1044 if sconscript_files: | 1045 if sconscript_files: |
| 1045 GenerateSConscriptWrapper(build_file, data[build_file], basename, | 1046 GenerateSConscriptWrapper(build_file, data[build_file], basename, |
| 1046 output_filename, sconscript_files, | 1047 output_filename, sconscript_files, |
| 1047 default_configuration) | 1048 default_configuration) |
| OLD | NEW |