[Libreoffice-commits] core.git: bin/gbuild-to-ide
Michael Weghorn (via logerrit)
logerrit at kemper.freedesktop.org
Sat Jun 8 01:58:55 UTC 2019
bin/gbuild-to-ide | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
New commits:
commit 92c03d9bf644b0f10de52ce0da09f97056e46247
Author: Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Jun 7 21:44:03 2019 +0200
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Sat Jun 8 03:58:00 2019 +0200
qtcreator: Take over '-std=...' from CXXFLAGS
If the '-std=' compiler flag is set in CXXFLAGS,
take that over into the .pro files used by
Qt Creator.
This makes ClangCodeModel use the correct std version,
and e.g. know about 'std::string_view' if '-std=gnu++2a'
(or anything else indicating C++17 or higher is supported)
is used and thus avoids unnecessary errors/warnings from
being displayed.
Use a list, so other flags can easily be added later.
(It currently doesn't seem reasonable to me to just pass all
cxxflags though, since .pro files are currently only generated
per top-level module, while C++ flags can differ between
different targets in the same module).
Change-Id: Id3f3e2b9ba77e5220a17fd4796937c816979959a
Reviewed-on: https://gerrit.libreoffice.org/73677
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index 1365c548c218..e012c08c0828 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -1671,6 +1671,12 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
if ext:
headers_list.append(lopath(file_ + ext))
+ cxxflags_list = []
+ for cxxflag in lib.cxxflags:
+ # extract flag for C++ standard version
+ if cxxflag.startswith('-std'):
+ cxxflags_list.append(cxxflag)
+
# List all include paths
for hdir in (lib.include + lib.include_sys):
hf_lopath = lopath(hdir)
@@ -1695,12 +1701,14 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
if lib_folder in self.data_libs:
self.data_libs[lib_folder]['sources'] |= set(sources_list)
self.data_libs[lib_folder]['headers'] |= set(headers_list)
+ self.data_libs[lib_folder]['cxxflags'] |= set(cxxflags_list)
self.data_libs[lib_folder]['includepath'] |= set(includepath_list)
self.data_libs[lib_folder]['defines'] |= set(defines_list)
else:
self.data_libs[lib_folder] = {
'sources': set(sources_list),
'headers': set(headers_list),
+ 'cxxflags': set(cxxflags_list),
'includepath': set(includepath_list),
'defines': set(defines_list),
'loc': lib.location,
@@ -1723,6 +1731,7 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
for lib_folder in subdirs_list:
sources_list = sorted(self.data_libs[lib_folder]['sources'])
headers_list = sorted(self.data_libs[lib_folder]['headers'])
+ cxxflags_list = sorted(self.data_libs[lib_folder]['cxxflags'])
includepath_list = sorted(self.data_libs[lib_folder]['includepath'])
defines_list = sorted(self.data_libs[lib_folder]['defines'])
lib_loc = self.data_libs[lib_folder]['loc']
@@ -1730,13 +1739,15 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
sources = " \\\n".join(sources_list)
headers = " \\\n".join(headers_list)
+ cxxflags = " \\\n".join(cxxflags_list)
includepath = " \\\n".join(includepath_list)
defines = " \\\n".join(defines_list)
# create .pro file
qt_pro_file = '%s/%s.pro' % (lib_loc, lib_name)
try:
- content = QtCreatorIntegrationGenerator.pro_template % {'sources': sources, 'headers': headers, 'includepath': includepath, 'defines': defines}
+ content = QtCreatorIntegrationGenerator.pro_template % {'sources': sources, 'headers': headers,
+ 'cxxflags': cxxflags, 'includepath': includepath, 'defines': defines}
mode = 'w+'
with open(qt_pro_file, mode) as fpro:
fpro.write(content)
@@ -1799,6 +1810,8 @@ CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
+QMAKE_CXXFLAGS += %(cxxflags)s
+
INCLUDEPATH += %(includepath)s
SOURCES += %(sources)s
More information about the Libreoffice-commits
mailing list