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.system_test | 7 import gyp.system_test |
8 import gyp.xcode_emulation | 8 import gyp.xcode_emulation |
9 import os.path | 9 import os.path |
10 import re | 10 import re |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
824 path = self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']) | 824 path = self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']) |
825 return os.path.join(path, self.xcode_settings.GetExecutablePath()) | 825 return os.path.join(path, self.xcode_settings.GetExecutablePath()) |
826 | 826 |
827 def ComputeOutputFileName(self, spec, type=None): | 827 def ComputeOutputFileName(self, spec, type=None): |
828 """Compute the filename of the final output for the current target.""" | 828 """Compute the filename of the final output for the current target.""" |
829 if not type: | 829 if not type: |
830 type = spec['type'] | 830 type = spec['type'] |
831 | 831 |
832 # Compute filename prefix: the product prefix, or a default for | 832 # Compute filename prefix: the product prefix, or a default for |
833 # the product type. | 833 # the product type. |
834 DEFAULT_PREFIX = { | 834 if self.flavor == 'win': |
Nico
2012/02/16 19:32:26
This should be !=, or you need to swap the branch
| |
835 'loadable_module': 'lib', | 835 DEFAULT_PREFIX = { |
836 'shared_library': 'lib', | 836 'loadable_module': 'lib', |
837 'static_library': 'lib', | 837 'shared_library': 'lib', |
838 } | 838 'static_library': 'lib', |
839 } | |
840 else: | |
841 DEFAULT_PREFIX = { | |
842 'loadable_module': '', | |
843 'shared_library': '', | |
844 'static_library': '', | |
845 } | |
839 prefix = spec.get('product_prefix', DEFAULT_PREFIX.get(type, '')) | 846 prefix = spec.get('product_prefix', DEFAULT_PREFIX.get(type, '')) |
840 | 847 |
841 # Compute filename extension: the product extension, or a default | 848 # Compute filename extension: the product extension, or a default |
842 # for the product type. | 849 # for the product type. |
843 DEFAULT_EXTENSION = { | 850 if self.flavor == 'win': |
844 'static_library': 'a', | 851 DEFAULT_EXTENSION = { |
845 'loadable_module': 'so', | 852 'static_library': 'lib', |
846 'shared_library': 'so', | 853 'loadable_module': 'dll', |
847 } | 854 'shared_library': 'dll', |
855 'executable': 'exe', | |
856 } | |
857 else: | |
858 DEFAULT_EXTENSION = { | |
859 'static_library': 'a', | |
860 'loadable_module': 'so', | |
861 'shared_library': 'so', | |
862 } | |
848 extension = spec.get('product_extension', | 863 extension = spec.get('product_extension', |
849 DEFAULT_EXTENSION.get(type, '')) | 864 DEFAULT_EXTENSION.get(type, '')) |
850 if extension: | 865 if extension: |
851 extension = '.' + extension | 866 extension = '.' + extension |
852 | 867 |
853 if 'product_name' in spec: | 868 if 'product_name' in spec: |
854 # If we were given an explicit name, use that. | 869 # If we were given an explicit name, use that. |
855 target = spec['product_name'] | 870 target = spec['product_name'] |
856 else: | 871 else: |
857 # Otherwise, derive a name from the target name. | 872 # Otherwise, derive a name from the target name. |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1045 command=('$cc -MMD -MF $out.d $defines $includes $cflags $cflags_c ' | 1060 command=('$cc -MMD -MF $out.d $defines $includes $cflags $cflags_c ' |
1046 '$cflags_pch_c -c $in -o $out'), | 1061 '$cflags_pch_c -c $in -o $out'), |
1047 depfile='$out.d') | 1062 depfile='$out.d') |
1048 master_ninja.rule( | 1063 master_ninja.rule( |
1049 'cxx', | 1064 'cxx', |
1050 description='CXX $out', | 1065 description='CXX $out', |
1051 command=('$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_cc ' | 1066 command=('$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_cc ' |
1052 '$cflags_pch_cc -c $in -o $out'), | 1067 '$cflags_pch_cc -c $in -o $out'), |
1053 depfile='$out.d') | 1068 depfile='$out.d') |
1054 else: | 1069 else: |
1055 # TODO(scottmg): Decide how /showIncludes handling should work in ninja. | 1070 # TODO(scottmg): Requires deplist branch of ninja for now (for |
1071 # /showIncludes handling). | |
1056 master_ninja.rule( | 1072 master_ninja.rule( |
1057 'cc', | 1073 'cc', |
1058 description='CC $out', | 1074 description='CC $out', |
1059 command=('$cc /nologo $defines $includes $cflags $cflags_c ' | 1075 command=('cmd /c $cc /nologo /showIncludes ' |
1060 '$cflags_pch_c /c $in /Fo$out'), | 1076 '$defines $includes $cflags $cflags_c ' |
1061 depfile='$out.d') | 1077 '$cflags_pch_c /c $in /Fo$out ' |
1078 '| ninja-deplist-helper -f cl -o $out.dl'), | |
1079 deplist='$out.dl') | |
1062 master_ninja.rule( | 1080 master_ninja.rule( |
1063 'cxx', | 1081 'cxx', |
1064 description='CXX $out', | 1082 description='CXX $out', |
1065 command=('$cxx /nologo $defines $includes $cflags $cflags_cc ' | 1083 command=('cmd /c $cxx /nologo /showIncludes ' |
1066 '$cflags_pch_cc /c $in /Fo$out'), | 1084 '$defines $includes $cflags $cflags_cc ' |
1067 depfile='$out.d') | 1085 '$cflags_pch_cc /c $in /Fo$out ' |
1086 '| ninja-deplist-helper -f cl -o $out.dl'), | |
1087 deplist='$out.dl') | |
1068 | 1088 |
1069 if flavor != 'mac' and flavor != 'win': | 1089 if flavor != 'mac' and flavor != 'win': |
1070 master_ninja.rule( | 1090 master_ninja.rule( |
1071 'alink', | 1091 'alink', |
1072 description='AR $out', | 1092 description='AR $out', |
1073 command='rm -f $out && ar rcsT $out $in') | 1093 command='rm -f $out && ar rcsT $out $in') |
1074 master_ninja.rule( | 1094 master_ninja.rule( |
1075 'solink', | 1095 'solink', |
1076 description='SOLINK $out', | 1096 description='SOLINK $out', |
1077 command=('$ld -shared $ldflags -o $out -Wl,-soname=$soname ' | 1097 command=('$ld -shared $ldflags -o $out -Wl,-soname=$soname ' |
1078 '-Wl,--whole-archive $in -Wl,--no-whole-archive $libs')) | 1098 '-Wl,--whole-archive $in -Wl,--no-whole-archive $libs')) |
1079 master_ninja.rule( | 1099 master_ninja.rule( |
1080 'solink_module', | 1100 'solink_module', |
1081 description='SOLINK(module) $out', | 1101 description='SOLINK(module) $out', |
1082 command=('$ld -shared $ldflags -o $out -Wl,-soname=$soname ' | 1102 command=('$ld -shared $ldflags -o $out -Wl,-soname=$soname ' |
1083 '-Wl,--start-group $in -Wl,--end-group $libs')) | 1103 '-Wl,--start-group $in -Wl,--end-group $libs')) |
1084 master_ninja.rule( | 1104 master_ninja.rule( |
1085 'link', | 1105 'link', |
1086 description='LINK $out', | 1106 description='LINK $out', |
1087 command=('$ld $ldflags -o $out -Wl,-rpath=\$$ORIGIN/lib ' | 1107 command=('$ld $ldflags -o $out -Wl,-rpath=\$$ORIGIN/lib ' |
1088 '-Wl,--start-group $in -Wl,--end-group $libs')) | 1108 '-Wl,--start-group $in -Wl,--end-group $libs')) |
1089 elif flavor == 'win': | 1109 elif flavor == 'win': |
1090 master_ninja.rule( | 1110 master_ninja.rule( |
1091 'alink', | 1111 'alink', |
1092 description='AR $out', | 1112 description='AR $out', |
1093 command='lib /nologo /OUT:$out.lib $in') | 1113 command='lib /nologo /OUT:$out.lib $in') |
1094 master_ninja.rule( | 1114 master_ninja.rule( |
1095 'solink', | 1115 'solink', |
1096 description='SOLINK $out', | 1116 description='SOLINK $out', |
1097 command=('$ld /nologo /DLL $ldflags /OUT:$out.dll $in $libs')) | 1117 command=('$ld /nologo /DLL $ldflags /OUT:$out $in $libs')) |
1098 master_ninja.rule( | 1118 master_ninja.rule( |
1099 'solink_module', | 1119 'solink_module', |
1100 description='SOLINK(module) $out', | 1120 description='SOLINK(module) $out', |
1101 command=('$ld /nologo /DLL $ldflags /OUT:$out.dll $in $libs')) | 1121 command=('$ld /nologo /DLL $ldflags /OUT:$out $in $libs')) |
1102 master_ninja.rule( | 1122 master_ninja.rule( |
1103 'link', | 1123 'link', |
1104 description='LINK $out', | 1124 description='LINK $out', |
1105 command=('$ld /nologo $ldflags /OUT:$out.exe $in $libs')) | 1125 command=('$ld /nologo $ldflags /OUT:$out $in $libs')) |
1106 else: | 1126 else: |
1107 master_ninja.rule( | 1127 master_ninja.rule( |
1108 'objc', | 1128 'objc', |
1109 description='OBJC $out', | 1129 description='OBJC $out', |
1110 command=('$cc -MMD -MF $out.d $defines $includes $cflags $cflags_objc ' | 1130 command=('$cc -MMD -MF $out.d $defines $includes $cflags $cflags_objc ' |
1111 '$cflags_pch_objc -c $in -o $out'), | 1131 '$cflags_pch_objc -c $in -o $out'), |
1112 depfile='$out.d') | 1132 depfile='$out.d') |
1113 master_ninja.rule( | 1133 master_ninja.rule( |
1114 'objcxx', | 1134 'objcxx', |
1115 description='OBJCXX $out', | 1135 description='OBJCXX $out', |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1223 | 1243 |
1224 user_config = params.get('generator_flags', {}).get('config', None) | 1244 user_config = params.get('generator_flags', {}).get('config', None) |
1225 if user_config: | 1245 if user_config: |
1226 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1246 GenerateOutputForConfig(target_list, target_dicts, data, params, |
1227 user_config) | 1247 user_config) |
1228 else: | 1248 else: |
1229 config_names = target_dicts[target_list[0]]['configurations'].keys() | 1249 config_names = target_dicts[target_list[0]]['configurations'].keys() |
1230 for config_name in config_names: | 1250 for config_name in config_names: |
1231 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1251 GenerateOutputForConfig(target_list, target_dicts, data, params, |
1232 config_name) | 1252 config_name) |
OLD | NEW |