Add generic targets for IDE // Resolve #427

This commit is contained in:
Ivan Kravets
2016-01-05 02:15:43 +02:00
parent 7a7fa845fe
commit df099e15c0
15 changed files with 196 additions and 28 deletions

View File

@ -7,8 +7,9 @@ PlatformIO 2.0
2.7.1 (2016-01-??) 2.7.1 (2016-01-??)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
* Added generic targets to Eclipse IDE: Build, Clean, Upload, Upload SPIFFS * Added generic targets for Eclipse IDE, Emacs, Sublime Text: Build, Clean,
image, Upload using Programmer Upload, Upload SPIFFS image, Upload using Programmer, Update installed
platforms and libraries
(`issue #427 <https://github.com/platformio/platformio/issues/427>`_) (`issue #427 <https://github.com/platformio/platformio/issues/427>`_)
* Updated Teensy Arduino Framework to 1.26 * Updated Teensy Arduino Framework to 1.26
(`issue #434 <https://github.com/platformio/platformio/issues/434>`_) (`issue #434 <https://github.com/platformio/platformio/issues/434>`_)

View File

@ -50,12 +50,15 @@ Then:
2. Open source file from ``src`` directory (``*.c, *.cpp, *.ino, etc.``) 2. Open source file from ``src`` directory (``*.c, *.cpp, *.ino, etc.``)
3. Build project (*DO NOT RUN*): ``Menu: Run > Build``. 3. Build project (*DO NOT RUN*): ``Menu: Run > Build``.
There are 3 predefined targets for building (*NOT FOR RUNNING*, see marks on There are 6 predefined targets for building (*NOT FOR RUNNING*, see marks on
the screenshot below): the screenshot below):
* ``PLATFORMIO_BUILD`` - build project without auto-uploading * ``PLATFORMIO_BUILD`` - Build project without auto-uploading
* ``PLATFORMIO_UPLOAD`` - build and upload (if no errors) * ``PLATFORMIO_UPLOAD`` - Build and upload (if no errors).
* ``PLATFORMIO_CLEAN`` - clean compiled objects and etc. * ``PLATFORMIO_CLEAN`` - Clean compiled objects.
* ``PLATFORMIO_PROGRAM`` - Build and upload using external programmer (if no errors), see :ref:`atmelavr_upload_via_programmer`.
* ``PLATFORMIO_UPLOADFS`` - Upload files to file system SPIFFS, see :ref:`platform_espressif_uploadfs`.
* ``PLATFORMIO_UPDATE`` - Update installed platforms and libraries.
.. warning:: .. warning::
The libraries which are added, installed or used in the project The libraries which are added, installed or used in the project

View File

@ -56,11 +56,17 @@ Then:
3. Build project using ``Menu: Project > Build Project`` or preconfigured 3. Build project using ``Menu: Project > Build Project`` or preconfigured
Make Targets (see screenshot below): Make Targets (see screenshot below):
+ ``PlatformIO: Build`` + ``PlatformIO: Build`` - Build project without auto-uploading
+ ``PlatformIO: Clean`` + ``PlatformIO: Clean`` - Clean compiled objects.
+ ``PlatformIO: Upload`` + ``PlatformIO: Upload`` - Build and upload (if no errors)
+ ``PlatformIO: Upload using Programmer`` see :ref:`atmelavr_upload_via_programmer` + ``PlatformIO: Upload using Programmer`` see :ref:`atmelavr_upload_via_programmer`
+ ``PlatformIO: Upload SPIFFS image`` see :ref:`platform_espressif_uploadfs` + ``PlatformIO: Upload SPIFFS image`` see :ref:`platform_espressif_uploadfs`
+ ``PlatformIO: Update platforms and libraries`` - Update installed platforms and libraries
If you have some problems with unresolved includes, defines, etc., then
* Restart Eclipse IDE
* Rebuild index using ``Menu: Project > C/C++ Index > Rebuild``.
.. warning:: .. warning::
The libraries which are added, installed or used in the project The libraries which are added, installed or used in the project

