diff options
author | Nicolas Schneider <nioncode+git@gmail.com> | 2016-03-24 22:19:55 +0100 |
---|---|---|
committer | Nicolas Schneider <nioncode+git@gmail.com> | 2016-03-24 23:44:44 +0100 |
commit | 0c4aab6eed77d62c41006d6944b46f881610599d (patch) | |
tree | f43b25e1e3253d68f43c7342de06e214c842c947 | |
parent | 7019daaab04cac0be83451055e267ad7d6b1c5f6 (diff) | |
download | meson-0c4aab6eed77d62c41006d6944b46f881610599d.zip meson-0c4aab6eed77d62c41006d6944b46f881610599d.tar.gz meson-0c4aab6eed77d62c41006d6944b46f881610599d.tar.bz2 |
vs2010: support same source file names in different subdirs
-rw-r--r-- | mesonbuild/backend/vs2010backend.py | 5 | ||||
-rw-r--r-- | mesonbuild/build.py | 11 |
2 files changed, 16 insertions, 0 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 84ef8c3..fac7358 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -566,6 +566,11 @@ class Vs2010Backend(backends.Backend): inc_cl = ET.SubElement(inc_src, 'CLCompile', Include=relpath) self.add_pch(inc_cl, proj_to_src_dir, pch_sources, s) self.add_additional_options(s, inc_cl, extra_args, additional_options_set) + basename = os.path.basename(s.fname) + if basename in target.sources_conflicts: + obj_name = '.'.join(s.split('.')[:-1]).replace('/', '_')\ + + '.' + self.environment.get_object_suffix() + ET.SubElement(inc_cl, 'ObjectFileName').text = "$(IntDir)" + obj_name for s in gen_src: relpath = self.relpath(s, target.subdir) inc_cl = ET.SubElement(inc_src, 'CLCompile', Include=relpath) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 3f480e8..a7965aa 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -184,6 +184,7 @@ class BuildTarget(): self.subproject = subproject # Can not be calculated from subdir as subproject dirname can be changed per project. self.is_cross = is_cross self.sources = [] + self.sources_conflicts = {} self.objects = [] self.external_deps = [] self.include_dirs = [] @@ -244,6 +245,7 @@ class BuildTarget(): if not isinstance(sources, list): sources = [sources] added_sources = {} # If the same source is defined multiple times, use it only once. + conflicts = {} # We must resolve conflicts if multiple source files from different subdirs have the same name. for s in sources: # Holder unpacking. Ugly. if hasattr(s, 'held_object'): @@ -252,10 +254,19 @@ class BuildTarget(): if not s in added_sources: self.sources.append(s) added_sources[s] = True + basename = os.path.basename(s.fname) + conflicting_sources = conflicts.get(basename, None) + if conflicting_sources is None: + conflicting_sources = [] + conflicting_sources.append(s) + conflicts[basename] = conflicting_sources elif isinstance(s, GeneratedList) or isinstance(s, CustomTarget): self.generated.append(s) else: raise InvalidArguments('Bad source in target %s.' % self.name) + for basename, conflicting_sources in conflicts.items(): + if len(conflicting_sources) > 1: + self.sources_conflicts[basename] = conflicting_sources def validate_sources(self): if len(self.sources) > 0: |