bin/gbuild-to-ide | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-)
New commits: commit d4801c45caa05585c14f800e2dfe2cfc8642499d Author: Markus Mohrhard <[email protected]> Date: Thu Aug 7 21:20:02 2014 +0200 add the cxx flags to the ide parser Change-Id: Ied5f8ec9af69365e3375de26d325984c57327460 Reviewed-on: https://gerrit.libreoffice.org/10819 Reviewed-by: Markus Mohrhard <[email protected]> Tested-by: Markus Mohrhard <[email protected]> diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide index f7302c2..fcc1236 100755 --- a/bin/gbuild-to-ide +++ b/bin/gbuild-to-ide @@ -25,14 +25,15 @@ class GbuildParserState: self.include = [] self.defs = {} self.cxxobjects = [] + self.cxxflags = [] self.linked_libs = [] self.include_sys = [] class GbuildLinkTarget: - def __init__(self, name, location, include, include_sys, defs, cxxobjects, linked_libs): - (self.name, self.location, self.include, self.include_sys, self.defs, self.cxxobjects, self.linked_libs) = ( - name, location, include, include_sys, defs, cxxobjects, linked_libs) + def __init__(self, name, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs): + (self.name, self.location, self.include, self.include_sys, self.defs, self.cxxobjects, self.cxxflags, self.linked_libs) = ( + name, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs) def short_name(self): return self.name @@ -41,13 +42,14 @@ class GbuildLinkTarget: return not self.include and not self.defs and not self.cxxobjects and not self.linked_libs def __str__(self): - return '%s at %s with include path: %s, isystem includes: %s, defines %s, objects: %s and linked libs: %s' % ( - self.short_name(), self.location, self.include, self.include_sys, self.defs, self.cxxobjects, self.linked_libs) + return '%s at %s with include path: %s, isystem includes: %s, defines: %s, objects: %s, cxxflags: %s and linked libs: %s' % ( + self.short_name(), self.location, self.include, self.include_sys, self.defs, self.cxxobjects, + self.cxxflags, self.linked_libs) class GbuildLib(GbuildLinkTarget): - def __init__(self, name, library, location, include, include_sys, defs, cxxobjects, linked_libs): - GbuildLinkTarget.__init__(self, name, location, include, include_sys, defs, cxxobjects, linked_libs) + def __init__(self, name, library, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs): + GbuildLinkTarget.__init__(self, name, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs) self.library = library def short_name(self): @@ -62,8 +64,8 @@ class GbuildLib(GbuildLinkTarget): class GbuildExe(GbuildLinkTarget): - def __init__(self, name, executable, location, include, include_sys, defs, cxxobjects, linked_libs): - GbuildLinkTarget.__init__(self, name, location, include, include_sys, defs, cxxobjects, linked_libs) + def __init__(self, name, executable, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs): + GbuildLinkTarget.__init__(self, name, location, include, include_sys, defs, cxxobjects, cxxflags, linked_libs) self.executable = executable def short_name(self): @@ -91,6 +93,7 @@ class GbuildParser: cxxpattern = re.compile('# CXXOBJECTS := (.*)') linkedlibspattern = re.compile('# LINKED_LIBS := (.*)') ilibpattern = re.compile('# ILIBTARGET := (.*)') + warningpattern = re.compile('-W\S+') def __init__(self): (self.makecmd, self.srcdir, self.builddir, self.instdir, self.libs, @@ -150,7 +153,7 @@ class GbuildParser: self.libs.append( GbuildLib(libmatch.group(2), libname, libmatch.group(1), state.include, state.include_sys, state.defs, state.cxxobjects, - state.linked_libs)) + state.cxxflags, state.linked_libs)) state = GbuildParserState() continue exematch = GbuildParser.exepattern.match(line) @@ -159,7 +162,7 @@ class GbuildParser: self.exes.append( GbuildExe(exematch.group(2), exename, exematch.group(1), state.include, state.include_sys, state.defs, state.cxxobjects, - state.linked_libs)) + state.cxxflags, state.linked_libs)) state = GbuildParserState() continue includematch = GbuildParser.includepattern.match(line) @@ -190,6 +193,10 @@ class GbuildParser: ilibmatch = GbuildParser.ilibpattern.match(line) if ilibmatch: state.ilib = os.path.basename(ilibmatch.group(1)) + continue + if line.find('# T_CXXFLAGS :=') == 0: + state.cxxflags = [cxxflag.strip() for cxxflag in GbuildParser.warningpattern.sub('', line.replace('# T_CXXFLAGS :=','')).split(' ') if len(cxxflag) > 1] + continue #we could match a lot of other stuff here if needed for integration rpaths etc. return self commit f70f4e998517e9792034613b85ad89afa187e271 Author: Markus Mohrhard <[email protected]> Date: Thu Aug 7 20:02:05 2014 +0200 split isystem includes from normal includes All includes coming from isystem where wrong as the regex was not able to recognize that the isystem and following path belong together. Additionally stripping the first two characters resulted in broken paths in this case. Change-Id: Iaa8e484d1ddcd4c8744d1e37a006ebf915cdfc84 Reviewed-on: https://gerrit.libreoffice.org/10815 Reviewed-by: Markus Mohrhard <[email protected]> Tested-by: Markus Mohrhard <[email protected]> diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide index 55bfa37..f7302c2 100755 --- a/bin/gbuild-to-ide +++ b/bin/gbuild-to-ide @@ -26,12 +26,13 @@ class GbuildParserState: self.defs = {} self.cxxobjects = [] self.linked_libs = [] + self.include_sys = [] class GbuildLinkTarget: - def __init__(self, name, location, include, defs, cxxobjects, linked_libs): - (self.name, self.location, self.include, self.defs, self.cxxobjects, self.linked_libs) = ( - name, location, include, defs, cxxobjects, linked_libs) + def __init__(self, name, location, include, include_sys, defs, cxxobjects, linked_libs): + (self.name, self.location, self.include, self.include_sys, self.defs, self.cxxobjects, self.linked_libs) = ( + name, location, include, include_sys, defs, cxxobjects, linked_libs) def short_name(self): return self.name @@ -40,13 +41,13 @@ class GbuildLinkTarget: return not self.include and not self.defs and not self.cxxobjects and not self.linked_libs def __str__(self): - return '%s at %s with include path: %s, defines %s, objects: %s and linked libs: %s' % ( - self.short_name(), self.location, self.include, self.defs, self.cxxobjects, self.linked_libs) + return '%s at %s with include path: %s, isystem includes: %s, defines %s, objects: %s and linked libs: %s' % ( + self.short_name(), self.location, self.include, self.include_sys, self.defs, self.cxxobjects, self.linked_libs) class GbuildLib(GbuildLinkTarget): - def __init__(self, name, library, location, include, defs, cxxobjects, linked_libs): - GbuildLinkTarget.__init__(self, name, location, include, defs, cxxobjects, linked_libs) + def __init__(self, name, library, location, include, include_sys, defs, cxxobjects, linked_libs): + GbuildLinkTarget.__init__(self, name, location, include, include_sys, defs, cxxobjects, linked_libs) self.library = library def short_name(self): @@ -61,8 +62,8 @@ class GbuildLib(GbuildLinkTarget): class GbuildExe(GbuildLinkTarget): - def __init__(self, name, executable, location, include, defs, cxxobjects, linked_libs): - GbuildLinkTarget.__init__(self, name, location, include, defs, cxxobjects, linked_libs) + def __init__(self, name, executable, location, include, include_sys, defs, cxxobjects, linked_libs): + GbuildLinkTarget.__init__(self, name, location, include, include_sys, defs, cxxobjects, linked_libs) self.executable = executable def short_name(self): @@ -84,7 +85,8 @@ class GbuildParser: rulepattern = re.compile('^(.+?):( .*)?$') libpattern = re.compile('# [a-z]+ to execute \(from [\'`](.*)/Library_(.*)\.mk\', line [0-9]*\):') exepattern = re.compile('# [a-z]+ to execute \(from [\'`](.*)/Executable_(.*)\.mk\', line [0-9]*\):') - includepattern = re.compile('# INCLUDE := (.*)') + includepattern = re.compile('-I(\S+)') + isystempattern = re.compile('-isystem\s*(\S+)') defspattern = re.compile('# DEFS := (.*)') cxxpattern = re.compile('# CXXOBJECTS := (.*)') linkedlibspattern = re.compile('# LINKED_LIBS := (.*)') @@ -147,7 +149,7 @@ class GbuildParser: libname = self.libnames.get(state.ilib, None) self.libs.append( GbuildLib(libmatch.group(2), libname, libmatch.group(1), - state.include, state.defs, state.cxxobjects, + state.include, state.include_sys, state.defs, state.cxxobjects, state.linked_libs)) state = GbuildParserState() continue @@ -156,13 +158,16 @@ class GbuildParser: exename = self.exenames.get(state.target, None) self.exes.append( GbuildExe(exematch.group(2), exename, exematch.group(1), - state.include, state.defs, state.cxxobjects, + state.include, state.include_sys, state.defs, state.cxxobjects, state.linked_libs)) state = GbuildParserState() continue includematch = GbuildParser.includepattern.match(line) - if includematch: - state.include = [includeswitch.strip()[2:] for includeswitch in includematch.group(1).split(' ') if + if line.find('# INCLUDE :=') == 0: + isystemmatch = GbuildParser.isystempattern.findall(line) + if isystemmatch: + state.include_sys = isystemmatch + state.include = [includeswitch.strip() for includeswitch in GbuildParser.includepattern.findall(line) if len(includeswitch) > 2] continue defsmatch = GbuildParser.defspattern.match(line) _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
