Added minimal support for Qt Creator projects

pull/4115/head
Matteo Italia 2017-04-05 11:43:50 +02:00
parent 067fe9b0e5
commit f3ccfbe267
2 changed files with 63 additions and 0 deletions

View File

@ -32,6 +32,7 @@ from tools.export import lpcxpresso, ds5_5, iar, makefile
from tools.export import embitz, coide, kds, simplicity, atmelstudio from tools.export import embitz, coide, kds, simplicity, atmelstudio
from tools.export import sw4stm32, e2studio, zip, cmsis, uvision, cdt from tools.export import sw4stm32, e2studio, zip, cmsis, uvision, cdt
from tools.export import gnuarmeclipse from tools.export import gnuarmeclipse
from tools.export import qtcreator
from tools.targets import TARGET_NAMES from tools.targets import TARGET_NAMES
EXPORTERS = { EXPORTERS = {
@ -55,6 +56,7 @@ EXPORTERS = {
'eclipse_iar' : cdt.EclipseIAR, 'eclipse_iar' : cdt.EclipseIAR,
'eclipse_armc5' : cdt.EclipseArmc5, 'eclipse_armc5' : cdt.EclipseArmc5,
'gnuarmeclipse': gnuarmeclipse.GNUARMEclipse, 'gnuarmeclipse': gnuarmeclipse.GNUARMEclipse,
'qtcreator': qtcreator.QtCreator,
'zip' : zip.ZIP, 'zip' : zip.ZIP,
'cmsis' : cmsis.CMSIS 'cmsis' : cmsis.CMSIS
} }

View File

@ -0,0 +1,61 @@
"""
mbed SDK
Copyright (c) 2014-2016 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from os.path import splitext, basename
from tools.targets import TARGET_MAP
from tools.export.exporters import Exporter, filter_supported
class QtCreator(Exporter):
NAME = 'QtCreator'
TOOLCHAIN = 'GCC_ARM'
TARGETS = filter_supported("GCC_ARM", set())
MBED_CONFIG_HEADER_SUPPORTED = True
def generate(self):
self.resources.win_to_unix()
with open("%s.creator" % self.project_name, "w") as fd:
fd.write("[General]\n")
next_is_include = False
includes = []
with open("%s.config" % self.project_name, "w") as fd:
for f in self.flags['c_flags'] + self.flags['cxx_flags']:
f=f.strip()
if next_is_include:
includes.append(f)
next_is_include = False
continue
if f.startswith('-D'):
fd.write("#define %s\n" % (f[2:].replace('=', ' ')))
elif f.startswith('-U'):
fd.write("#undef %s\n" % f[2:])
elif f == "-include":
next_is_include = True
for i in includes:
fd.write("#include \"%s\"\n" % i)
with open("%s.files" % self.project_name, "w") as fd:
for r_type in ['headers', 'c_sources', 's_sources', 'cpp_sources']:
for f in getattr(self.resources, r_type):
fd.write(f + "\n")
with open("%s.includes" % self.project_name, "w") as fd:
for i in self.resources.inc_dirs:
fd.write(i + "\n")