Add a proper way to get include dirs for elbrus compiler

pull/6081/head
makise-homura 5 years ago committed by Jussi Pakkanen
parent dd8c1d0595
commit 79f52e2488
  1. 13
      mesonbuild/compilers/mixins/elbrus.py

@ -16,6 +16,8 @@
import os import os
import typing import typing
import subprocess
import re
from .gnu import GnuCompiler from .gnu import GnuCompiler
from ...mesonlib import Popen_safe from ...mesonlib import Popen_safe
@ -57,3 +59,14 @@ class ElbrusCompiler(GnuCompiler):
libstr = line.split(' ', 1)[1] libstr = line.split(' ', 1)[1]
return [os.path.realpath(p) for p in libstr.split(':')] return [os.path.realpath(p) for p in libstr.split(':')]
return [] 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

Loading…
Cancel
Save