Clone of official tools
export/qtcreator/__init__.py@47:21ae3e5a7128, 2021-02-04 (annotated)
- Committer:
- Anders Blomdell
- Date:
- Thu Feb 04 17:17:13 2021 +0100
- Revision:
- 47:21ae3e5a7128
- Parent:
- 43:2a7da56ebd24
Add a few normpath calls
Who changed what in which revision?
User | Revision | Line number | New 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 |
theotherjimmy |
43:2a7da56ebd24 | 18 | from os import remove |
The Other Jimmy |
36:96847d42f010 | 19 | from tools.targets import TARGET_MAP |
theotherjimmy |
40:7d3fa6b99b2b | 20 | from tools.export.exporters import Exporter |
The Other Jimmy |
36:96847d42f010 | 21 | from tools.export.makefile import GccArm |
The Other Jimmy |
36:96847d42f010 | 22 | |
The Other Jimmy |
36:96847d42f010 | 23 | class QtCreator(GccArm): |
The Other Jimmy |
36:96847d42f010 | 24 | NAME = 'QtCreator' |
The Other Jimmy |
36:96847d42f010 | 25 | |
The Other Jimmy |
36:96847d42f010 | 26 | MBED_CONFIG_HEADER_SUPPORTED = True |
The Other Jimmy |
36:96847d42f010 | 27 | |
The Other Jimmy |
36:96847d42f010 | 28 | def generate(self): |
The Other Jimmy |
36:96847d42f010 | 29 | self.resources.win_to_unix() |
The Other Jimmy |
36:96847d42f010 | 30 | |
The Other Jimmy |
36:96847d42f010 | 31 | defines = [] # list of tuples ('D'/'U', [key, value]) (value is optional) |
The Other Jimmy |
36:96847d42f010 | 32 | forced_includes = [] # list of strings |
The Other Jimmy |
36:96847d42f010 | 33 | sources = [] # list of strings |
The Other Jimmy |
36:96847d42f010 | 34 | include_paths = [] # list of strings |
The Other Jimmy |
36:96847d42f010 | 35 | |
The Other Jimmy |
36:96847d42f010 | 36 | next_is_include = False |
The Other Jimmy |
36:96847d42f010 | 37 | for f in self.flags['c_flags'] + self.flags['cxx_flags']: |
The Other Jimmy |
36:96847d42f010 | 38 | f=f.strip() |
The Other Jimmy |
36:96847d42f010 | 39 | if next_is_include: |
The Other Jimmy |
36:96847d42f010 | 40 | forced_includes.append(f) |
The Other Jimmy |
36:96847d42f010 | 41 | next_is_include = False |
The Other Jimmy |
36:96847d42f010 | 42 | continue |
The Other Jimmy |
36:96847d42f010 | 43 | if f.startswith('-D'): |
The Other Jimmy |
36:96847d42f010 | 44 | defines.append(('D', f[2:].split('=', 1))) |
The Other Jimmy |
36:96847d42f010 | 45 | elif f.startswith('-U'): |
The Other Jimmy |
36:96847d42f010 | 46 | defines.append(('U', [f[2:]])) |
The Other Jimmy |
36:96847d42f010 | 47 | elif f == "-include": |
The Other Jimmy |
36:96847d42f010 | 48 | next_is_include = True |
The Other Jimmy |
36:96847d42f010 | 49 | |
The Other Jimmy |
36:96847d42f010 | 50 | for r_type in ['headers', 'c_sources', 's_sources', 'cpp_sources']: |
The Other Jimmy |
36:96847d42f010 | 51 | sources.extend(getattr(self.resources, r_type)) |
The Other Jimmy |
36:96847d42f010 | 52 | |
The Other Jimmy |
36:96847d42f010 | 53 | include_paths = self.resources.inc_dirs |
The Other Jimmy |
36:96847d42f010 | 54 | |
The Other Jimmy |
36:96847d42f010 | 55 | ctx = { |
The Other Jimmy |
36:96847d42f010 | 56 | 'defines': defines, |
The Other Jimmy |
36:96847d42f010 | 57 | 'forced_includes': forced_includes, |
The Other Jimmy |
36:96847d42f010 | 58 | 'sources': sources, |
The Other Jimmy |
36:96847d42f010 | 59 | 'include_paths': self.resources.inc_dirs |
The Other Jimmy |
36:96847d42f010 | 60 | } |
The Other Jimmy |
36:96847d42f010 | 61 | |
The Other Jimmy |
36:96847d42f010 | 62 | for ext in ['creator', 'files', 'includes', 'config']: |
The Other Jimmy |
36:96847d42f010 | 63 | self.gen_file('qtcreator/%s.tmpl' % ext, ctx, "%s.%s" % (self.project_name, ext)) |
The Other Jimmy |
36:96847d42f010 | 64 | |
The Other Jimmy |
36:96847d42f010 | 65 | # finally, generate the Makefile |
The Other Jimmy |
36:96847d42f010 | 66 | super(QtCreator, self).generate() |
theotherjimmy |
43:2a7da56ebd24 | 67 | |
theotherjimmy |
43:2a7da56ebd24 | 68 | @staticmethod |
theotherjimmy |
43:2a7da56ebd24 | 69 | def clean(project_name): |
theotherjimmy |
43:2a7da56ebd24 | 70 | for ext in ['creator', 'files', 'includes', 'config']: |
theotherjimmy |
43:2a7da56ebd24 | 71 | remove("%s.%s" % (project_name, ext)) |