|
|
@ -84,14 +84,13 @@ gnu_color_args = { |
|
|
|
} # type: typing.Dict[str, typing.List[str]] |
|
|
|
} # type: typing.Dict[str, typing.List[str]] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: The result from calling compiler should be cached. So that calling this |
|
|
|
@functools.lru_cache(maxsize=None) |
|
|
|
# function multiple times don't add latency. |
|
|
|
def gnulike_default_include_dirs(compiler: typing.Tuple[str], lang: str) -> typing.List[str]: |
|
|
|
def gnulike_default_include_dirs(compiler: typing.List[str], lang: str) -> typing.List[str]: |
|
|
|
|
|
|
|
if lang == 'cpp': |
|
|
|
if lang == 'cpp': |
|
|
|
lang = 'c++' |
|
|
|
lang = 'c++' |
|
|
|
env = os.environ.copy() |
|
|
|
env = os.environ.copy() |
|
|
|
env["LC_ALL"] = 'C' |
|
|
|
env["LC_ALL"] = 'C' |
|
|
|
cmd = compiler + ['-x{}'.format(lang), '-E', '-v', '-'] |
|
|
|
cmd = list(compiler) + ['-x{}'.format(lang), '-E', '-v', '-'] |
|
|
|
p = subprocess.Popen( |
|
|
|
p = subprocess.Popen( |
|
|
|
cmd, |
|
|
|
cmd, |
|
|
|
stdin=subprocess.DEVNULL, |
|
|
|
stdin=subprocess.DEVNULL, |
|
|
@ -171,7 +170,7 @@ class GnuLikeCompiler(metaclass=abc.ABCMeta): |
|
|
|
return gnulike_instruction_set_args.get(instruction_set, None) |
|
|
|
return gnulike_instruction_set_args.get(instruction_set, None) |
|
|
|
|
|
|
|
|
|
|
|
def get_default_include_dirs(self) -> typing.List[str]: |
|
|
|
def get_default_include_dirs(self) -> typing.List[str]: |
|
|
|
return gnulike_default_include_dirs(self.exelist, self.language) |
|
|
|
return gnulike_default_include_dirs(tuple(self.exelist), self.language) |
|
|
|
|
|
|
|
|
|
|
|
@abc.abstractmethod |
|
|
|
@abc.abstractmethod |
|
|
|
def openmp_flags(self) -> typing.List[str]: |
|
|
|
def openmp_flags(self) -> typing.List[str]: |
|
|
|