Clone of official tools

Committer:
theotherjimmy
Date:
Tue Oct 10 16:56:30 2017 -0500
Revision:
40:7d3fa6b99b2b
Parent:
36:96847d42f010
Child:
43:2a7da56ebd24
Update to tools release 5.6.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
theotherjimmy 40:7d3fa6b99b2b 19 from tools.export.exporters import Exporter
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
The Other Jimmy 36:96847d42f010 25 MBED_CONFIG_HEADER_SUPPORTED = True
The Other Jimmy 36:96847d42f010 26
The Other Jimmy 36:96847d42f010 27 def generate(self):
The Other Jimmy 36:96847d42f010 28 self.resources.win_to_unix()
The Other Jimmy 36:96847d42f010 29
The Other Jimmy 36:96847d42f010 30 defines = [] # list of tuples ('D'/'U', [key, value]) (value is optional)
The Other Jimmy 36:96847d42f010 31 forced_includes = [] # list of strings
The Other Jimmy 36:96847d42f010 32 sources = [] # list of strings
The Other Jimmy 36:96847d42f010 33 include_paths = [] # list of strings
The Other Jimmy 36:96847d42f010 34
The Other Jimmy 36:96847d42f010 35 next_is_include = False
The Other Jimmy 36:96847d42f010 36 for f in self.flags['c_flags'] + self.flags['cxx_flags']:
The Other Jimmy 36:96847d42f010 37 f=f.strip()
The Other Jimmy 36:96847d42f010 38 if next_is_include:
The Other Jimmy 36:96847d42f010 39 forced_includes.append(f)
The Other Jimmy 36:96847d42f010 40 next_is_include = False
The Other Jimmy 36:96847d42f010 41 continue
The Other Jimmy 36:96847d42f010 42 if f.startswith('-D'):
The Other Jimmy 36:96847d42f010 43 defines.append(('D', f[2:].split('=', 1)))
The Other Jimmy 36:96847d42f010 44 elif f.startswith('-U'):
The Other Jimmy 36:96847d42f010 45 defines.append(('U', [f[2:]]))
The Other Jimmy 36:96847d42f010 46 elif f == "-include":
The Other Jimmy 36:96847d42f010 47 next_is_include = True
The Other Jimmy 36:96847d42f010 48
The Other Jimmy 36:96847d42f010 49 for r_type in ['headers', 'c_sources', 's_sources', 'cpp_sources']:
The Other Jimmy 36:96847d42f010 50 sources.extend(getattr(self.resources, r_type))
The Other Jimmy 36:96847d42f010 51
The Other Jimmy 36:96847d42f010 52 include_paths = self.resources.inc_dirs
The Other Jimmy 36:96847d42f010 53
The Other Jimmy 36:96847d42f010 54 ctx = {
The Other Jimmy 36:96847d42f010 55 'defines': defines,
The Other Jimmy 36:96847d42f010 56 'forced_includes': forced_includes,
The Other Jimmy 36:96847d42f010 57 'sources': sources,
The Other Jimmy 36:96847d42f010 58 'include_paths': self.resources.inc_dirs
The Other Jimmy 36:96847d42f010 59 }
The Other Jimmy 36:96847d42f010 60
The Other Jimmy 36:96847d42f010 61 for ext in ['creator', 'files', 'includes', 'config']:
The Other Jimmy 36:96847d42f010 62 self.gen_file('qtcreator/%s.tmpl' % ext, ctx, "%s.%s" % (self.project_name, ext))
The Other Jimmy 36:96847d42f010 63
The Other Jimmy 36:96847d42f010 64 # finally, generate the Makefile
The Other Jimmy 36:96847d42f010 65 super(QtCreator, self).generate()