View File

@ -60,10 +60,10 @@ command and generate project via :option:`platformio init --ide` command:
There are 6 predefined targets for building. There are 6 predefined targets for building.
* ``platformio_build`` - Build project without auto-uploading. (``C-c i b``) * ``platformio_build`` - Build project without auto-uploading. (``C-c i b``)
* ``platformio_upload`` - Build and upload (if no errors). (``C-c i u``)
* ``platformio_programmer_upload`` - Build and upload using external programmer (if no errors). (``C-c i p``)
* ``platformio_spiffs_upload`` - Upload files to file system SPIFFS). (``C-c i s``)
* ``platformio_clean`` - Clean compiled objects. (``C-c i c``) * ``platformio_clean`` - Clean compiled objects. (``C-c i c``)
* ``platformio_upload`` - Build and upload (if no errors). (``C-c i u``)
* ``platformio_programmer_upload`` - Build and upload using external programmer (if no errors, see :ref:`atmelavr_upload_via_programmer`). (``C-c i p``)
* ``platformio_spiffs_upload`` - Upload files to file system SPIFFS (see :ref:`platform_espressif_uploadfs`). (``C-c i s``)
* ``platformio_update`` - Update installed platforms and libraries. (``C-c i d``) * ``platformio_update`` - Update installed platforms and libraries. (``C-c i d``)
.. warning:: .. warning::

View File

@ -50,6 +50,15 @@ Then:
3. Open source file from ``src`` directory (``*.c, *.cpp, *.ino, etc.``) 3. Open source file from ``src`` directory (``*.c, *.cpp, *.ino, etc.``)
4. Build project: ``Menu: Tools > Build``. 4. Build project: ``Menu: Tools > Build``.
Also, you can access to all pre-configured targets via
``Menu: Tools > Builds With...`` (ST3)
+ ``PlatformIO - Build`` - Build project without auto-uploading
+ ``PlatformIO - Clean`` - Clean compiled objects.
+ ``PlatformIO - Upload`` - Build and upload (if no errors)
+ ``PlatformIO - Upload using Programmer`` see :ref:`atmelavr_upload_via_programmer`
+ ``PlatformIO - Upload SPIFFS image`` see :ref:`platform_espressif_uploadfs`
+ ``PlatformIO - Update platforms and libraries`` - Update installed platforms and libraries
Manual Integration Manual Integration
^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^

View File

