[Libreoffice-commits] core.git: bin/gbuild-to-ide

Maxim Monastirsky momonasmon at gmail.com
Sun Nov 29 08:10:26 PST 2015


 bin/gbuild-to-ide |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 7b7b3ffb5b5e275c5c5bd78d7c6ff34ce61015bb
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Sun Nov 29 18:05:36 2015 +0200

    gbuild-to-ide: Add defines to Qt Creator projects
    
    The defines we use to build are needed to correctly
    parse the code, and find some types like OUString.
    
    Change-Id: I3b3aaa51c4637beed113738503c8ab1a967c9149

diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index 0ca5022..8b08380 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -1443,6 +1443,7 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
             def lopath(path):
                 return os.path.relpath(path, lib.location)
 
+            defines_list = []
             sources_list = []
             includepath_list = []
             # The explicit headers list is not mandatory :
@@ -1476,16 +1477,25 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
                             hf_lopath = lopath(os.path.join(hdir, hf))
                             headers_list.append(hf_lopath)
 
+            # List defines
+            for key, value in lib.defs.items():
+                define = key
+                if value is not None:
+                    define += '=' + value
+                defines_list.append(define)
+
             # All datas are prepared, store them for the lib.
             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]['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),
                     'includepath': set(includepath_list),
+                    'defines': set(defines_list),
                     'loc': lib.location,
                     'name': lib_name
                 }
@@ -1507,17 +1517,19 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
             sources_list = sorted(self.data_libs[lib_folder]['sources'])
             headers_list = sorted(self.data_libs[lib_folder]['headers'])
             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']
             lib_name = self.data_libs[lib_folder]['name']
 
             sources = " \\\n".join(sources_list)
             headers = " \\\n".join(headers_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}
+                content = QtCreatorIntegrationGenerator.pro_template % {'sources': sources, 'headers': headers, 'includepath': includepath, 'defines': defines}
                 mode = 'w+'
                 with open(qt_pro_file, mode) as fpro:
                     fpro.write(content)
@@ -1586,6 +1598,8 @@ SOURCES += %(sources)s
 
 HEADERS += %(headers)s
 
+DEFINES += %(defines)s
+
 """
     pro_meta_template = """TEMPLATE = subdirs
 


More information about the Libreoffice-commits mailing list