diff options
-rw-r--r-- | mesonbuild/backend/vs2010backend.py | 15 | ||||
-rw-r--r-- | mesonbuild/compilers/c.py | 19 |
2 files changed, 25 insertions, 9 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 2e86ca9..05bcd3a 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -26,7 +26,7 @@ from .. import mlog from .. import compilers from ..compilers import CompilerArgs from ..mesonlib import MesonException, File, python_command -from ..environment import Environment +from ..environment import Environment, build_filename def autodetect_vs_version(build): vs_version = os.getenv('VisualStudioVersion', None) @@ -417,7 +417,7 @@ class Vs2010Backend(backends.Backend): pref = ET.SubElement(ig, 'ProjectReference', Include=include) ET.SubElement(pref, 'Project').text = '{%s}' % projid - def create_basic_crap(self, target): + def create_basic_crap(self, target, guid): project_name = target.name root = ET.Element('Project', {'DefaultTargets': "Build", 'ToolsVersion': '4.0', @@ -431,7 +431,7 @@ class Vs2010Backend(backends.Backend): pl.text = self.platform globalgroup = ET.SubElement(root, 'PropertyGroup', Label='Globals') guidelem = ET.SubElement(globalgroup, 'ProjectGuid') - guidelem.text = '{%s}' % self.environment.coredata.test_guid + guidelem.text = '{%s}' % guid kw = ET.SubElement(globalgroup, 'Keyword') kw.text = self.platform + 'Proj' p = ET.SubElement(globalgroup, 'Platform') @@ -460,7 +460,7 @@ class Vs2010Backend(backends.Backend): return root def gen_run_target_vcxproj(self, target, ofname, guid): - root = self.create_basic_crap(target) + root = self.create_basic_crap(target, guid) action = ET.SubElement(root, 'ItemDefinitionGroup') customstep = ET.SubElement(action, 'PostBuildEvent') cmd_raw = [target.command] + target.args @@ -486,7 +486,7 @@ class Vs2010Backend(backends.Backend): self._prettyprint_vcxproj_xml(ET.ElementTree(root), ofname) def gen_custom_target_vcxproj(self, target, ofname, guid): - root = self.create_basic_crap(target) + root = self.create_basic_crap(target, guid) action = ET.SubElement(root, 'ItemDefinitionGroup') customstep = ET.SubElement(action, 'CustomBuildStep') # We need to always use absolute paths because our invocation is always @@ -1098,6 +1098,9 @@ class Vs2010Backend(backends.Backend): else: raise MesonException('Unsupported Visual Studio target machine: ' + targetmachine) + meson_file_group = ET.SubElement(root, 'ItemGroup') + ET.SubElement(meson_file_group, 'None', Include=os.path.join(proj_to_src_dir, build_filename)) + extra_files = target.extra_files if len(headers) + len(gen_hdrs) + len(extra_files) > 0: inc_hdrs = ET.SubElement(root, 'ItemGroup') @@ -1173,7 +1176,7 @@ class Vs2010Backend(backends.Backend): pl.text = self.platform globalgroup = ET.SubElement(root, 'PropertyGroup', Label='Globals') guidelem = ET.SubElement(globalgroup, 'ProjectGuid') - guidelem.text = '{%s}' % self.environment.coredata.test_guid + guidelem.text = '{%s}' % self.environment.coredata.regen_guid kw = ET.SubElement(globalgroup, 'Keyword') kw.text = self.platform + 'Proj' p = ET.SubElement(globalgroup, 'Platform') diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 4d3b2a2..1b198b6 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -219,9 +219,22 @@ class CCompiler(Compiler): def _split_fetch_real_dirs(pathstr, sep=':'): paths = [] for p in pathstr.split(sep): - p = Path(p) - if p.exists() and p.resolve().as_posix() not in paths: - paths.append(p.resolve().as_posix()) + # GCC returns paths like this: + # /usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib + # It would make sense to normalize them to get rid of the .. parts + # Sadly when you are on a merged /usr fs it also kills these: + # /lib/x86_64-linux-gnu + # since /lib is a symlink to /usr/lib. This would mean + # paths under /lib would be considered not a "system path", + # which is wrong and breaks things. Store everything, just to be sure. + pobj = Path(p) + unresolved = pobj.as_posix() + resolved = Path(p).resolve().as_posix() + if pobj.exists(): + if unresolved not in paths: + paths.append(unresolved) + if resolved not in paths: + paths.append(resolved) return tuple(paths) def get_compiler_dirs(self, env, name): |