Full support of CLion IDE including code auto-completion // Resolve #132

This commit is contained in:
Ivan Kravets
2015-10-13 14:01:16 +01:00
parent f758d8607a
commit de2d6818c1
15 changed files with 105 additions and 85 deletions

View File

@ -7,6 +7,9 @@ PlatformIO 2.0
2.3.4 (2015-10-??) 2.3.4 (2015-10-??)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
* Full support of `CLion IDE <http://docs.platformio.org/en/latest/ide/clion.html>`_
including code auto-completion
(`issue #132 <https://github.com/platformio/platformio/issues/132>`_)
* Added support for ubIQio Ardhat board * Added support for ubIQio Ardhat board
(`pull #302 <https://github.com/platformio/platformio/pull/302>`_) (`pull #302 <https://github.com/platformio/platformio/pull/302>`_)
* Use Teensy CLI Loader for upload of .hex files on Mac OS X * Use Teensy CLI Loader for upload of .hex files on Mac OS X

View File

@ -47,11 +47,19 @@ There are 3 predefined targets for building:
* ``PLATFORMIO_CLEAN`` - clean compiled objects and etc. * ``PLATFORMIO_CLEAN`` - clean compiled objects and etc.
.. warning:: .. warning::
CLion is still in the development stage, so some of the features (like, PlatformIO generates empty project by default and **code auto-completion
auto-complete) probably will not work with PlatformIO. See will not work!** To enable auto-completion please choose one of:
`CLion issue #CPP-3977 <https://youtrack.jetbrains.com/issue/CPP-3977>`_.
Active discussion located in * Add source files ``*.c, *.cpp, etc`` to ``src`` directory and re-initialize
project with command above
* Manually correct ``add_executable`` command in ``CMakeLists.txt`` file
(will be created in project directory after initialization).
``*.ino`` file isn't acceptable for ``add_executable`` command. You should
convert it manually to ``*.cpp``. See `project example <https://github.com/platformio/platformio/tree/develop/examples/ide/clion>`_.
More info `CLion issue #CPP-3977 <https://youtrack.jetbrains.com/issue/CPP-3977>`_.
Active discussion is located in
`PlatformIO issue #132 <https://github.com/platformio/platformio/issues/132>`_. `PlatformIO issue #132 <https://github.com/platformio/platformio/issues/132>`_.
Screenshot Screenshot

View File

@ -28,7 +28,7 @@ Quickstart
The next files/directories will be created in *** The next files/directories will be created in ***
platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - Put your source code here src - Put your source files here
lib - Put here project specific (private) libraries lib - Put here project specific (private) libraries
Do you want to continue? [y/N]: y Do you want to continue? [y/N]: y
Project has been successfully initialized! Project has been successfully initialized!
@ -37,7 +37,7 @@ Quickstart
`platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board `platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board
`platformio run --target clean` - clean project (remove compiled files) `platformio run --target clean` - clean project (remove compiled files)
Put your source code ``*.h, *.c, *.cpp or *.ino`` files to ``src`` directory. Put your source files ``*.h, *.c, *.cpp or *.ino`` to ``src`` directory.
4. Process the project's environments. 4. Process the project's environments.

View File

@ -22,7 +22,7 @@ Initialize new PlatformIO based project.
This command will create: This command will create:
* :ref:`projectconf` * :ref:`projectconf`
* ``src`` - a source directory. Put your source code here * ``src`` - a source directory. Put your source files here
* ``lib`` - a directory for the project specific (private) libraries. * ``lib`` - a directory for the project specific (private) libraries.
PlatformIO will compile them to static libraries and link to executable file PlatformIO will compile them to static libraries and link to executable file
@ -94,7 +94,7 @@ Examples
The next files/directories will be created in *** The next files/directories will be created in ***
platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - Put your source code here src - Put your source files here
lib - Put here project specific (private) libraries lib - Put here project specific (private) libraries
Do you want to continue? [y/N]: y Do you want to continue? [y/N]: y
Project has been successfully initialized! Project has been successfully initialized!
@ -112,7 +112,7 @@ Examples
The next files/directories will be created in *** The next files/directories will be created in ***
platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - Put your source code here src - Put your source files here
lib - Put here project specific (private) libraries lib - Put here project specific (private) libraries
Do you want to continue? [y/N]: y Do you want to continue? [y/N]: y
Project has been successfully initialized! Project has been successfully initialized!
@ -136,7 +136,7 @@ Examples
The next files/directories will be created in *** The next files/directories will be created in ***
platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-| platformio.ini - Project Configuration File. |-> PLEASE EDIT ME <-|
src - Put your source code here src - Put your source files here
lib - Put here project specific (private) libraries lib - Put here project specific (private) libraries
Do you want to continue? [y/N]: y Do you want to continue? [y/N]: y
Project has been successfully initialized! Project has been successfully initialized!

