From 8c27754045ea06b21e651caf1e1397f92ebbb3eb Mon Sep 17 00:00:00 2001 From: John Belmonte Date: Sat, 14 May 2022 21:26:04 +0900 Subject: [PATCH] qtcreator IDE template now generates a "generic" Qt project (#4262) * Create qtcreator-generic IDE template. * Fix case of #define in qtcreator-generic template .config file. * follow directory move * * fix includes output * fixup -mlong-calls for clang * add Makefile to files output * fix escaping in config output * Makefile improvements: * support any platformio run target * remove platformio deprecated -f option * remove explicit default target (first is always default) * replace qtcreator rather than making another IDE target Co-authored-by: Donna Whisnant --- .../project/tpls/qtcreator/.gitignore.tpl | 2 + .../project/tpls/qtcreator/Makefile.tpl | 6 +++ .../tpls/qtcreator/platformio.cflags.tpl | 1 + .../tpls/qtcreator/platformio.config.tpl | 8 ++++ .../tpls/qtcreator/platformio.creator.tpl | 2 + .../tpls/qtcreator/platformio.cxxflags.tpl | 1 + .../tpls/qtcreator/platformio.files.tpl | 5 +++ .../tpls/qtcreator/platformio.includes.tpl | 4 ++ .../project/tpls/qtcreator/platformio.pro.tpl | 45 ------------------- 9 files changed, 29 insertions(+), 45 deletions(-) create mode 100644 platformio/project/tpls/qtcreator/.gitignore.tpl create mode 100644 platformio/project/tpls/qtcreator/Makefile.tpl create mode 100644 platformio/project/tpls/qtcreator/platformio.cflags.tpl create mode 100644 platformio/project/tpls/qtcreator/platformio.config.tpl create mode 100644 platformio/project/tpls/qtcreator/platformio.creator.tpl create mode 100644 platformio/project/tpls/qtcreator/platformio.cxxflags.tpl create mode 100644 platformio/project/tpls/qtcreator/platformio.files.tpl create mode 100644 platformio/project/tpls/qtcreator/platformio.includes.tpl delete mode 100644 platformio/project/tpls/qtcreator/platformio.pro.tpl diff --git a/platformio/project/tpls/qtcreator/.gitignore.tpl b/platformio/project/tpls/qtcreator/.gitignore.tpl new file mode 100644 index 00000000..d45ef2cf --- /dev/null +++ b/platformio/project/tpls/qtcreator/.gitignore.tpl @@ -0,0 +1,2 @@ +.pio +*.creator.user diff --git a/platformio/project/tpls/qtcreator/Makefile.tpl b/platformio/project/tpls/qtcreator/Makefile.tpl new file mode 100644 index 00000000..3fcc86ff --- /dev/null +++ b/platformio/project/tpls/qtcreator/Makefile.tpl @@ -0,0 +1,6 @@ +all: + platformio -c qtcreator run + +# forward any other target (clean, build, etc.) to pio run +{{'%'}}: + platformio -c qtcreator run --target $* diff --git a/platformio/project/tpls/qtcreator/platformio.cflags.tpl b/platformio/project/tpls/qtcreator/platformio.cflags.tpl new file mode 100644 index 00000000..f09a94f9 --- /dev/null +++ b/platformio/project/tpls/qtcreator/platformio.cflags.tpl @@ -0,0 +1 @@ +{{cc_flags.replace('-mlongcalls', '-mlong-calls')}} diff --git a/platformio/project/tpls/qtcreator/platformio.config.tpl b/platformio/project/tpls/qtcreator/platformio.config.tpl new file mode 100644 index 00000000..936fdad0 --- /dev/null +++ b/platformio/project/tpls/qtcreator/platformio.config.tpl @@ -0,0 +1,8 @@ +% for define in defines: +% tokens = define.split("=", 1) +% if len(tokens) > 1: +#define {{tokens[0].strip()}} {{!tokens[1].strip()}} +% else: +#define {{define}} +% end +% end diff --git a/platformio/project/tpls/qtcreator/platformio.creator.tpl b/platformio/project/tpls/qtcreator/platformio.creator.tpl new file mode 100644 index 00000000..d0cc464e --- /dev/null +++ b/platformio/project/tpls/qtcreator/platformio.creator.tpl @@ -0,0 +1,2 @@ +[General] + diff --git a/platformio/project/tpls/qtcreator/platformio.cxxflags.tpl b/platformio/project/tpls/qtcreator/platformio.cxxflags.tpl new file mode 100644 index 00000000..c5b30511 --- /dev/null +++ b/platformio/project/tpls/qtcreator/platformio.cxxflags.tpl @@ -0,0 +1 @@ +{{cxx_flags.replace('-mlongcalls', '-mlong-calls')}} diff --git a/platformio/project/tpls/qtcreator/platformio.files.tpl b/platformio/project/tpls/qtcreator/platformio.files.tpl new file mode 100644 index 00000000..39dcf2e2 --- /dev/null +++ b/platformio/project/tpls/qtcreator/platformio.files.tpl @@ -0,0 +1,5 @@ +Makefile +platformio.ini +% for file in src_files: +{{file}} +% end diff --git a/platformio/project/tpls/qtcreator/platformio.includes.tpl b/platformio/project/tpls/qtcreator/platformio.includes.tpl new file mode 100644 index 00000000..435cab10 --- /dev/null +++ b/platformio/project/tpls/qtcreator/platformio.includes.tpl @@ -0,0 +1,4 @@ +./ +% for include in filter_includes(includes): +{{include}} +% end diff --git a/platformio/project/tpls/qtcreator/platformio.pro.tpl b/platformio/project/tpls/qtcreator/platformio.pro.tpl deleted file mode 100644 index 89774699..00000000 --- a/platformio/project/tpls/qtcreator/platformio.pro.tpl +++ /dev/null @@ -1,45 +0,0 @@ -% import re -% -% cpp_standards_remap = { -% "0x": "11", -% "1y": "14", -% "1z": "17", -% "2a": "20", -% "2b": "23" -% } - -win32 { - HOMEDIR += $$(USERPROFILE) -} -else { - HOMEDIR += $$(HOME) -} - -% for include in filter_includes(includes): -% if include.startswith(user_home_dir): -INCLUDEPATH += "$${HOMEDIR}{{include.replace(user_home_dir, "")}}" -% else: -INCLUDEPATH += "{{include}}" -% end -% end - -% for define in defines: -% tokens = define.split("##", 1) -DEFINES += "{{tokens[0].strip()}}" -% end - -OTHER_FILES += platformio.ini - -% for file in src_files: -% if file.endswith((".h", ".hpp")): -HEADERS += {{file}} -% else: -SOURCES += {{file}} -% end -% end - -% STD_RE = re.compile(r"\-std=[a-z\+]+(\w+)") -% cxx_stds = STD_RE.findall(cxx_flags) -% if cxx_stds: -CONFIG += c++{{ cpp_standards_remap.get(cxx_stds[-1], cxx_stds[-1]) }} -% end