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 filecmp | 5 import filecmp |
6 import gyp.common | 6 import gyp.common |
7 import gyp.xcodeproj_file | 7 import gyp.xcodeproj_file |
8 import errno | 8 import errno |
9 import os | 9 import os |
10 import sys | 10 import sys |
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1186 # no compelling reason for Xcode's linker invocations to differ. | 1186 # no compelling reason for Xcode's linker invocations to differ. |
1187 | 1187 |
1188 if 'dependencies' in spec: | 1188 if 'dependencies' in spec: |
1189 for dependency in spec['dependencies']: | 1189 for dependency in spec['dependencies']: |
1190 xct.AddDependency(xcode_targets[dependency]) | 1190 xct.AddDependency(xcode_targets[dependency]) |
1191 # The support project also gets the dependencies (in case they are | 1191 # The support project also gets the dependencies (in case they are |
1192 # needed for the actions/rules to work). | 1192 # needed for the actions/rules to work). |
1193 if support_xct: | 1193 if support_xct: |
1194 support_xct.AddDependency(xcode_targets[dependency]) | 1194 support_xct.AddDependency(xcode_targets[dependency]) |
1195 | 1195 |
1196 def Quote(s): | |
1197 return '"%s"' % s | |
Mark Mentovai
2013/05/29 13:23:07
?
This isn’t the right way to quote something. Wh
Dimi Shahbaz
2013/05/29 21:32:41
Done.
| |
1198 | |
1196 if 'libraries' in spec: | 1199 if 'libraries' in spec: |
1197 for library in spec['libraries']: | 1200 for library in spec['libraries']: |
1198 xct.FrameworksPhase().AddFile(library) | 1201 xct.FrameworksPhase().AddFile(library) |
1199 # Add the library's directory to LIBRARY_SEARCH_PATHS if necessary. | 1202 # Add the library's directory to LIBRARY_SEARCH_PATHS if necessary. |
1200 # I wish Xcode handled this automatically. | 1203 # I wish Xcode handled this automatically. |
1201 library_dir = posixpath.dirname(library) | 1204 library_dir = posixpath.dirname(library) |
1202 if library_dir not in xcode_standard_library_dirs and ( | 1205 if library_dir not in xcode_standard_library_dirs and ( |
1203 not xct.HasBuildSetting(_library_search_paths_var) or | 1206 not xct.HasBuildSetting(_library_search_paths_var) or |
1204 library_dir not in xct.GetBuildSetting(_library_search_paths_var)): | 1207 library_dir not in xct.GetBuildSetting(_library_search_paths_var)): |
1205 xct.AppendBuildSetting(_library_search_paths_var, library_dir) | 1208 xct.AppendBuildSetting(_library_search_paths_var, library_dir) |
1206 | 1209 |
1207 for configuration_name in configuration_names: | 1210 for configuration_name in configuration_names: |
1208 configuration = spec['configurations'][configuration_name] | 1211 configuration = spec['configurations'][configuration_name] |
1209 xcbc = xct.ConfigurationNamed(configuration_name) | 1212 xcbc = xct.ConfigurationNamed(configuration_name) |
1210 for include_dir in configuration.get('mac_framework_dirs', []): | 1213 for include_dir in configuration.get('mac_framework_dirs', []): |
1211 xcbc.AppendBuildSetting('FRAMEWORK_SEARCH_PATHS', include_dir) | 1214 xcbc.AppendBuildSetting('FRAMEWORK_SEARCH_PATHS', include_dir) |
1212 for include_dir in configuration.get('include_dirs', []): | 1215 for include_dir in configuration.get('include_dirs', []): |
1213 xcbc.AppendBuildSetting('HEADER_SEARCH_PATHS', include_dir) | 1216 xcbc.AppendBuildSetting('HEADER_SEARCH_PATHS', include_dir) |
1217 for library_dir in configuration.get('library_dirs', []): | |
1218 if library_dir not in xcode_standard_library_dirs and ( | |
1219 not xcbc.HasBuildSetting(_library_search_paths_var) or | |
1220 library_dir not in xcbc.GetBuildSetting(_library_search_paths_var)): | |
1221 xcbc.AppendBuildSetting(_library_search_paths_var, Quote(library_dir)) | |
1222 | |
1214 if 'defines' in configuration: | 1223 if 'defines' in configuration: |
1215 for define in configuration['defines']: | 1224 for define in configuration['defines']: |
1216 set_define = EscapeXCodeArgument(define) | 1225 set_define = EscapeXCodeArgument(define) |
1217 xcbc.AppendBuildSetting('GCC_PREPROCESSOR_DEFINITIONS', set_define) | 1226 xcbc.AppendBuildSetting('GCC_PREPROCESSOR_DEFINITIONS', set_define) |
1218 if 'xcode_settings' in configuration: | 1227 if 'xcode_settings' in configuration: |
1219 for xck, xcv in configuration['xcode_settings'].iteritems(): | 1228 for xck, xcv in configuration['xcode_settings'].iteritems(): |
1220 xcbc.SetBuildSetting(xck, xcv) | 1229 xcbc.SetBuildSetting(xck, xcv) |
1221 if 'xcode_config_file' in configuration: | 1230 if 'xcode_config_file' in configuration: |
1222 config_ref = pbxp.AddOrGetFileInRootGroup( | 1231 config_ref = pbxp.AddOrGetFileInRootGroup( |
1223 configuration['xcode_config_file']) | 1232 configuration['xcode_config_file']) |
1224 xcbc.SetBaseConfiguration(config_ref) | 1233 xcbc.SetBaseConfiguration(config_ref) |
1225 | 1234 |
1226 build_files = [] | 1235 build_files = [] |
1227 for build_file, build_file_dict in data.iteritems(): | 1236 for build_file, build_file_dict in data.iteritems(): |
1228 if build_file.endswith('.gyp'): | 1237 if build_file.endswith('.gyp'): |
1229 build_files.append(build_file) | 1238 build_files.append(build_file) |
1230 | 1239 |
1231 for build_file in build_files: | 1240 for build_file in build_files: |
1232 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) | 1241 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) |
1233 | 1242 |
1234 for build_file in build_files: | 1243 for build_file in build_files: |
1235 xcode_projects[build_file].Finalize2(xcode_targets, | 1244 xcode_projects[build_file].Finalize2(xcode_targets, |
1236 xcode_target_to_target_dict) | 1245 xcode_target_to_target_dict) |
1237 | 1246 |
1238 for build_file in build_files: | 1247 for build_file in build_files: |
1239 xcode_projects[build_file].Write() | 1248 xcode_projects[build_file].Write() |
OLD | NEW |