| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 | 3 |
| 4 import gyp | 4 import gyp |
| 5 import gyp.common | 5 import gyp.common |
| 6 import gyp.SCons as SCons | 6 import gyp.SCons as SCons |
| 7 import os.path | 7 import os.path |
| 8 import pprint | 8 import pprint |
| 9 import re | 9 import re |
| 10 | 10 |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 fp = open(SConstruct, 'w') | 895 fp = open(SConstruct, 'w') |
| 896 fp.write(header) | 896 fp.write(header) |
| 897 fp.write('SConscript(%s)\n' % repr(fname)) | 897 fp.write('SConscript(%s)\n' % repr(fname)) |
| 898 fp.close() | 898 fp.close() |
| 899 | 899 |
| 900 | 900 |
| 901 def TargetFilename(target, build_file=None, output_suffix=''): | 901 def TargetFilename(target, build_file=None, output_suffix=''): |
| 902 """Returns the .scons file name for the specified target. | 902 """Returns the .scons file name for the specified target. |
| 903 """ | 903 """ |
| 904 if build_file is None: | 904 if build_file is None: |
| 905 build_file, target = gyp.common.BuildFileAndTarget('', target)[:2] | 905 build_file, target = gyp.common.ParseQualifiedTarget(target)[:2] |
| 906 output_file = os.path.join(os.path.dirname(build_file), | 906 output_file = os.path.join(os.path.dirname(build_file), |
| 907 target + output_suffix + '.scons') | 907 target + output_suffix + '.scons') |
| 908 return output_file | 908 return output_file |
| 909 | 909 |
| 910 | 910 |
| 911 def GenerateOutput(target_list, target_dicts, data, params): | 911 def GenerateOutput(target_list, target_dicts, data, params): |
| 912 """ | 912 """ |
| 913 Generates all the output files for the specified targets. | 913 Generates all the output files for the specified targets. |
| 914 """ | 914 """ |
| 915 options = params['options'] | 915 options = params['options'] |
| 916 | 916 |
| 917 if options.generator_output: | 917 if options.generator_output: |
| 918 def output_path(filename): | 918 def output_path(filename): |
| 919 return filename.replace(params['cwd'], options.generator_output) | 919 return filename.replace(params['cwd'], options.generator_output) |
| 920 else: | 920 else: |
| 921 def output_path(filename): | 921 def output_path(filename): |
| 922 return filename | 922 return filename |
| 923 | 923 |
| 924 default_configuration = None | 924 default_configuration = None |
| 925 | 925 |
| 926 for qualified_target in target_list: | 926 for qualified_target in target_list: |
| 927 spec = target_dicts[qualified_target] | 927 spec = target_dicts[qualified_target] |
| 928 if spec['toolset'] != 'target': |
| 929 raise Exception( |
| 930 'Multiple toolsets not supported in scons build (target %s)' % |
| 931 qualified_target) |
| 928 scons_target = SCons.Target(spec) | 932 scons_target = SCons.Target(spec) |
| 929 if scons_target.is_ignored: | 933 if scons_target.is_ignored: |
| 930 continue | 934 continue |
| 931 | 935 |
| 932 # TODO: assumes the default_configuration of the first target | 936 # TODO: assumes the default_configuration of the first target |
| 933 # non-Default target is the correct default for all targets. | 937 # non-Default target is the correct default for all targets. |
| 934 # Need a better model for handle variation between targets. | 938 # Need a better model for handle variation between targets. |
| 935 if (not default_configuration and | 939 if (not default_configuration and |
| 936 spec['default_configuration'] != 'Default'): | 940 spec['default_configuration'] != 'Default'): |
| 937 default_configuration = spec['default_configuration'] | 941 default_configuration = spec['default_configuration'] |
| 938 | 942 |
| 939 build_file, target = gyp.common.BuildFileAndTarget('', qualified_target)[:2] | 943 build_file, target = gyp.common.ParseQualifiedTarget(qualified_target)[:2] |
| 940 output_file = TargetFilename(target, build_file, options.suffix) | 944 output_file = TargetFilename(target, build_file, options.suffix) |
| 941 if options.generator_output: | 945 if options.generator_output: |
| 942 output_file = output_path(output_file) | 946 output_file = output_path(output_file) |
| 943 | 947 |
| 944 if not spec.has_key('libraries'): | 948 if not spec.has_key('libraries'): |
| 945 spec['libraries'] = [] | 949 spec['libraries'] = [] |
| 946 | 950 |
| 947 # Add dependent static library targets to the 'libraries' value. | 951 # Add dependent static library targets to the 'libraries' value. |
| 948 deps = spec.get('dependencies', []) | 952 deps = spec.get('dependencies', []) |
| 949 spec['scons_dependencies'] = [] | 953 spec['scons_dependencies'] = [] |
| (...skipping 24 matching lines...) Expand all Loading... |
| 974 continue | 978 continue |
| 975 output_dir, basename = os.path.split(path) | 979 output_dir, basename = os.path.split(path) |
| 976 output_filename = path + '_main' + options.suffix + '.scons' | 980 output_filename = path + '_main' + options.suffix + '.scons' |
| 977 | 981 |
| 978 all_targets = gyp.common.AllTargets(target_list, target_dicts, build_file) | 982 all_targets = gyp.common.AllTargets(target_list, target_dicts, build_file) |
| 979 sconscript_files = {} | 983 sconscript_files = {} |
| 980 for t in all_targets: | 984 for t in all_targets: |
| 981 scons_target = SCons.Target(target_dicts[t]) | 985 scons_target = SCons.Target(target_dicts[t]) |
| 982 if scons_target.is_ignored: | 986 if scons_target.is_ignored: |
| 983 continue | 987 continue |
| 984 bf, target = gyp.common.BuildFileAndTarget('', t)[:2] | 988 bf, target = gyp.common.ParseQualifiedTarget(t)[:2] |
| 985 target_filename = TargetFilename(target, bf, options.suffix) | 989 target_filename = TargetFilename(target, bf, options.suffix) |
| 986 tpath = gyp.common.RelativePath(target_filename, output_dir) | 990 tpath = gyp.common.RelativePath(target_filename, output_dir) |
| 987 sconscript_files[target] = tpath | 991 sconscript_files[target] = tpath |
| 988 | 992 |
| 989 output_filename = output_path(output_filename) | 993 output_filename = output_path(output_filename) |
| 990 if sconscript_files: | 994 if sconscript_files: |
| 991 GenerateSConscriptWrapper(build_file, data[build_file], basename, | 995 GenerateSConscriptWrapper(build_file, data[build_file], basename, |
| 992 output_filename, sconscript_files, | 996 output_filename, sconscript_files, |
| 993 default_configuration) | 997 default_configuration) |
| OLD | NEW |