eclipse: query the compiler for standard include dirs and add them in eclipse search path, so standard includes can be found also with non standard compilers

if command doesn't succeed use hardcoded paths as before. tried with various gcc and llvm.
This commit is contained in:
fedepell 2017-06-21 09:04:06 +02:00 committed by Thomas Nagy
parent 872052e5c7
commit 73dab83957
1 changed files with 10 additions and 0 deletions

View File

@ -54,6 +54,16 @@ class eclipse(Build.BuildContext):
cpppath = self.env['CPPPATH']
javasrcpath = []
if sys.platform != 'win32':
try:
cccmd = self.env.get_flat('CC') or self.env.get_flat('CXX')
if cccmd:
gccout = self.cmd_and_log([cccmd, '-xc++', '-E', '-Wp,-v', '-'], output=Context.STDERR, quiet=Context.BOTH, input='\n'.encode()).split('\n')
STANDARD_INCLUDES[:] = []
for ipath in gccout:
if ipath.startswith(' /'):
STANDARD_INCLUDES.append(ipath[1:])
except Exception:
pass # if cc command failed, fall back to hardcoded STANDARD_INCLUDES
cpppath += STANDARD_INCLUDES
Logs.warn('Generating Eclipse CDT project files')