aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schneider <nioncode+git@gmail.com>2016-03-17 13:13:28 +0100
committerNicolas Schneider <nioncode+git@gmail.com>2016-03-17 13:13:28 +0100
commit147b7aa3566e5b645d8e216c4e974e7534a53dc3 (patch)
treef7a8d7cb58b9ca57274fc84d6ad1ec9c07adf613
parentd72cc6e6f84812c2fb2d43bc823e36a01f594616 (diff)
downloadmeson-147b7aa3566e5b645d8e216c4e974e7534a53dc3.zip
meson-147b7aa3566e5b645d8e216c4e974e7534a53dc3.tar.gz
meson-147b7aa3566e5b645d8e216c4e974e7534a53dc3.tar.bz2
vs2010: add explicit objects as 'Object' ItemGroup instead of link dependency
This has two effects: 1. It makes targets with only object files work (test case 88). 2. It adds the object files to the project in the VS IDE.
-rw-r--r--mesonbuild/backend/vs2010backend.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index 5a9211f..ac4f0b2 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -492,9 +492,10 @@ class Vs2010Backend(backends.Backend):
rel_path = self.relpath(lobj.subdir, target.subdir)
linkname = os.path.join(rel_path, lobj.get_import_filename())
additional_links.append(linkname)
+ additional_objects = []
for o in self.flatten_object_list(target, down, include_dir_names=False):
assert(isinstance(o, str))
- additional_links.append(o)
+ additional_objects.append(o)
if len(additional_links) > 0:
additional_links.append('%(AdditionalDependencies)')
ET.SubElement(link, 'AdditionalDependencies').text = ';'.join(additional_links)
@@ -549,13 +550,15 @@ class Vs2010Backend(backends.Backend):
# just the file name instead of the relative path to the file.
pch_file.text = os.path.split(header)[1]
- if len(objects) > 0:
+ if len(objects) + len(additional_objects) > 0:
# Do not add gen_objs to project file. Those are automatically used by MSBuild, because they are part of
# the CustomBuildStep Outputs.
inc_objs = ET.SubElement(root, 'ItemGroup')
for s in objects:
relpath = s.rel_to_builddir(proj_to_src_root)
ET.SubElement(inc_objs, 'Object', Include=relpath)
+ for s in additional_objects:
+ ET.SubElement(inc_objs, 'Object', Include=s)
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.targets')
# Reference the regen target.
ig = ET.SubElement(root, 'ItemGroup')