Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: pylib/gyp/generator/msvs.py

Issue 271019: Adding cross-compile ability to the make build (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pylib/gyp/generator/make.py ('k') | pylib/gyp/generator/scons.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 import os 3 import os
4 import re 4 import re
5 import subprocess 5 import subprocess
6 import sys 6 import sys
7 7
8 import gyp.MSVSNew as MSVSNew 8 import gyp.MSVSNew as MSVSNew
9 import gyp.MSVSProject as MSVSProject 9 import gyp.MSVSProject as MSVSProject
10 import gyp.MSVSToolFile as MSVSToolFile 10 import gyp.MSVSToolFile as MSVSToolFile
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 return node 924 return node
925 for child in node.keys(): 925 for child in node.keys():
926 node[child] = _CollapseSingles(child, node[child]) 926 node[child] = _CollapseSingles(child, node[child])
927 return node 927 return node
928 928
929 929
930 def _GatherSolutionFolders(project_objs): 930 def _GatherSolutionFolders(project_objs):
931 root = {} 931 root = {}
932 # Convert into a tree of dicts on path. 932 # Convert into a tree of dicts on path.
933 for p in project_objs.keys(): 933 for p in project_objs.keys():
934 gyp_file, target = gyp.common.BuildFileAndTarget('', p)[0:2] 934 gyp_file, target = gyp.common.ParseQualifiedTarget(p)[0:2]
935 gyp_dir = os.path.dirname(gyp_file) 935 gyp_dir = os.path.dirname(gyp_file)
936 path_dict = _GetPathDict(root, gyp_dir) 936 path_dict = _GetPathDict(root, gyp_dir)
937 path_dict[target + '.vcproj'] = project_objs[p] 937 path_dict[target + '.vcproj'] = project_objs[p]
938 # Walk down from the top until we hit a folder that has more than one entry. 938 # Walk down from the top until we hit a folder that has more than one entry.
939 # In practice, this strips the top-level "src/" dir from the hierarchy in 939 # In practice, this strips the top-level "src/" dir from the hierarchy in
940 # the solution. 940 # the solution.
941 while len(root) == 1 and type(root[root.keys()[0]]) == dict: 941 while len(root) == 1 and type(root[root.keys()[0]]) == dict:
942 root = root[root.keys()[0]] 942 root = root[root.keys()[0]]
943 # Collapse singles. 943 # Collapse singles.
944 root = _CollapseSingles('', root) 944 root = _CollapseSingles('', root)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 options = params['options'] 1011 options = params['options']
1012 generator_flags = params.get('generator_flags', {}) 1012 generator_flags = params.get('generator_flags', {})
1013 1013
1014 # Get the project file format version back out of where we stashed it in 1014 # Get the project file format version back out of where we stashed it in
1015 # GeneratorCalculatedVariables. 1015 # GeneratorCalculatedVariables.
1016 msvs_version = params['msvs_version'] 1016 msvs_version = params['msvs_version']
1017 1017
1018 # Prepare the set of configurations. 1018 # Prepare the set of configurations.
1019 configs = set() 1019 configs = set()
1020 for qualified_target in target_list: 1020 for qualified_target in target_list:
1021 build_file = gyp.common.BuildFileAndTarget('', qualified_target)[0] 1021 build_file = gyp.common.BuildFile(qualified_target)
1022 spec = target_dicts[qualified_target] 1022 spec = target_dicts[qualified_target]
1023 for config_name, c in spec['configurations'].iteritems(): 1023 for config_name, c in spec['configurations'].iteritems():
1024 configs.add('|'.join([config_name, 1024 configs.add('|'.join([config_name,
1025 c.get('configuration_platform', 'Win32')])) 1025 c.get('configuration_platform', 'Win32')]))
1026 configs = list(configs) 1026 configs = list(configs)
1027 1027
1028 # Generate each project. 1028 # Generate each project.
1029 projects = {} 1029 projects = {}
1030 for qualified_target in target_list: 1030 for qualified_target in target_list:
1031 build_file = gyp.common.BuildFileAndTarget('', qualified_target)[0] 1031 build_file = gyp.common.BuildFile(qualified_target)
1032 spec = target_dicts[qualified_target] 1032 spec = target_dicts[qualified_target]
1033 if spec['toolset'] != 'target':
1034 raise Exception(
1035 'Multiple toolsets not supported in msvs build (target %s)' %
1036 qualified_target)
1033 default_config = spec['configurations'][spec['default_configuration']] 1037 default_config = spec['configurations'][spec['default_configuration']]
1034 vcproj_filename = default_config.get('msvs_existing_vcproj') 1038 vcproj_filename = default_config.get('msvs_existing_vcproj')
1035 if not vcproj_filename: 1039 if not vcproj_filename:
1036 vcproj_filename = spec['target_name'] + options.suffix + '.vcproj' 1040 vcproj_filename = spec['target_name'] + options.suffix + '.vcproj'
1037 vcproj_path = os.path.join(os.path.split(build_file)[0], vcproj_filename) 1041 vcproj_path = os.path.join(os.path.split(build_file)[0], vcproj_filename)
1038 if options.generator_output: 1042 if options.generator_output:
1039 projectDirPath = os.path.dirname(os.path.abspath(vcproj_path)) 1043 projectDirPath = os.path.dirname(os.path.abspath(vcproj_path))
1040 vcproj_path = os.path.join(options.generator_output, vcproj_path) 1044 vcproj_path = os.path.join(options.generator_output, vcproj_path)
1041 fixpath_prefix = gyp.common.RelativePath(projectDirPath, 1045 fixpath_prefix = gyp.common.RelativePath(projectDirPath,
1042 os.path.dirname(vcproj_path)) 1046 os.path.dirname(vcproj_path))
(...skipping 23 matching lines...) Expand all
1066 _ProjectObject(sln_path, p, project_objs, projects) 1070 _ProjectObject(sln_path, p, project_objs, projects)
1067 # Create folder hierarchy. 1071 # Create folder hierarchy.
1068 root_entries = _GatherSolutionFolders(project_objs) 1072 root_entries = _GatherSolutionFolders(project_objs)
1069 # Create solution. 1073 # Create solution.
1070 sln = MSVSNew.MSVSSolution(sln_path, 1074 sln = MSVSNew.MSVSSolution(sln_path,
1071 entries=root_entries, 1075 entries=root_entries,
1072 variants=configs, 1076 variants=configs,
1073 websiteProperties=False, 1077 websiteProperties=False,
1074 version=msvs_version) 1078 version=msvs_version)
1075 sln.Write() 1079 sln.Write()
OLDNEW
« no previous file with comments | « pylib/gyp/generator/make.py ('k') | pylib/gyp/generator/scons.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698