aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schneider <nioncode+git@gmail.com>2019-02-13 20:30:45 +0100
committerNicolas Schneider <nioncode+git@gmail.com>2019-02-13 20:49:54 +0100
commit907fb59f67cabfd11b2c4c9506e745cf590ac993 (patch)
tree00e183882121402665e598e8e24965c50733f7b3
parent9c55e50bea0bcc1e5280e12c2413323a9a205be6 (diff)
downloadmeson-907fb59f67cabfd11b2c4c9506e745cf590ac993.zip
meson-907fb59f67cabfd11b2c4c9506e745cf590ac993.tar.gz
meson-907fb59f67cabfd11b2c4c9506e745cf590ac993.tar.bz2
vs: link dependencies of link_whole targets
Otherwise, msbuild will not create any output for targets that don't have any sources.
-rw-r--r--mesonbuild/backend/vs2010backend.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index d07caf3..e46dd52 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -89,6 +89,7 @@ class Vs2010Backend(backends.Backend):
self.vs_version = '2010'
self.windows_target_platform_version = None
self.subdirs = {}
+ self.handled_target_deps = {}
def generate_custom_generator_commands(self, target, parent_node):
generator_output_files = []
@@ -436,18 +437,22 @@ class Vs2010Backend(backends.Backend):
def quote_arguments(self, arr):
return ['"%s"' % i for i in arr]
- def add_project_reference(self, root, include, projid):
+ def add_project_reference(self, root, include, projid, link_outputs=False):
ig = ET.SubElement(root, 'ItemGroup')
pref = ET.SubElement(ig, 'ProjectReference', Include=include)
ET.SubElement(pref, 'Project').text = '{%s}' % projid
- # Do not link in generated .lib files from dependencies automatically.
- # We only use the dependencies for ordering and link in the generated
- # objects and .lib files manually.
- ET.SubElement(pref, 'LinkLibraryDependencies').text = 'false'
+ if not link_outputs:
+ # Do not link in generated .lib files from dependencies automatically.
+ # We only use the dependencies for ordering and link in the generated
+ # objects and .lib files manually.
+ ET.SubElement(pref, 'LinkLibraryDependencies').text = 'false'
def add_target_deps(self, root, target):
target_dict = {target.get_id(): target}
for name, dep in self.get_target_deps(target_dict).items():
+ if dep.get_id() in self.handled_target_deps[target.get_id()]:
+ # This dependency was already handled manually.
+ continue
relpath = self.get_target_dir_relative_to(dep, target)
vcxproj = os.path.join(relpath, dep.get_id() + '.vcxproj')
tid = self.environment.coredata.target_guids[dep.get_id()]
@@ -722,6 +727,7 @@ class Vs2010Backend(backends.Backend):
mlog.debug('Generating vcxproj %s.' % target.name)
entrypoint = 'WinMainCRTStartup'
subsystem = 'Windows'
+ self.handled_target_deps[target.get_id()] = []
if isinstance(target, build.Executable):
conftype = 'Application'
if not target.gui_app:
@@ -1111,7 +1117,10 @@ class Vs2010Backend(backends.Backend):
trelpath = self.get_target_dir_relative_to(t, target)
tvcxproj = os.path.join(trelpath, t.get_id() + '.vcxproj')
tid = self.environment.coredata.target_guids[t.get_id()]
- self.add_project_reference(root, tvcxproj, tid)
+ self.add_project_reference(root, tvcxproj, tid, link_outputs=True)
+ # Mark the dependency as already handled to not have
+ # multiple references to the same target.
+ self.handled_target_deps[target.get_id()].append(t.get_id())
else:
# Other libraries go into AdditionalDependencies
if linkname not in additional_links: