Clone of official tools

Committer:
The Other Jimmy
Date:
Thu Jun 22 11:12:28 2017 -0500
Revision:
36:96847d42f010
Child:
40:7d3fa6b99b2b
Tools release 5.5.1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
The Other Jimmy 36:96847d42f010 1 """
The Other Jimmy 36:96847d42f010 2 mbed SDK
The Other Jimmy 36:96847d42f010 3 Copyright (c) 2014-2017 ARM Limited
The Other Jimmy 36:96847d42f010 4
The Other Jimmy 36:96847d42f010 5 Licensed under the Apache License, Version 2.0 (the "License");
The Other Jimmy 36:96847d42f010 6 you may not use this file except in compliance with the License.
The Other Jimmy 36:96847d42f010 7 You may obtain a copy of the License at
The Other Jimmy 36:96847d42f010 8
The Other Jimmy 36:96847d42f010 9 http://www.apache.org/licenses/LICENSE-2.0
The Other Jimmy 36:96847d42f010 10
The Other Jimmy 36:96847d42f010 11 Unless required by applicable law or agreed to in writing, software
The Other Jimmy 36:96847d42f010 12 distributed under the License is distributed on an "AS IS" BASIS,
The Other Jimmy 36:96847d42f010 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
The Other Jimmy 36:96847d42f010 14 See the License for the specific language governing permissions and
The Other Jimmy 36:96847d42f010 15 limitations under the License.
The Other Jimmy 36:96847d42f010 16 """
The Other Jimmy 36:96847d42f010 17 from os.path import splitext, basename
The Other Jimmy 36:96847d42f010 18 from tools.targets import TARGET_MAP
The Other Jimmy 36:96847d42f010 19 from tools.export.exporters import Exporter, filter_supported
The Other Jimmy 36:96847d42f010 20 from tools.export.makefile import GccArm
The Other Jimmy 36:96847d42f010 21
The Other Jimmy 36:96847d42f010 22 class QtCreator(GccArm):
The Other Jimmy 36:96847d42f010 23 NAME = 'QtCreator'
The Other Jimmy 36:96847d42f010 24 TOOLCHAIN = 'GCC_ARM'
The Other Jimmy 36:96847d42f010 25
The Other Jimmy 36:96847d42f010 26 TARGETS = filter_supported("GCC_ARM", set())
The Other Jimmy 36:96847d42f010 27
The Other Jimmy 36:96847d42f010 28 MBED_CONFIG_HEADER_SUPPORTED = True
The Other Jimmy 36:96847d42f010 29
The Other Jimmy 36:96847d42f010 30 def generate(self):
The Other Jimmy 36:96847d42f010 31 self.resources.win_to_unix()
The Other Jimmy 36:96847d42f010 32
The Other Jimmy 36:96847d42f010 33 defines = [] # list of tuples ('D'/'U', [key, value]) (value is optional)
The Other Jimmy 36:96847d42f010 34 forced_includes = [] # list of strings
The Other Jimmy 36:96847d42f010 35 sources = [] # list of strings
The Other Jimmy 36:96847d42f010 36 include_paths = [] # list of strings
The Other Jimmy 36:96847d42f010 37
The Other Jimmy 36:96847d42f010 38 next_is_include = False
The Other Jimmy 36:96847d42f010 39 for f in self.flags['c_flags'] + self.flags['cxx_flags']:
The Other Jimmy 36:96847d42f010 40 f=f.strip()
The Other Jimmy 36:96847d42f010 41 if next_is_include:
The Other Jimmy 36:96847d42f010 42 forced_includes.append(f)
The Other Jimmy 36:96847d42f010 43 next_is_include = False
The Other Jimmy 36:96847d42f010 44 continue
The Other Jimmy 36:96847d42f010 45 if f.startswith('-D'):
The Other Jimmy 36:96847d42f010 46 defines.append(('D', f[2:].split('=', 1)))
The Other Jimmy 36:96847d42f010 47 elif f.startswith('-U'):
The Other Jimmy 36:96847d42f010 48 defines.append(('U', [f[2:]]))
The Other Jimmy 36:96847d42f010 49 elif f == "-include":
The Other Jimmy 36:96847d42f010 50 next_is_include = True
The Other Jimmy 36:96847d42f010 51
The Other Jimmy 36:96847d42f010 52 for r_type in ['headers', 'c_sources', 's_sources', 'cpp_sources']:
The Other Jimmy 36:96847d42f010 53 sources.extend(getattr(self.resources, r_type))
The Other Jimmy 36:96847d42f010 54
The Other Jimmy 36:96847d42f010 55 include_paths = self.resources.inc_dirs
The Other Jimmy 36:96847d42f010 56
The Other Jimmy 36:96847d42f010 57 ctx = {
The Other Jimmy 36:96847d42f010 58 'defines': defines,
The Other Jimmy 36:96847d42f010 59 'forced_includes': forced_includes,
The Other Jimmy 36:96847d42f010 60 'sources': sources,
The Other Jimmy 36:96847d42f010 61 'include_paths': self.resources.inc_dirs
The Other Jimmy 36:96847d42f010 62 }
The Other Jimmy 36:96847d42f010 63
The Other Jimmy 36:96847d42f010 64 for ext in ['creator', 'files', 'includes', 'config']:
The Other Jimmy 36:96847d42f010 65 self.gen_file('qtcreator/%s.tmpl' % ext, ctx, "%s.%s" % (self.project_name, ext))
The Other Jimmy 36:96847d42f010 66
The Other Jimmy 36:96847d42f010 67 # finally, generate the Makefile
The Other Jimmy 36:96847d42f010 68 super(QtCreator, self).generate()