From 19b7c730aecb7bebcf3a0a5dd0980d96e9102f0a Mon Sep 17 00:00:00 2001 From: Valeriy Koval Date: Thu, 7 May 2015 17:21:44 +0300 Subject: [PATCH] Update project generator and templates. --- platformio/ide/projectgenerator.py | 14 +- platformio/ide/tpls/eclipse/.cproject.tpl | 37 +-- .../ide/tpls/qtcreator/platformio.pro.tpl | 13 +- .../tpls/qtcreator/platformio.pro.user.tpl | 231 ++++++++++++++++++ .../tpls/visualstudio/platformio.vcxproj.tpl | 12 +- 5 files changed, 280 insertions(+), 27 deletions(-) create mode 100644 platformio/ide/tpls/qtcreator/platformio.pro.user.tpl diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index 45fdd3d8..ebdaa2fb 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -2,7 +2,7 @@ # See LICENSE for details. from glob import glob -from os import listdir +from os import listdir, walk from os.path import basename, isdir, join import bottle @@ -32,6 +32,7 @@ class ProjectGenerator(object): for section in config.sections(): if not section.startswith("env:"): continue + data['env_name'] = section[4:] for k, v in config.items(section): data[k] = v return data @@ -43,6 +44,13 @@ class ProjectGenerator(object): return [] def get_srcfiles(self): + result = [] + for root, _, files in walk(util.get_projectsrc_dir()): + for f in files: + result.append(join(root, f)) + return result + + def get_defines(self): return [] def get_tpls(self): @@ -67,5 +75,7 @@ class ProjectGenerator(object): self._tplvars.update({ "project_name": self.get_project_name(), "includes": self.get_includes(), - "srcfiles": self.get_srcfiles() + "srcfiles": self.get_srcfiles(), + "defines": self.get_defines(), + "project_dir": self.project_dir }) diff --git a/platformio/ide/tpls/eclipse/.cproject.tpl b/platformio/ide/tpls/eclipse/.cproject.tpl index 7ed43a49..ccd645ed 100644 --- a/platformio/ide/tpls/eclipse/.cproject.tpl +++ b/platformio/ide/tpls/eclipse/.cproject.tpl @@ -15,7 +15,7 @@ - + @@ -23,35 +23,40 @@ @@ -63,7 +68,7 @@ - + @@ -74,7 +79,7 @@ - + diff --git a/platformio/ide/tpls/qtcreator/platformio.pro.tpl b/platformio/ide/tpls/qtcreator/platformio.pro.tpl index 22188cd8..d809a9b3 100644 --- a/platformio/ide/tpls/qtcreator/platformio.pro.tpl +++ b/platformio/ide/tpls/qtcreator/platformio.pro.tpl @@ -5,15 +5,20 @@ else { HOMEDIR += $$(PWD) } -INCLUDEPATH += "$$HOMEDIR/.platformio/packages/framework-arduinoavr/cores/arduino" -INCLUDEPATH += "$$HOMEDIR/.platformio/packages/toolchain-atmelavr/avr/include" +% for include in includes: +INCLUDEPATH += "{{include}}" +% end win32:INCLUDEPATH ~= s,/,\\,g -# DEFINES += __AVR_ATmega328__ +% for define in defines: +DEFINES += "{{define}}" +% end OTHER_FILES += \ platformio.ini SOURCES += \ - src/main.c + % for file in srcfiles: + {{file}} + % end diff --git a/platformio/ide/tpls/qtcreator/platformio.pro.user.tpl b/platformio/ide/tpls/qtcreator/platformio.pro.user.tpl new file mode 100644 index 00000000..72ecb9ad --- /dev/null +++ b/platformio/ide/tpls/qtcreator/platformio.pro.user.tpl @@ -0,0 +1,231 @@ + + + + + + EnvironmentId + {00248b6a-4380-4f03-8dea-a03053177907} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + {{project_name}} + {{project_name}} + qt.53.win32_mingw482_kit + 1 + 0 + 0 + + {{project_dir}} + + + true + --force run + platformio + %{buildDir} + Custom Process Step + + ProjectExplorer.ProcessStep + + 1 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + --force run -t clean + platformio + %{buildDir} + Custom Process Step + + ProjectExplorer.ProcessStep + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + {{project_dir}} + + + true + --force run + platformio + %{buildDir} + Custom Process Step + + ProjectExplorer.ProcessStep + + 1 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + --force run -t clean + platformio + %{buildDir} + Custom Process Step + + ProjectExplorer.ProcessStep + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 2 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy locally + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + platformio + + Qt4ProjectManager.Qt4RunConfiguration:{{project_dir}}/platformio.pro + + platformio.pro + false + false + + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 16 + + + Version + 16 + + diff --git a/platformio/ide/tpls/visualstudio/platformio.vcxproj.tpl b/platformio/ide/tpls/visualstudio/platformio.vcxproj.tpl index 54d5be85..1a069d7e 100644 --- a/platformio/ide/tpls/visualstudio/platformio.vcxproj.tpl +++ b/platformio/ide/tpls/visualstudio/platformio.vcxproj.tpl @@ -38,14 +38,14 @@ platformio --force run platformio --force run --target clean - WIN32;_DEBUG;$(NMakePreprocessorDefinitions) - $(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\avr\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\cores\arduino;$(NMakeIncludeSearchPath) + {{";".join(defines)}} + {{";".join(includes)}} platformio run platformio run -t clean - WIN32;NDEBUG;$(NMakePreprocessorDefinitions) - $(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\avr\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\cores\arduino;$(NMakeIncludeSearchPath) + {";".join(defines)}} + {{";".join(includes)}} @@ -54,7 +54,9 @@ - + % for file in srcfiles: + + % end