View File

@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4"> <module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$" />
<sourceFolder url="file://$MODULE_DIR$/CMakeLists.txt" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>

View File

@ -2,13 +2,13 @@
<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="PlatformIO" targetName="DEBUG" /> <config projectName="clion" targetName="PLATFORMIO_CLEAN" />
<config projectName="PlatformIO" targetName="PLATFORMIO_RUN" /> <config projectName="clion" targetName="PLATFORMIO_RUN" />
<config projectName="PlatformIO" targetName="PlatformIO" /> <config projectName="clion" targetName="PLATFORMIO" />
<config projectName="PlatformIO" targetName="PLATFORMIO_UPLOAD" /> <config projectName="clion" targetName="clion" />
<config projectName="PlatformIO" targetName="PLATFORMIO_CLEAN" /> <config projectName="clion" targetName="DEBUG" />
<config projectName="PlatformIO" targetName="PLATFORMIO_BUILD" /> <config projectName="clion" targetName="PLATFORMIO_BUILD" />
<config projectName="PlatformIO" targetName="PLATFORMIO" /> <config projectName="clion" targetName="PLATFORMIO_UPLOAD" />
</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">
@ -33,25 +33,25 @@
</component> </component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" /> <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager"> <component name="FavoritesManager">
<favorites_list name="PlatformIO" /> <favorites_list name="clion" />
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf> <leaf>
<file leaf-file-name="CMakeLists.txt" pinned="false" current-in-tab="true"> <file leaf-file-name="CMakeLists.txt" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/CMakeLists.txt"> <entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.45302013"> <state vertical-scroll-proportion="0.15758981">
<caret line="18" column="20" selection-start-line="18" selection-start-column="20" selection-end-line="18" selection-end-column="20" /> <caret line="8" column="49" selection-start-line="8" selection-start-column="49" selection-end-line="8" selection-end-column="49" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="blink.cpp" pinned="false" current-in-tab="false"> <file leaf-file-name="src/blink.cpp" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/blink.cpp"> <entry file="file://$PROJECT_DIR/$src/blink.cpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0"> <state vertical-scroll-proportion="0.0">
<caret line="0" column="13" selection-start-line="0" selection-start-column="13" selection-end-line="0" selection-end-column="13" /> <caret line="24" column="4" selection-start-line="24" selection-start-column="4" selection-end-line="24" selection-end-column="4" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -67,8 +67,8 @@
<order /> <order />
</component> </component>
<component name="ProjectFrameBounds"> <component name="ProjectFrameBounds">
<option name="x" value="162" /> <option name="x" value="252" />
<option name="y" value="23" /> <option name="y" value="21" />
<option name="width" value="1400" /> <option name="width" value="1400" />
<option name="height" value="1000" /> <option name="height" value="1000" />
</component> </component>
@ -116,13 +116,13 @@
<PATH> <PATH>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="clion" /> <option name="myItemId" value="clion" />
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$MyProjectTreeStructure$1" /> <option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
</PATH_ELEMENT> </PATH_ELEMENT>
</PATH> </PATH>
<PATH> <PATH>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="clion" /> <option name="myItemId" value="clion" />
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$MyProjectTreeStructure$1" /> <option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
</PATH_ELEMENT> </PATH_ELEMENT>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="clion" /> <option name="myItemId" value="clion" />
@ -132,7 +132,7 @@
<PATH> <PATH>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="clion" /> <option name="myItemId" value="clion" />
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$MyProjectTreeStructure$1" /> <option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
</PATH_ELEMENT> </PATH_ELEMENT>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="clion" /> <option name="myItemId" value="clion" />
@ -155,8 +155,8 @@
<property name="restartRequiresConfirmation" value="true" /> <property name="restartRequiresConfirmation" value="true" />
<property name="FullScreen" value="false" /> <property name="FullScreen" value="false" />
</component> </component>
<component name="RunManager" selected="Application.PLATFORMIO_CLEAN"> <component name="RunManager" selected="Application.PLATFORMIO_BUILD">
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="PlatformIO" TARGET_NAME="PlatformIO" CONFIG_NAME="Debug"> <configuration default="true" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="clion" CONFIG_NAME="Debug">
<envs /> <envs />
<method /> <method />
</configuration> </configuration>
@ -173,15 +173,15 @@
<envs /> <envs />
<method /> <method />
</configuration> </configuration>
<configuration default="false" name="PLATFORMIO_BUILD" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="PlatformIO" TARGET_NAME="PLATFORMIO_BUILD" CONFIG_NAME="Debug"> <configuration default="false" name="PLATFORMIO_BUILD" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="PLATFORMIO_BUILD" CONFIG_NAME="Debug">
<envs /> <envs />
<method /> <method />
</configuration> </configuration>
<configuration default="false" name="PLATFORMIO_CLEAN" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="PlatformIO" TARGET_NAME="PLATFORMIO_CLEAN" CONFIG_NAME="Debug"> <configuration default="false" name="PLATFORMIO_CLEAN" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="PLATFORMIO_CLEAN" CONFIG_NAME="Debug">
<envs /> <envs />
<method /> <method />
</configuration> </configuration>
<configuration default="false" name="PLATFORMIO_UPLOAD" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="PlatformIO" TARGET_NAME="PLATFORMIO_UPLOAD" CONFIG_NAME="Debug"> <configuration default="false" name="PLATFORMIO_UPLOAD" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="PLATFORMIO_UPLOAD" CONFIG_NAME="Debug">
<envs /> <envs />
<method /> <method />
</configuration> </configuration>
@ -206,27 +206,27 @@
<servers /> <servers />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="162" y="23" width="1400" height="1000" extended-state="0" /> <frame x="252" y="21" width="1400" height="1000" extended-state="0" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32975295" sideWeight="0.53684974" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.4631503" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.4631503" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32996634" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32996634" sideWeight="0.53684974" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout> </layout>
</component> </component>
<component name="Vcs.Log.UiProperties"> <component name="Vcs.Log.UiProperties">
@ -240,35 +240,12 @@
<component name="VcsContentAnnotationSettings"> <component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" /> <option name="myLimit" value="2678400000" />
</component> </component>
<component name="VcsManagerConfiguration">
<ignored-roots>
<path value="$PROJECT_DIR$/../../.." />
</ignored-roots>
</component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
<option name="time" value="4" /> <option name="time" value="4" />
</breakpoint-manager> </breakpoint-manager>
<watches-manager /> <watches-manager />
</component> </component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/blink.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="13" selection-start-line="0" selection-start-column="13" selection-end-line="0" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.45302013">
<caret line="18" column="20" selection-start-line="18" selection-start-column="20" selection-end-line="18" selection-end-column="20" />
<folding />
</state>
</provider>
</entry>
</component>
<component name="masterDetails"> <component name="masterDetails">
<states> <states>
<state key="ScopeChooserConfigurable.UI"> <state key="ScopeChooserConfigurable.UI">

