forked from platformio/platformio-core
Full support of CLion IDE including code auto-completion // Resolve #132
This commit is contained in:
@ -7,6 +7,9 @@ PlatformIO 2.0
|
||||
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
|
||||
(`pull #302 <https://github.com/platformio/platformio/pull/302>`_)
|
||||
* Use Teensy CLI Loader for upload of .hex files on Mac OS X
|
||||
|
@ -47,11 +47,19 @@ There are 3 predefined targets for building:
|
||||
* ``PLATFORMIO_CLEAN`` - clean compiled objects and etc.
|
||||
|
||||
.. warning::
|
||||
CLion is still in the development stage, so some of the features (like,
|
||||
auto-complete) probably will not work with PlatformIO. See
|
||||
`CLion issue #CPP-3977 <https://youtrack.jetbrains.com/issue/CPP-3977>`_.
|
||||
PlatformIO generates empty project by default and **code auto-completion
|
||||
will not work!** To enable auto-completion please choose one of:
|
||||
|
||||
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>`_.
|
||||
|
||||
Screenshot
|
||||
|
@ -28,7 +28,7 @@ Quickstart
|
||||
|
||||
The next files/directories will be created in ***
|
||||
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
|
||||
Do you want to continue? [y/N]: y
|
||||
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 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.
|
||||
|
||||
|
@ -22,7 +22,7 @@ Initialize new PlatformIO based project.
|
||||
This command will create:
|
||||
|
||||
* :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.
|
||||
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 ***
|
||||
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
|
||||
Do you want to continue? [y/N]: y
|
||||
Project has been successfully initialized!
|
||||
@ -112,7 +112,7 @@ Examples
|
||||
|
||||
The next files/directories will be created in ***
|
||||
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
|
||||
Do you want to continue? [y/N]: y
|
||||
Project has been successfully initialized!
|
||||
@ -136,7 +136,7 @@ Examples
|
||||
|
||||
The next files/directories will be created in ***
|
||||
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
|
||||
Do you want to continue? [y/N]: y
|
||||
Project has been successfully initialized!
|
||||
|
4
examples/ide/clion/.idea/clion.iml
generated
4
examples/ide/clion/.idea/clion.iml
generated
@ -1,9 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="CPP_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/CMakeLists.txt" isTestSource="false" />
|
||||
</content>
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
|
93
examples/ide/clion/.idea/workspace.xml
generated
93
examples/ide/clion/.idea/workspace.xml
generated
@ -2,13 +2,13 @@
|
||||
<project version="4">
|
||||
<component name="CMakeRunConfigurationManager" shouldGenerate="true" assignedExecutableTargets="true" buildAllGenerated="true">
|
||||
<generated>
|
||||
<config projectName="PlatformIO" targetName="DEBUG" />
|
||||
<config projectName="PlatformIO" targetName="PLATFORMIO_RUN" />
|
||||
<config projectName="PlatformIO" targetName="PlatformIO" />
|
||||
<config projectName="PlatformIO" targetName="PLATFORMIO_UPLOAD" />
|
||||
<config projectName="PlatformIO" targetName="PLATFORMIO_CLEAN" />
|
||||
<config projectName="PlatformIO" targetName="PLATFORMIO_BUILD" />
|
||||
<config projectName="PlatformIO" targetName="PLATFORMIO" />
|
||||
<config projectName="clion" targetName="PLATFORMIO_CLEAN" />
|
||||
<config projectName="clion" targetName="PLATFORMIO_RUN" />
|
||||
<config projectName="clion" targetName="PLATFORMIO" />
|
||||
<config projectName="clion" targetName="clion" />
|
||||
<config projectName="clion" targetName="DEBUG" />
|
||||
<config projectName="clion" targetName="PLATFORMIO_BUILD" />
|
||||
<config projectName="clion" targetName="PLATFORMIO_UPLOAD" />
|
||||
</generated>
|
||||
</component>
|
||||
<component name="CMakeSettings" AUTO_RELOAD="true" GENERATION_PASS_SYSTEM_ENVIRONMENT="true">
|
||||
@ -33,25 +33,25 @@
|
||||
</component>
|
||||
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
|
||||
<component name="FavoritesManager">
|
||||
<favorites_list name="PlatformIO" />
|
||||
<favorites_list name="clion" />
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<file leaf-file-name="CMakeLists.txt" pinned="false" current-in-tab="true">
|
||||
<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" />
|
||||
<state vertical-scroll-proportion="0.15758981">
|
||||
<caret line="8" column="49" selection-start-line="8" selection-start-column="49" selection-end-line="8" selection-end-column="49" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="blink.cpp" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/blink.cpp">
|
||||
<file leaf-file-name="src/blink.cpp" pinned="false" current-in-tab="false">
|
||||
<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" />
|
||||
<caret line="24" column="4" selection-start-line="24" selection-start-column="4" selection-end-line="24" selection-end-column="4" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@ -67,8 +67,8 @@
|
||||
<order />
|
||||
</component>
|
||||
<component name="ProjectFrameBounds">
|
||||
<option name="x" value="162" />
|
||||
<option name="y" value="23" />
|
||||
<option name="x" value="252" />
|
||||
<option name="y" value="21" />
|
||||
<option name="width" value="1400" />
|
||||
<option name="height" value="1000" />
|
||||
</component>
|
||||
@ -116,13 +116,13 @@
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<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>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<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>
|
||||
<option name="myItemId" value="clion" />
|
||||
@ -132,7 +132,7 @@
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<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>
|
||||
<option name="myItemId" value="clion" />
|
||||
@ -155,8 +155,8 @@
|
||||
<property name="restartRequiresConfirmation" value="true" />
|
||||
<property name="FullScreen" value="false" />
|
||||
</component>
|
||||
<component name="RunManager" selected="Application.PLATFORMIO_CLEAN">
|
||||
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="PlatformIO" TARGET_NAME="PlatformIO" CONFIG_NAME="Debug">
|
||||
<component name="RunManager" selected="Application.PLATFORMIO_BUILD">
|
||||
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="clion" TARGET_NAME="clion" CONFIG_NAME="Debug">
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
@ -173,15 +173,15 @@
|
||||
<envs />
|
||||
<method />
|
||||
</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 />
|
||||
<method />
|
||||
</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 />
|
||||
<method />
|
||||
</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 />
|
||||
<method />
|
||||
</configuration>
|
||||
@ -206,27 +206,27 @@
|
||||
<servers />
|
||||
</component>
|
||||
<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" />
|
||||
<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="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="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="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="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="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="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="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="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="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="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="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>
|
||||
</component>
|
||||
<component name="Vcs.Log.UiProperties">
|
||||
@ -240,35 +240,12 @@
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<ignored-roots>
|
||||
<path value="$PROJECT_DIR$/../../.." />
|
||||
</ignored-roots>
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<option name="time" value="4" />
|
||||
</breakpoint-manager>
|
||||
<watches-manager />
|
||||
</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">
|
||||
<states>
|
||||
<state key="ScopeChooserConfigurable.UI">
|
||||
|
@ -1,7 +1,8 @@
|
||||
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/cores/arduino")
|
||||
@ -14,7 +15,7 @@ add_definitions(-DF_CPU=16000000L)
|
||||
add_definitions(-DARDUINO_ARCH_AVR)
|
||||
add_definitions(-DARDUINO_AVR_UNO)
|
||||
add_definitions(-DARDUINO=10605)
|
||||
add_definitions(-DPLATFORMIO=020300)
|
||||
add_definitions(-DPLATFORMIO=020304)
|
||||
add_definitions(-D__AVR_ATmega328P__)
|
||||
|
||||
add_custom_target(
|
||||
@ -34,3 +35,5 @@ add_custom_target(
|
||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_executable(clion src/blink.cpp)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||
# See LICENSE for details.
|
||||
|
||||
VERSION = (2, 3, "4.dev1")
|
||||
VERSION = (2, 3, "4.dev2")
|
||||
__version__ = ".".join([str(s) for s in VERSION])
|
||||
|
||||
__title__ = "platformio"
|
||||
|
@ -65,7 +65,7 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913
|
||||
click.style(project_dir, fg="cyan"))
|
||||
click.echo("%s - Project Configuration File. |-> PLEASE EDIT ME <-|" %
|
||||
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.echo("%s - Put here project specific (private) libraries" %
|
||||
click.style("lib", fg="cyan"))
|
||||
|
@ -7,6 +7,7 @@ import re
|
||||
from os.path import abspath, basename, expanduser, isdir, join, relpath
|
||||
|
||||
import bottle
|
||||
import click
|
||||
|
||||
from platformio import util
|
||||
|
||||
@ -72,7 +73,7 @@ class ProjectGenerator(object):
|
||||
def get_project_name(self):
|
||||
return basename(self.project_dir)
|
||||
|
||||
def get_srcfiles(self):
|
||||
def get_src_files(self):
|
||||
result = []
|
||||
with util.cd(self.project_dir):
|
||||
for root, _, files in os.walk(util.get_projectsrc_dir()):
|
||||
@ -80,6 +81,14 @@ class ProjectGenerator(object):
|
||||
result.append(relpath(join(root, f)))
|
||||
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):
|
||||
tpls = []
|
||||
tpls_dir = join(util.get_source_dir(), "ide", "tpls", self.ide)
|
||||
@ -112,11 +121,23 @@ class ProjectGenerator(object):
|
||||
return bottle.template(content, **self._tplvars)
|
||||
|
||||
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_build_data())
|
||||
self._tplvars.update({
|
||||
"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("~")),
|
||||
"project_dir": self.project_dir,
|
||||
"systype": util.get_systype(),
|
||||
|
@ -47,7 +47,7 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
% for file in srcfiles:
|
||||
% for file in src_files:
|
||||
<file leaf-file-name="{{file}}" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR/${{file}}">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
|
@ -8,7 +8,7 @@ set(PLATFORMIO_CMD "{{platformio_path}}")
|
||||
% if include.startswith(user_home_dir):
|
||||
include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
|
||||
% else:
|
||||
include_directories("{{include}}")
|
||||
include_directories("{{include.replace("\\", "/")}}")
|
||||
% end
|
||||
% end
|
||||
|
||||
@ -33,3 +33,13 @@ add_custom_target(
|
||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean
|
||||
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
|
||||
|
@ -21,6 +21,6 @@ OTHER_FILES += \
|
||||
platformio.ini
|
||||
|
||||
SOURCES += \
|
||||
% for file in srcfiles:
|
||||
% for file in src_files:
|
||||
{{file}}
|
||||
% end
|
||||
|
@ -13,7 +13,7 @@
|
||||
<ItemGroup>
|
||||
<None Include="platformio.ini" />
|
||||
</ItemGroup>
|
||||
% for file in srcfiles:
|
||||
% for file in src_files:
|
||||
<ItemGroup>
|
||||
% if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]):
|
||||
<ClInclude Include="{{file}}">
|
||||
|
@ -58,7 +58,7 @@
|
||||
<ItemGroup>
|
||||
<None Include="platformio.ini" />
|
||||
</ItemGroup>
|
||||
% for file in srcfiles:
|
||||
% for file in src_files:
|
||||
<ItemGroup>
|
||||
% if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]):
|
||||
<ClInclude Include="{{file}}">
|
||||
|
Reference in New Issue
Block a user