Use relative object file name for unity files everywhere.

pull/1457/head
Jussi Pakkanen 8 years ago
parent 7b66ff8921
commit 294abe244f
  1. 16
      mesonbuild/backend/backends.py
  2. 2
      mesonbuild/backend/vs2010backend.py

@ -269,11 +269,13 @@ class Backend:
raise MesonException(m.format(target.name)) raise MesonException(m.format(target.name))
return l return l
def object_filename_from_source(self, target, source): def object_filename_from_source(self, target, source, is_unity):
if isinstance(source, mesonlib.File): if isinstance(source, mesonlib.File):
source = source.fname source = source.fname
# foo.vala files compile down to foo.c and then foo.c.o, not foo.vala.o # foo.vala files compile down to foo.c and then foo.c.o, not foo.vala.o
if source.endswith('.vala'): if source.endswith('.vala'):
if is_unity:
return source[:-5] + '.c.' + self.environment.get_object_suffix()
source = os.path.join(self.get_target_private_dir(target), source[:-5] + '.c') source = os.path.join(self.get_target_private_dir(target), source[:-5] + '.c')
return source.replace('/', '_').replace('\\', '_') + '.' + self.environment.get_object_suffix() return source.replace('/', '_').replace('\\', '_') + '.' + self.environment.get_object_suffix()
@ -286,15 +288,15 @@ class Backend:
if self.environment.coredata.get_builtin_option('unity'): if self.environment.coredata.get_builtin_option('unity'):
comp = get_compiler_for_source(extobj.target.compilers.values(), comp = get_compiler_for_source(extobj.target.compilers.values(),
extobj.srclist[0]) extobj.srclist[0])
# The unity object name uses the full absolute path of the source file # There is a potential conflict here, but it is unlikely that
osrc = os.path.join(self.get_target_private_dir_abs(extobj.target), # anyone both enables unity builds and has a file called foo-unity.cpp.
self.get_unity_source_filename(extobj.target, osrc = self.get_unity_source_filename(extobj.target,
comp.get_default_suffix())) comp.get_default_suffix())
objname = self.object_filename_from_source(extobj.target, osrc) objname = self.object_filename_from_source(extobj.target, osrc, True)
objpath = os.path.join(proj_dir_to_build_root, targetdir, objname) objpath = os.path.join(proj_dir_to_build_root, targetdir, objname)
return [objpath] return [objpath]
for osrc in extobj.srclist: for osrc in extobj.srclist:
objname = self.object_filename_from_source(extobj.target, osrc) objname = self.object_filename_from_source(extobj.target, osrc, False)
objpath = os.path.join(proj_dir_to_build_root, targetdir, objname) objpath = os.path.join(proj_dir_to_build_root, targetdir, objname)
result.append(objpath) result.append(objpath)
return result return result

@ -87,7 +87,7 @@ class Vs2010Backend(backends.Backend):
self.vs_version = '2010' self.vs_version = '2010'
self.windows_target_platform_version = None self.windows_target_platform_version = None
def object_filename_from_source(self, target, source): def object_filename_from_source(self, target, source, is_unity=False):
basename = os.path.basename(source.fname) basename = os.path.basename(source.fname)
filename_without_extension = '.'.join(basename.split('.')[:-1]) filename_without_extension = '.'.join(basename.split('.')[:-1])
if basename in self.sources_conflicts[target.get_id()]: if basename in self.sources_conflicts[target.get_id()]:

Loading…
Cancel
Save