@ -2,13 +2,15 @@
<project version="4"> <project version="4">
<component name="CMakeRunConfigurationManager" shouldGenerate="true" assignedExecutableTargets="true" buildAllGenerated="true"> <component name="CMakeRunConfigurationManager" shouldGenerate="true" assignedExecutableTargets="true" buildAllGenerated="true">
<generated> <generated>
<config projectName="clion" targetName="PLATFORMIO_CLEAN" />
<config projectName="clion" targetName="PLATFORMIO_RUN" />
<config projectName="clion" targetName="PLATFORMIO" /> <config projectName="clion" targetName="PLATFORMIO" />
<config projectName="clion" targetName="clion" /> <config projectName="clion" targetName="clion" />
<config projectName="clion" targetName="DEBUG" />
<config projectName="clion" targetName="PLATFORMIO_BUILD" /> <config projectName="clion" targetName="PLATFORMIO_BUILD" />
<config projectName="clion" targetName="PLATFORMIO_UPLOAD" /> <config projectName="clion" targetName="PLATFORMIO_UPLOAD" />
<config projectName="clion" targetName="PLATFORMIO_CLEAN" />
<config projectName="clion" targetName="PLATFORMIO_PROGRAM" />
<config projectName="clion" targetName="PLATFORMIO_UPLOADFS" />
<config projectName="clion" targetName="PLATFORMIO_UPDATE_ALL" />
<config projectName="clion" targetName="DEBUG" />
</generated> </generated>
</component> </component>
<component name="CMakeSettings" AUTO_RELOAD="true" GENERATION_PASS_SYSTEM_ENVIRONMENT="true"> <component name="CMakeSettings" AUTO_RELOAD="true" GENERATION_PASS_SYSTEM_ENVIRONMENT="true">
@ -185,11 +187,26 @@
<envs /> <envs />
<method /> <method />
</configuration> </configuration>
<list size="4"> <configuration default="false" name="PLATFORMIO_UPLOADFS" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="PLATFORMIO_UPLOADFS" CONFIG_NAME="Debug">
<envs />
<method />
</configuration>
<configuration default="false" name="PLATFORMIO_PROGRAM" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="PLATFORMIO_PROGRAM" CONFIG_NAME="Debug">
<envs />
<method />
</configuration>
<configuration default="false" name="PLATFORMIO_UPDATE" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="PLATFORMIO_UPDATE_ALL" CONFIG_NAME="Debug">
<envs />
<method />
</configuration>
<list size="7">
<item index="0" class="java.lang.String" itemvalue="Application.Build All" /> <item index="0" class="java.lang.String" itemvalue="Application.Build All" />
<item index="1" class="java.lang.String" itemvalue="Application.PLATFORMIO_BUILD" /> <item index="1" class="java.lang.String" itemvalue="Application.PLATFORMIO_BUILD" />
<item index="2" class="java.lang.String" itemvalue="Application.PLATFORMIO_CLEAN" />
<item index="3" class="java.lang.String" itemvalue="Application.PLATFORMIO_UPLOAD" /> <item index="3" class="java.lang.String" itemvalue="Application.PLATFORMIO_UPLOAD" />
<item index="2" class="java.lang.String" itemvalue="Application.PLATFORMIO_CLEAN" />
<item index="5" class="java.lang.String" itemvalue="Application.PLATFORMIO_PROGRAM" />
<item index="4" class="java.lang.String" itemvalue="Application.PLATFORMIO_UPLOADFS" />
<item index="6" class="java.lang.String" itemvalue="Application.PLATFORMIO_UPDATE" />
</list> </list>
</component> </component>
<component name="ShelveChangesManager" show_recycled="false" /> <component name="ShelveChangesManager" show_recycled="false" />

View File

