summaryrefslogtreecommitdiffstats
path: root/site_scons
diff options
context:
space:
mode:
authorsgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-17 02:25:22 +0000
committersgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-17 02:25:22 +0000
commitcaeb7a0ca33ec99cd3dc68e95ca23ca4aa7e8068 (patch)
tree26d23c79d97efa44f69d1b447ae4618bf34fc609 /site_scons
parent75ddd63be217e7fed76f90578a8918ab75b3ead8 (diff)
downloadchromium_src-caeb7a0ca33ec99cd3dc68e95ca23ca4aa7e8068.zip
chromium_src-caeb7a0ca33ec99cd3dc68e95ca23ca4aa7e8068.tar.gz
chromium_src-caeb7a0ca33ec99cd3dc68e95ca23ca4aa7e8068.tar.bz2
Generate all chrome .vcproj files:
* Path name translation (/ to \) of various MSVSTool attributes. * Explicit keyword= arguments to MSVSProject. This will likely go away eventually in favor of uniform behavior. * Add a relative_path_substitutions array that can be used to substitute in Visual Studio variable like $(OutDir). * Add a local_directory_prefix that can be set to './' to only affect files in the current directory. * Additional Keyword ordering in Tool attributes to continue to match the default order Visual Studio generates. * Add a Derived() proxy class that can wrap a File node to tell the .vcproj generation that we want the derived file, not its source(s), in the file list. * In the individual *.scons files, add the necessary files (mostly .h files) to file lists, and update MSVSProject() calls with the additional necessary information. Result is identical .vcproj files modulo the following differences: * Four locales .vcproj files (da, en-US, he and zh-TW) with source file orders that don't match the other locale .vcproj files have re-ordered file lists to match the rest. * Cosmetic XML changes (white space, ending tags) in: chrome/app/chrome_dll.vcproj chrome/app/generated_resources.vcproj net/build/net_resources.vcproj * Removal or addition of ./ prefixes from various files that don't match the other file specifications within their individual .vcproj files: chrome/installer/util/util.vcproj net/build/net.vcproj net/build/net_unittests.vcproj * Add missing empty sections (<ToolFiles>, <References>, <Globals>) for consistency with other .vcproj files: chrome/tools/test/image_diff/image_diff.vcproj third_party/libpng/libpng.vcproj third_party/zlib/zlib.vcproj * Add missing RootNameSpace attribute: chrome/test/automation/automation.vcproj testing/gtest.vcproj * Use && instead of \r\n as a command separator, to sidestep XML-generation problems: chrome/app/chrome_exe.vcproj * Remove unnecessary (?) duplicate files in the file list: chrome/browser/views/browser_views.vcproj (event_utils.cc and event_utils.h were duplicated) Review URL: http://codereview.chromium.org/17603 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8253 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'site_scons')
-rw-r--r--site_scons/site_tools/_Node_MSVS.py102
-rw-r--r--site_scons/site_tools/chromium_builders.py36
2 files changed, 119 insertions, 19 deletions
diff --git a/site_scons/site_tools/_Node_MSVS.py b/site_scons/site_tools/_Node_MSVS.py
index e0876ba..4b83d56 100644
--- a/site_scons/site_tools/_Node_MSVS.py
+++ b/site_scons/site_tools/_Node_MSVS.py
@@ -38,6 +38,7 @@ import xml.dom.minidom
import SCons.Node.FS
import SCons.Script
+import SCons.Util
from SCons.Debug import Trace
TODO = 0
@@ -220,7 +221,7 @@ class _MSVSFolder(FileList):
entry_type_guid = '{2150E333-8FDC-42A3-9474-1A3956D46DE8}'
- def initialize(self, path, name = None, entries = None, guid = None, items = None):
+ def initialize(self, path, name=None, entries=None, guid=None, items=None):
"""Initializes the folder.
Args:
@@ -385,6 +386,47 @@ class MSVSTool(object):
Name: Tool name.
**attrs: Tool attributes.
"""
+
+ val = attrs.get('AdditionalDependencies')
+ if val:
+ if isinstance(val, list):
+ val = ' '.join(val)
+ attrs['AdditionalDependencies'] = val.replace('/', '\\')
+
+ val = attrs.get('AdditionalIncludeDirectories')
+ if val:
+ if isinstance(val, list):
+ val = ';'.join(val)
+ attrs['AdditionalIncludeDirectories'] = val.replace('/', '\\')
+
+ val = attrs.get('AdditionalManifestFiles')
+ if val:
+ if isinstance(val, list):
+ val = ';'.join(val)
+ attrs['AdditionalManifestFiles'] = val.replace('/', '\\')
+
+ val = attrs.get('CommandLine')
+ if val:
+ if isinstance(val, list):
+ val = '\r\n'.join(val)
+ attrs['CommandLine'] = val.replace('/', '\\')
+
+ val = attrs.get('PreprocessorDefinitions')
+ if val:
+ if isinstance(val, list):
+ val = ';'.join(val)
+ attrs['PreprocessorDefinitions'] = val
+
+ for a in ('ImportLibrary',
+ 'ObjectFile',
+ 'OutputFile',
+ 'Outputs',
+ 'XMLDocumentationFileName'):
+ val = attrs.get(a)
+ if val:
+ val = val.replace('/', '\\')
+ attrs[a] = val
+
self.Name = Name
self.attrs = attrs
@@ -453,7 +495,10 @@ class _MSVSProject(SCons.Node.FS.File):
buildtargets = [],
files = [],
root_namespace = None,
- relative_path_prefix = '',
+ keyword = None,
+ relative_path_prefix = None,
+ local_directory_prefix = None,
+ relative_path_substitutions = [],
tools = None,
configurations = None,
**attrs):
@@ -511,14 +556,28 @@ class _MSVSProject(SCons.Node.FS.File):
self.tool_files = []
self.file_lists = []
self.initialized = True
+ self.keyword = None
+ self.local_directory_prefix = ''
+ self.relative_path_prefix = ''
+ self.relative_path_substitutions = []
+ self.root_namespace = name
self.attrs = attrs
self.env = env
self.guid = guid
self.msvs_name = name
self.msvs_path = path
- self.relative_path_prefix = relative_path_prefix
- self.root_namespace = root_namespace or self.msvs_name
+ if relative_path_prefix:
+ self.relative_path_prefix = relative_path_prefix
+ if local_directory_prefix:
+ self.local_directory_prefix = local_directory_prefix
+ for left, right in relative_path_substitutions:
+ t = (left.replace('/', '\\'), right.replace('/', '\\'))
+ self.relative_path_substitutions.append(t)
+ if root_namespace:
+ self.root_namespace = root_namespace
+ if keyword:
+ self.keyword = keyword
self.tools = tools
self.buildtargets.extend(buildtargets)
@@ -533,7 +592,7 @@ class _MSVSProject(SCons.Node.FS.File):
for entry in entries:
if SCons.Util.is_String(entry):
entry = self.env.File(entry)
- result.append(entry)
+ result.append(entry.srcnode())
elif hasattr(entry, 'entries'):
entry.entries = self.args2nodes(entry.entries)
result.append(entry)
@@ -594,8 +653,16 @@ class _MSVSProject(SCons.Node.FS.File):
return sln.rel_path(self).replace('/', '\\')
def get_rel_path(self, node):
- result = self.relative_path_prefix + self.rel_path(node)
- return result.replace('/', '\\')
+ result = self.rel_path(node)
+ if self.relative_path_prefix:
+ if not result.startswith('..'):
+ result = self.relative_path_prefix + result
+ elif not os.path.split(result)[0]:
+ result = self.local_directory_prefix + result
+ result = result.replace('/', '\\')
+ for left, right in self.relative_path_substitutions:
+ result = result.replace(left, right)
+ return result
def AddConfig(self, Name, tools=None, **attrs):
"""Adds a configuration to the parent node.
@@ -710,7 +777,8 @@ class _MSVSProject(SCons.Node.FS.File):
root.setAttribute('Name', self.msvs_name)
root.setAttribute('ProjectGUID', self.get_guid())
root.setAttribute('RootNamespace', self.root_namespace)
- root.setAttribute('Keyword', 'Win32Proj')
+ if self.keyword:
+ root.setAttribute('Keyword', self.keyword)
# Add platform list
platforms = self.doc.createElement('Platforms')
@@ -1095,6 +1163,11 @@ class _MSVSProject(SCons.Node.FS.File):
'Name',
'DisableSpecificWarnings',
+ 'AdditionalIncludeDirectories',
+ 'Description',
+ 'CommandLine',
+ 'OutputFile',
+ 'ImportLibrary',
'PreprocessorDefinitions',
'UsePrecompiledHeader',
'PrecompiledHeaderThrough',
@@ -1178,7 +1251,7 @@ MSVSSolutionAction = SCons.Script.Action(MSVSAction,
class _MSVSSolution(SCons.Node.FS.File):
"""Visual Studio solution."""
- def initialize(self, env, path, entries = None, variants = None, websiteProperties = True):
+ def initialize(self, env, path, entries=None, variants=None, websiteProperties=True):
"""Initializes the solution.
Args:
@@ -1370,8 +1443,19 @@ def MSVSSolution(env, item, *args, **kw):
LookupAdd(item, result)
return result
+class Derived(SCons.Util.Proxy):
+ def srcnode(self, *args, **kw):
+ return self
+ def __getattr__(self, name):
+ if name == 'sources':
+ return []
+ return SCons.Util.Proxy.__getattr__(self, name)
+ def __hash__(self, *args, **kw):
+ return id(self)
+
import __builtin__
+__builtin__.Derived = Derived
__builtin__.MSVSConfig = MSVSConfig
__builtin__.MSVSFilter = MSVSFilter
__builtin__.MSVSProject = MSVSProject
diff --git a/site_scons/site_tools/chromium_builders.py b/site_scons/site_tools/chromium_builders.py
index ff25bde..e348336 100644
--- a/site_scons/site_tools/chromium_builders.py
+++ b/site_scons/site_tools/chromium_builders.py
@@ -53,41 +53,57 @@ class ChromeFileList(MSVS.FileList):
import __builtin__
__builtin__.ChromeFileList = ChromeFileList
-def compilable_files(sources):
+non_compilable_suffixes = {
+ 'LINUX' : set([
+ '.h',
+ '.dat',
+ '.rc',
+ ]),
+ 'WINDOWS' : set([
+ '.h',
+ '.dat',
+ ]),
+}
+
+def compilable(env, file):
+ base, ext = os.path.splitext(str(file))
+ if ext in non_compilable_suffixes[env['TARGET_PLATFORM']]:
+ return False
+ return True
+
+def compilable_files(env, sources):
if not hasattr(sources, 'entries'):
- return [x for x in sources if not str(x).endswith('.h')
- and not str(x).endswith('.dat')]
+ return [x for x in sources if compilable(env, x)]
result = []
for top, folders, nonfolders in MSVS.FileListWalk(sources):
- result.extend([x for x in nonfolders if not str(x).endswith('.h')
- and not str(x).endswith('.dat')])
+ result.extend([x for x in nonfolders if compilable(env, x)])
return result
def ChromeProgram(env, target, source, *args, **kw):
- source = compilable_files(source)
+ source = compilable_files(env, source)
result = env.ComponentProgram(target, source, *args, **kw)
if env.get('INCREMENTAL'):
env.Precious(result)
return result
def ChromeTestProgram(env, target, source, *args, **kw):
- source = compilable_files(source)
+ source = compilable_files(env, source)
result = env.ComponentTestProgram(target, source, *args, **kw)
if env.get('INCREMENTAL'):
env.Precious(*result)
return result
def ChromeLibrary(env, target, source, *args, **kw):
- source = compilable_files(source)
+ source = compilable_files(env, source)
return env.ComponentLibrary(target, source, *args, **kw)
def ChromeStaticLibrary(env, target, source, *args, **kw):
- source = compilable_files(source)
+ source = compilable_files(env, source)
kw['COMPONENT_STATIC'] = True
return env.ComponentLibrary(target, source, *args, **kw)
def ChromeSharedLibrary(env, target, source, *args, **kw):
- source = compilable_files(source)
+ source = compilable_files(env, source)
kw['COMPONENT_STATIC'] = False
result = [env.ComponentLibrary(target, source, *args, **kw)[0]]
if env.get('INCREMENTAL'):