View File

@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.2) cmake_minimum_required(VERSION 3.2)
project(PlatformIO) project(clion)
set(PLATFORMIO_CMD platformio) set(ENV{PATH} "/Volumes/SOFT/Projects/GitHub/platformio/origin/.tox/develop/bin:/usr/local/opt/pyenv/shims:/Users/ikravets/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin")
set(PLATFORMIO_CMD "/Volumes/SOFT/Projects/GitHub/platformio/origin/.tox/develop/bin/platformio")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduinoavr/variants/standard") include_directories("$ENV{HOME}/.platformio/packages/framework-arduinoavr/variants/standard")
include_directories("$ENV{HOME}/.platformio/packages/framework-arduinoavr/cores/arduino") include_directories("$ENV{HOME}/.platformio/packages/framework-arduinoavr/cores/arduino")
@ -14,7 +15,7 @@ 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=10605)
add_definitions(-DPLATFORMIO=020300) add_definitions(-DPLATFORMIO=020304)
add_definitions(-D__AVR_ATmega328P__) add_definitions(-D__AVR_ATmega328P__)
add_custom_target( add_custom_target(
@ -33,4 +34,6 @@ add_custom_target(
PLATFORMIO_CLEAN ALL PLATFORMIO_CLEAN ALL
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
add_executable(clion src/blink.cpp)

View File

@ -1,7 +1,7 @@
# Copyright (C) Ivan Kravets <me@ikravets.com> # Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details. # See LICENSE for details.
VERSION = (2, 3, "4.dev1") VERSION = (2, 3, "4.dev2")
__version__ = ".".join([str(s) for s in VERSION]) __version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio" __title__ = "platformio"

View File

@ -65,7 +65,7 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913
click.style(project_dir, fg="cyan")) click.style(project_dir, fg="cyan"))
click.echo("%s - Project Configuration File. |-> PLEASE EDIT ME <-|" % click.echo("%s - Project Configuration File. |-> PLEASE EDIT ME <-|" %
click.style("platformio.ini", fg="cyan")) click.style("platformio.ini", fg="cyan"))
click.echo("%s - Put your source code here" % click.echo("%s - Put your source files here" %
click.style("src", fg="cyan")) click.style("src", fg="cyan"))
click.echo("%s - Put here project specific (private) libraries" % click.echo("%s - Put here project specific (private) libraries" %
click.style("lib", fg="cyan")) click.style("lib", fg="cyan"))

View File

@ -7,6 +7,7 @@ import re
from os.path import abspath, basename, expanduser, isdir, join, relpath from os.path import abspath, basename, expanduser, isdir, join, relpath
import bottle import bottle
import click
from platformio import util from platformio import util
@ -72,7 +73,7 @@ class ProjectGenerator(object):
def get_project_name(self): def get_project_name(self):
return basename(self.project_dir) return basename(self.project_dir)
def get_srcfiles(self): def get_src_files(self):
result = [] result = []
with util.cd(self.project_dir): with util.cd(self.project_dir):
for root, _, files in os.walk(util.get_projectsrc_dir()): for root, _, files in os.walk(util.get_projectsrc_dir()):
@ -80,6 +81,14 @@ class ProjectGenerator(object):
result.append(relpath(join(root, f))) result.append(relpath(join(root, f)))
return result return result
@staticmethod
def get_main_src_file(src_files):
for f in src_files:
for ext in ("c", "cpp"):
if f.endswith(".%s" % ext):
return f
return None
def get_tpls(self): def get_tpls(self):
tpls = [] tpls = []
tpls_dir = join(util.get_source_dir(), "ide", "tpls", self.ide) tpls_dir = join(util.get_source_dir(), "ide", "tpls", self.ide)
@ -112,11 +121,23 @@ class ProjectGenerator(object):
return bottle.template(content, **self._tplvars) return bottle.template(content, **self._tplvars)
def _gather_tplvars(self): def _gather_tplvars(self):
src_files = self.get_src_files()
main_src_file = self.get_main_src_file(src_files)
if not main_src_file and self.ide == "clion":
click.secho(
"Warning! Can not find main source file (*.c, *.cpp). So, "
"code auto-completion is disabled. Please add source files "
"to `src` directory and re-initialize project or edit "
"`CMakeLists.txt` file manually (`add_executable` command).",
fg="yellow")
self._tplvars.update(self.get_project_env()) self._tplvars.update(self.get_project_env())
self._tplvars.update(self.get_project_build_data()) self._tplvars.update(self.get_project_build_data())
self._tplvars.update({ self._tplvars.update({
"project_name": self.get_project_name(), "project_name": self.get_project_name(),
"srcfiles": self.get_srcfiles(), "src_files": src_files,
"main_src_file": main_src_file,
"user_home_dir": abspath(expanduser("~")), "user_home_dir": abspath(expanduser("~")),
"project_dir": self.project_dir, "project_dir": self.project_dir,
"systype": util.get_systype(), "systype": util.get_systype(),

View File

@ -47,7 +47,7 @@
</provider> </provider>
</entry> </entry>
</file> </file>
% for file in srcfiles: % for file in src_files:
<file leaf-file-name="{{file}}" pinned="false" current-in-tab="false"> <file leaf-file-name="{{file}}" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR/${{file}}"> <entry file="file://$PROJECT_DIR/${{file}}">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">

View File

@ -8,7 +8,7 @@ set(PLATFORMIO_CMD "{{platformio_path}}")
% if include.startswith(user_home_dir): % if include.startswith(user_home_dir):
include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}") include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
% else: % else:
include_directories("{{include}}") include_directories("{{include.replace("\\", "/")}}")
% end % end
% end % end
@ -32,4 +32,14 @@ add_custom_target(
PLATFORMIO_CLEAN ALL PLATFORMIO_CLEAN ALL
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
% if main_src_file:
add_executable({{project_name}} {{main_src_file}})
% else:
#
# To enable code auto-completion, please specify path
# to main source file (*.c, *.cpp) and uncomment line below
#
# add_executable({{project_name}} src/main_change_me.cpp)
% end

View File

@ -21,6 +21,6 @@ OTHER_FILES += \
platformio.ini platformio.ini
SOURCES += \ SOURCES += \
% for file in srcfiles: % for file in src_files:
{{file}} {{file}}
% end % end

View File

@ -13,7 +13,7 @@
<ItemGroup> <ItemGroup>
<None Include="platformio.ini" /> <None Include="platformio.ini" />
</ItemGroup> </ItemGroup>
% for file in srcfiles: % for file in src_files:
<ItemGroup> <ItemGroup>
% if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]): % if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]):
<ClInclude Include="{{file}}"> <ClInclude Include="{{file}}">

View File

@ -58,7 +58,7 @@
<ItemGroup> <ItemGroup>
<None Include="platformio.ini" /> <None Include="platformio.ini" />
</ItemGroup> </ItemGroup>
% for file in srcfiles: % for file in src_files:
<ItemGroup> <ItemGroup>
% if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]): % if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]):
<ClInclude Include="{{file}}"> <ClInclude Include="{{file}}">