Skip to content

Commit f3ccfbe

Browse files
committed
Added minimal support for Qt Creator projects
1 parent 067fe9b commit f3ccfbe

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

tools/export/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from tools.export import embitz, coide, kds, simplicity, atmelstudio
3333
from tools.export import sw4stm32, e2studio, zip, cmsis, uvision, cdt
3434
from tools.export import gnuarmeclipse
35+
from tools.export import qtcreator
3536
from tools.targets import TARGET_NAMES
3637

3738
EXPORTERS = {
@@ -55,6 +56,7 @@
5556
'eclipse_iar' : cdt.EclipseIAR,
5657
'eclipse_armc5' : cdt.EclipseArmc5,
5758
'gnuarmeclipse': gnuarmeclipse.GNUARMEclipse,
59+
'qtcreator': qtcreator.QtCreator,
5860
'zip' : zip.ZIP,
5961
'cmsis' : cmsis.CMSIS
6062
}

tools/export/qtcreator/__init__.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
"""
2+
mbed SDK
3+
Copyright (c) 2014-2016 ARM Limited
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
"""
17+
from os.path import splitext, basename
18+
from tools.targets import TARGET_MAP
19+
from tools.export.exporters import Exporter, filter_supported
20+
21+
22+
class QtCreator(Exporter):
23+
NAME = 'QtCreator'
24+
TOOLCHAIN = 'GCC_ARM'
25+
26+
TARGETS = filter_supported("GCC_ARM", set())
27+
28+
MBED_CONFIG_HEADER_SUPPORTED = True
29+
30+
def generate(self):
31+
self.resources.win_to_unix()
32+
33+
with open("%s.creator" % self.project_name, "w") as fd:
34+
fd.write("[General]\n")
35+
36+
next_is_include = False
37+
includes = []
38+
with open("%s.config" % self.project_name, "w") as fd:
39+
for f in self.flags['c_flags'] + self.flags['cxx_flags']:
40+
f=f.strip()
41+
if next_is_include:
42+
includes.append(f)
43+
next_is_include = False
44+
continue
45+
if f.startswith('-D'):
46+
fd.write("#define %s\n" % (f[2:].replace('=', ' ')))
47+
elif f.startswith('-U'):
48+
fd.write("#undef %s\n" % f[2:])
49+
elif f == "-include":
50+
next_is_include = True
51+
for i in includes:
52+
fd.write("#include \"%s\"\n" % i)
53+
54+
with open("%s.files" % self.project_name, "w") as fd:
55+
for r_type in ['headers', 'c_sources', 's_sources', 'cpp_sources']:
56+
for f in getattr(self.resources, r_type):
57+
fd.write(f + "\n")
58+
59+
with open("%s.includes" % self.project_name, "w") as fd:
60+
for i in self.resources.inc_dirs:
61+
fd.write(i + "\n")

0 commit comments

Comments
 (0)