diff options
author | makise-homura <akemi_homura@kurisa.ch> | 2019-10-17 21:05:06 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-10-19 14:27:41 +0300 |
commit | 79f52e24885a261f100d8c4b20f2875420982c0f (patch) | |
tree | cb742453189072d6f4b7f831c379abeb6fb7731e /mesonbuild/compilers | |
parent | dd8c1d059514dea820c2e952a3c01a50993d4ec3 (diff) | |
download | meson-79f52e24885a261f100d8c4b20f2875420982c0f.zip meson-79f52e24885a261f100d8c4b20f2875420982c0f.tar.gz meson-79f52e24885a261f100d8c4b20f2875420982c0f.tar.bz2 |
Add a proper way to get include dirs for elbrus compiler
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/mixins/elbrus.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mesonbuild/compilers/mixins/elbrus.py b/mesonbuild/compilers/mixins/elbrus.py index 03f6556..f85e8e4 100644 --- a/mesonbuild/compilers/mixins/elbrus.py +++ b/mesonbuild/compilers/mixins/elbrus.py @@ -16,6 +16,8 @@ import os import typing +import subprocess +import re from .gnu import GnuCompiler from ...mesonlib import Popen_safe @@ -57,3 +59,14 @@ class ElbrusCompiler(GnuCompiler): libstr = line.split(' ', 1)[1] return [os.path.realpath(p) for p in libstr.split(':')] return [] + + def get_default_include_dirs(self) -> typing.List[str]: + os_env = os.environ.copy() + os_env['LC_ALL'] = 'C' + p = subprocess.Popen(self.exelist + ['-xc', '-E', '-v', '-'], env=os_env, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stderr = p.stderr.read().decode('utf-8', errors='replace') + includes = [] + for line in stderr.split('\n'): + if line.lstrip().startswith('--sys_include'): + includes.append(re.sub('\s*\\\\$', '', re.sub('^\s*--sys_include\s*', '', line))) + return includes |