diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2015-11-29 18:05:36 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2015-11-29 18:07:41 +0200 |
commit | 7b7b3ffb5b5e275c5c5bd78d7c6ff34ce61015bb (patch) | |
tree | cebc21f28e11021128926e480e34fbd47c09a290 | |
parent | 1c8e67a9d163e72916d33b5d16211965c9655e23 (diff) |
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
-rwxr-xr-x | bin/gbuild-to-ide | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide index 0ca502217aac..8b083807a3a8 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 |