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 copy |
5 import gyp | 6 import gyp |
6 import gyp.common | 7 import gyp.common |
7 import gyp.system_test | 8 import gyp.system_test |
8 import gyp.xcode_emulation | 9 import gyp.xcode_emulation |
9 import os.path | 10 import os.path |
10 import re | 11 import re |
11 import subprocess | 12 import subprocess |
12 import sys | 13 import sys |
13 | 14 |
14 import gyp.ninja_syntax as ninja_syntax | 15 import gyp.ninja_syntax as ninja_syntax |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 """Return the 'output' (full output path) to the binary in a bundle.""" | 824 """Return the 'output' (full output path) to the binary in a bundle.""" |
824 assert self.is_mac_bundle | 825 assert self.is_mac_bundle |
825 path = self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']) | 826 path = self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']) |
826 return os.path.join(path, self.xcode_settings.GetExecutablePath()) | 827 return os.path.join(path, self.xcode_settings.GetExecutablePath()) |
827 | 828 |
828 def ComputeOutputFileName(self, spec, type=None): | 829 def ComputeOutputFileName(self, spec, type=None): |
829 """Compute the filename of the final output for the current target.""" | 830 """Compute the filename of the final output for the current target.""" |
830 if not type: | 831 if not type: |
831 type = spec['type'] | 832 type = spec['type'] |
832 | 833 |
| 834 default_variables = copy.copy(generator_default_variables) |
| 835 CalculateVariables(default_variables, {'flavor': self.flavor}) |
| 836 |
833 # Compute filename prefix: the product prefix, or a default for | 837 # Compute filename prefix: the product prefix, or a default for |
834 # the product type. | 838 # the product type. |
835 if self.flavor == 'win': | 839 DEFAULT_PREFIX = { |
836 DEFAULT_PREFIX = { | 840 'loadable_module': default_variables['SHARED_LIB_PREFIX'], |
837 'loadable_module': '', | 841 'shared_library': default_variables['SHARED_LIB_PREFIX'], |
838 'shared_library': '', | 842 'static_library': default_variables['STATIC_LIB_PREFIX'], |
839 'static_library': '', | 843 'executable': default_variables['EXECUTABLE_PREFIX'], |
840 } | 844 } |
841 else: | |
842 DEFAULT_PREFIX = { | |
843 'loadable_module': 'lib', | |
844 'shared_library': 'lib', | |
845 'static_library': 'lib', | |
846 } | |
847 prefix = spec.get('product_prefix', DEFAULT_PREFIX.get(type, '')) | 845 prefix = spec.get('product_prefix', DEFAULT_PREFIX.get(type, '')) |
848 | 846 |
849 # Compute filename extension: the product extension, or a default | 847 # Compute filename extension: the product extension, or a default |
850 # for the product type. | 848 # for the product type. |
851 if self.flavor == 'win': | 849 DEFAULT_EXTENSION = { |
852 DEFAULT_EXTENSION = { | 850 'loadable_module': default_variables['SHARED_LIB_SUFFIX'], |
853 'static_library': 'lib', | 851 'shared_library': default_variables['SHARED_LIB_SUFFIX'], |
854 'loadable_module': 'dll', | 852 'static_library': default_variables['STATIC_LIB_SUFFIX'], |
855 'shared_library': 'dll', | 853 'executable': default_variables['EXECUTABLE_SUFFIX'], |
856 'executable': 'exe', | 854 } |
857 } | |
858 else: | |
859 DEFAULT_EXTENSION = { | |
860 'static_library': 'a', | |
861 'loadable_module': 'so', | |
862 'shared_library': 'so', | |
863 } | |
864 extension = spec.get('product_extension', | 855 extension = spec.get('product_extension', |
865 DEFAULT_EXTENSION.get(type, '')) | 856 DEFAULT_EXTENSION.get(type, '')) |
866 if extension: | |
867 extension = '.' + extension | |
868 | 857 |
869 if 'product_name' in spec: | 858 if 'product_name' in spec: |
870 # If we were given an explicit name, use that. | 859 # If we were given an explicit name, use that. |
871 target = spec['product_name'] | 860 target = spec['product_name'] |
872 else: | 861 else: |
873 # Otherwise, derive a name from the target name. | 862 # Otherwise, derive a name from the target name. |
874 target = spec['target_name'] | 863 target = spec['target_name'] |
875 if prefix == 'lib': | 864 if prefix == 'lib': |
876 # Snip out an extra 'lib' from libs if appropriate. | 865 # Snip out an extra 'lib' from libs if appropriate. |
877 target = StripPrefix(target, 'lib') | 866 target = StripPrefix(target, 'lib') |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 global generator_additional_non_configuration_keys | 976 global generator_additional_non_configuration_keys |
988 generator_additional_non_configuration_keys = getattr(xcode_generator, | 977 generator_additional_non_configuration_keys = getattr(xcode_generator, |
989 'generator_additional_non_configuration_keys', []) | 978 'generator_additional_non_configuration_keys', []) |
990 global generator_additional_path_sections | 979 global generator_additional_path_sections |
991 generator_additional_path_sections = getattr(xcode_generator, | 980 generator_additional_path_sections = getattr(xcode_generator, |
992 'generator_additional_path_sections', []) | 981 'generator_additional_path_sections', []) |
993 global generator_extra_sources_for_rules | 982 global generator_extra_sources_for_rules |
994 generator_extra_sources_for_rules = getattr(xcode_generator, | 983 generator_extra_sources_for_rules = getattr(xcode_generator, |
995 'generator_extra_sources_for_rules', []) | 984 'generator_extra_sources_for_rules', []) |
996 elif flavor == 'win': | 985 elif flavor == 'win': |
997 default_variables.setdefault('OS', 'win') | 986 default_variables['OS'] = 'win' |
998 default_variables.setdefault('EXECUTABLE_SUFFIX', '.exe') | 987 default_variables['EXECUTABLE_SUFFIX'] = '.exe' |
999 default_variables.setdefault('STATIC_LIB_PREFIX', '') | 988 default_variables['STATIC_LIB_PREFIX'] = '' |
1000 default_variables.setdefault('STATIC_LIB_SUFFIX', '.lib') | 989 default_variables['STATIC_LIB_SUFFIX'] = '.lib' |
1001 default_variables.setdefault('SHARED_LIB_PREFIX', '') | 990 default_variables['SHARED_LIB_PREFIX'] = '' |
1002 default_variables.setdefault('SHARED_LIB_SUFFIX', '.dll') | 991 default_variables['SHARED_LIB_SUFFIX'] = '.dll' |
1003 else: | 992 else: |
1004 operating_system = flavor | 993 operating_system = flavor |
1005 if flavor == 'android': | 994 if flavor == 'android': |
1006 operating_system = 'linux' # Keep this legacy behavior for now. | 995 operating_system = 'linux' # Keep this legacy behavior for now. |
1007 default_variables.setdefault('OS', operating_system) | 996 default_variables.setdefault('OS', operating_system) |
1008 default_variables.setdefault('SHARED_LIB_SUFFIX', '.so') | 997 default_variables.setdefault('SHARED_LIB_SUFFIX', '.so') |
1009 default_variables.setdefault('SHARED_LIB_DIR', | 998 default_variables.setdefault('SHARED_LIB_DIR', |
1010 os.path.join('$!PRODUCT_DIR', 'lib')) | 999 os.path.join('$!PRODUCT_DIR', 'lib')) |
1011 default_variables.setdefault('LIB_DIR', '') | 1000 default_variables.setdefault('LIB_DIR', '') |
1012 | 1001 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 | 1244 |
1256 user_config = params.get('generator_flags', {}).get('config', None) | 1245 user_config = params.get('generator_flags', {}).get('config', None) |
1257 if user_config: | 1246 if user_config: |
1258 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1247 GenerateOutputForConfig(target_list, target_dicts, data, params, |
1259 user_config) | 1248 user_config) |
1260 else: | 1249 else: |
1261 config_names = target_dicts[target_list[0]]['configurations'].keys() | 1250 config_names = target_dicts[target_list[0]]['configurations'].keys() |
1262 for config_name in config_names: | 1251 for config_name in config_names: |
1263 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1252 GenerateOutputForConfig(target_list, target_dicts, data, params, |
1264 config_name) | 1253 config_name) |
OLD | NEW |