@ -13,8 +13,8 @@ include_directories("$ENV{HOME}/.platformio/packages/toolchain-atmelavr/lib/gcc/
add_definitions(-DF_CPU=16000000L) add_definitions(-DF_CPU=16000000L)
add_definitions(-DARDUINO_ARCH_AVR) add_definitions(-DARDUINO_ARCH_AVR)
add_definitions(-DARDUINO_AVR_UNO) add_definitions(-DARDUINO_AVR_UNO)
add_definitions(-DARDUINO=10605) add_definitions(-DARDUINO=10607)
add_definitions(-DPLATFORMIO=020304) add_definitions(-DPLATFORMIO=020701)
add_definitions(-D__AVR_ATmega328P__) add_definitions(-D__AVR_ATmega328P__)
add_custom_target( add_custom_target(
@ -35,4 +35,24 @@ add_custom_target(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
add_executable(clion src/blink.cpp) add_custom_target(
PLATFORMIO_PROGRAM ALL
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target program
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(
PLATFORMIO_UPLOADFS ALL
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target uploadfs
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(
PLATFORMIO_UPDATE_ALL ALL
COMMAND ${PLATFORMIO_CMD} -f -c clion update
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_executable(clion
src/blink.cpp
)

View File

@ -131,6 +131,14 @@
<useDefaultCommand>true</useDefaultCommand> <useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>false</runAllBuilders> <runAllBuilders>false</runAllBuilders>
</target> </target>
<target name="PlatformIO: Update platforms and libraries" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>platformio</buildCommand>
<buildArguments>-f -c eclipse</buildArguments>
<buildTarget>update</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
</buildTargets> </buildTargets>
</storageModule> </storageModule>
</cproject> </cproject>

View File

@ -32,6 +32,37 @@
"upload" "upload"
], ],
"name": "Upload" "name": "Upload"
},
{
"cmd":
[
"platformio",
"-f", "-c", "sublimetext",
"run",
"--target",
"program"
],
"name": "Upload using Programmer"
},
{
"cmd":
[
"platformio",
"-f", "-c", "sublimetext",
"run",
"--target",
"uploadfs"
],
"name": "Upload SPIFFS image"
},
{
"cmd":
[
"platformio",
"-f", "-c", "sublimetext",
"update"
],
"name": "Update platforms and libraries"
} }
], ],
"working_dir": "${project_path:${folder}}", "working_dir": "${project_path:${folder}}",

View File

@ -24,4 +24,5 @@ from platformio.commands.platforms import \
@click.pass_context @click.pass_context
def cli(ctx): def cli(ctx):
ctx.invoke(cmd_platforms_update) ctx.invoke(cmd_platforms_update)
click.echo()
ctx.invoke(cmd_lib_update) ctx.invoke(cmd_lib_update)

View File

@ -2,13 +2,15 @@
<project version="4"> <project version="4">
<component name="CMakeRunConfigurationManager" shouldGenerate="true" assignedExecutableTargets="true" buildAllGenerated="true"> <component name="CMakeRunConfigurationManager" shouldGenerate="true" assignedExecutableTargets="true" buildAllGenerated="true">
<generated> <generated>
<config projectName="{{project_name}}" targetName="PLATFORMIO_CLEAN" />
<config projectName="{{project_name}}" targetName="PLATFORMIO_RUN" />
<config projectName="{{project_name}}" targetName="PLATFORMIO" /> <config projectName="{{project_name}}" targetName="PLATFORMIO" />
<config projectName="{{project_name}}" targetName="{{project_name}}" /> <config projectName="{{project_name}}" targetName="{{project_name}}" />
<config projectName="{{project_name}}" targetName="DEBUG" />
<config projectName="{{project_name}}" targetName="PLATFORMIO_BUILD" /> <config projectName="{{project_name}}" targetName="PLATFORMIO_BUILD" />
<config projectName="{{project_name}}" targetName="PLATFORMIO_UPLOAD" /> <config projectName="{{project_name}}" targetName="PLATFORMIO_UPLOAD" />
<config projectName="{{project_name}}" targetName="PLATFORMIO_CLEAN" />
<config projectName="{{project_name}}" targetName="PLATFORMIO_PROGRAM" />
<config projectName="{{project_name}}" targetName="PLATFORMIO_UPLOADFS" />
<config projectName="{{project_name}}" targetName="PLATFORMIO_UPDATE_ALL" />
<config projectName="{{project_name}}" targetName="DEBUG" />
</generated> </generated>
</component> </component>
<component name="CMakeSettings" AUTO_RELOAD="true" GENERATION_PASS_SYSTEM_ENVIRONMENT="true"> <component name="CMakeSettings" AUTO_RELOAD="true" GENERATION_PASS_SYSTEM_ENVIRONMENT="true">
@ -187,11 +189,26 @@
<envs /> <envs />
<method /> <method />
</configuration> </configuration>
<list size="4"> <configuration default="false" name="PLATFORMIO_UPLOADFS" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="PLATFORMIO_UPLOADFS" CONFIG_NAME="Debug">
<envs />
<method />
</configuration>
<configuration default="false" name="PLATFORMIO_PROGRAM" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="PLATFORMIO_PROGRAM" CONFIG_NAME="Debug">
<envs />
<method />
</configuration>
<configuration default="false" name="PLATFORMIO_UPDATE" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="{{project_name}}" TARGET_NAME="PLATFORMIO_UPDATE_ALL" CONFIG_NAME="Debug">
<envs />
<method />
</configuration>
<list size="7">
<item index="0" class="java.lang.String" itemvalue="Application.Build All" /> <item index="0" class="java.lang.String" itemvalue="Application.Build All" />
<item index="1" class="java.lang.String" itemvalue="Application.PLATFORMIO_BUILD" /> <item index="1" class="java.lang.String" itemvalue="Application.PLATFORMIO_BUILD" />
<item index="2" class="java.lang.String" itemvalue="Application.PLATFORMIO_CLEAN" />
<item index="3" class="java.lang.String" itemvalue="Application.PLATFORMIO_UPLOAD" /> <item index="3" class="java.lang.String" itemvalue="Application.PLATFORMIO_UPLOAD" />
<item index="2" class="java.lang.String" itemvalue="Application.PLATFORMIO_CLEAN" />
<item index="5" class="java.lang.String" itemvalue="Application.PLATFORMIO_PROGRAM" />
<item index="4" class="java.lang.String" itemvalue="Application.PLATFORMIO_UPLOADFS" />
<item index="6" class="java.lang.String" itemvalue="Application.PLATFORMIO_UPDATE" />
</list> </list>
</component> </component>
<component name="ShelveChangesManager" show_recycled="false" /> <component name="ShelveChangesManager" show_recycled="false" />

View File

@ -38,6 +38,24 @@ add_custom_target(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
add_custom_target(
PLATFORMIO_PROGRAM ALL
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target program
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(
PLATFORMIO_UPLOADFS ALL
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target uploadfs
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(
PLATFORMIO_UPDATE_ALL ALL
COMMAND ${PLATFORMIO_CMD} -f -c clion update
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
% if src_files and any([f.endswith((".c", ".cpp")) for f in src_files]): % if src_files and any([f.endswith((".c", ".cpp")) for f in src_files]):
add_executable({{project_name}} add_executable({{project_name}}
% for f in src_files: % for f in src_files:

View File

@ -158,6 +158,14 @@
<useDefaultCommand>true</useDefaultCommand> <useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>false</runAllBuilders> <runAllBuilders>false</runAllBuilders>
</target> </target>
<target name="PlatformIO: Update platforms and libraries" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>platformio</buildCommand>
<buildArguments>-f -c eclipse</buildArguments>
<buildTarget>update</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
</buildTargets> </buildTargets>
</storageModule> </storageModule>
</cproject> </cproject>

View File

@ -6,9 +6,9 @@
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
% if "windows" in systype: % if "windows" in systype:
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-869785120007741010" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${USERPROFILE}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true" store-entries-with-project="false"> <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1291887707783033084" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${USERPROFILE}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
% else: % else:
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-869785120007741010" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${HOME}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true" store-entries-with-project="false"> <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-869785120007741010" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${HOME}{{cxx_path.replace(user_home_dir, '')}} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
% end % end
<language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/> <language-scope id="org.eclipse.cdt.core.g++"/>

View File

@ -11,6 +11,15 @@
"name": "PlatformIO", "name": "PlatformIO",
"variants": "variants":
[ [
{
"cmd":
[
"platformio",
"-f", "-c", "sublimetext",
"run"
],
"name": "Build"
},
{ {
"cmd": "cmd":
[ [
@ -33,6 +42,17 @@
], ],
"name": "Upload" "name": "Upload"
}, },
{
"cmd":
[
"platformio",
"-f", "-c", "sublimetext",
"run",
"--target",
"program"
],
"name": "Upload using Programmer"
},
{ {
"cmd": "cmd":
[ [
@ -42,7 +62,16 @@
"--target", "--target",
"uploadfs" "uploadfs"
], ],
"name": "Upload SPIFFS" "name": "Upload SPIFFS image"
},
{
"cmd":
[
"platformio",
"-f", "-c", "sublimetext",
"update"
],
"name": "Update platforms and libraries"
} }
], ],
"working_dir": "${project_path:${folder}}", "working_dir": "${project_path:${folder}}",