-
Notifications
You must be signed in to change notification settings - Fork 3k
Support for Qt Creator Generic project export and associated Makefile #4115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f3ccfbe
Added minimal support for Qt Creator projects
cvtsi2sd 70412ec
QtCreator exporter: switch to jinja-based templates
cvtsi2sd 92eae30
Qt Creator exporter: added derivation from GccArm Makefile
cvtsi2sd 2baa215
Updated year in license header
cvtsi2sd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
""" | ||
mbed SDK | ||
Copyright (c) 2014-2017 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 | ||
from tools.export.makefile import GccArm | ||
|
||
class QtCreator(GccArm): | ||
NAME = 'QtCreator' | ||
TOOLCHAIN = 'GCC_ARM' | ||
|
||
TARGETS = filter_supported("GCC_ARM", set()) | ||
|
||
MBED_CONFIG_HEADER_SUPPORTED = True | ||
|
||
def generate(self): | ||
self.resources.win_to_unix() | ||
|
||
defines = [] # list of tuples ('D'/'U', [key, value]) (value is optional) | ||
forced_includes = [] # list of strings | ||
sources = [] # list of strings | ||
include_paths = [] # list of strings | ||
|
||
next_is_include = False | ||
for f in self.flags['c_flags'] + self.flags['cxx_flags']: | ||
f=f.strip() | ||
if next_is_include: | ||
forced_includes.append(f) | ||
next_is_include = False | ||
continue | ||
if f.startswith('-D'): | ||
defines.append(('D', f[2:].split('=', 1))) | ||
elif f.startswith('-U'): | ||
defines.append(('U', [f[2:]])) | ||
elif f == "-include": | ||
next_is_include = True | ||
|
||
for r_type in ['headers', 'c_sources', 's_sources', 'cpp_sources']: | ||
sources.extend(getattr(self.resources, r_type)) | ||
|
||
include_paths = self.resources.inc_dirs | ||
|
||
ctx = { | ||
'defines': defines, | ||
'forced_includes': forced_includes, | ||
'sources': sources, | ||
'include_paths': self.resources.inc_dirs | ||
} | ||
|
||
for ext in ['creator', 'files', 'includes', 'config']: | ||
self.gen_file('qtcreator/%s.tmpl' % ext, ctx, "%s.%s" % (self.project_name, ext)) | ||
|
||
# finally, generate the Makefile | ||
super(QtCreator, self).generate() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{% for d in defines -%} | ||
{% if d[0] == 'D' %}#define {% else %}#undef{% endif %} {{ d[1]|join(' ')}} | ||
{% endfor %} | ||
{% for i in forced_includes -%} | ||
#include "{{i}}" | ||
{% endfor %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[General] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% for s in sources -%} | ||
{{s}} | ||
{% endfor %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% for i in include_paths -%} | ||
{{i}} | ||
{% endfor %} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10/10 best template
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hahaha I told you that I was a bit ashamed to inconvenience Jinja just for this kind of output. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it's there if we need to add something to that configuration file.