forked from platformio/platformio-core
Improve project generator for CLion IDE
This commit is contained in:
@@ -7,6 +7,7 @@ PlatformIO 2.0
|
||||
2.11.1 (2016-??-??)
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Improved project generator for `CLion IDE <http://docs.platformio.org/en/latest/ide/clion.html>`__
|
||||
* Auto-remove project cache when PlatformIO is upgraded
|
||||
* Fixed missed ``--boot`` flag for the firmware uploader for ATSAM3X8E
|
||||
Cortex-M3 MCU based boards (Arduino Due, etc)
|
||||
|
@@ -43,10 +43,11 @@ command and generate project via :option:`platformio init --ide` command:
|
||||
|
||||
Then:
|
||||
|
||||
1. Import this project via ``Menu: File > Import Project``
|
||||
1. Place source files (``*.c, *.cpp, *.h, *.ino, etc.``) to ``src`` directory
|
||||
2. Import this project via ``Menu: File > Import Project``
|
||||
and specify root directory where is located :ref:`projectconf`
|
||||
2. Open source file from ``src`` directory (``*.c, *.cpp, *.ino, etc.``)
|
||||
3. Build project (*DO NOT RUN*): ``Menu: Run > Build``.
|
||||
3. Open source file from ``src`` directory
|
||||
4. Build project (*DO NOT RUN*): ``Menu: Run > Build``.
|
||||
|
||||
There are 6 predefined targets for building (*NOT FOR RUNNING*, see marks on
|
||||
the screenshot below):
|
||||
@@ -63,22 +64,6 @@ the screenshot below):
|
||||
after generating process wont be reflected in IDE. To fix it you
|
||||
need to reinitialize project using :ref:`cmd_init` (repeat it).
|
||||
|
||||
.. warning::
|
||||
PlatformIO generates empty project by default and **code auto-completion
|
||||
will not work!** To enable auto-completion please choose one of:
|
||||
|
||||
* 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-examples/tree/develop/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>`_.
|
||||
|
||||
Articles / Manuals
|
||||
------------------
|
||||
|
||||
|
@@ -132,22 +132,11 @@ class ProjectGenerator(object):
|
||||
return bottle.template(content, **self._tplvars)
|
||||
|
||||
def _gather_tplvars(self):
|
||||
src_files = self.get_src_files()
|
||||
|
||||
if (not any([f.endswith((".c", ".cpp")) for f in src_files]) 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(),
|
||||
"src_files": src_files,
|
||||
"src_files": self.get_src_files(),
|
||||
"user_home_dir": abspath(expanduser("~")),
|
||||
"project_dir": self.project_dir,
|
||||
"systype": util.get_systype(),
|
||||
|
@@ -43,18 +43,5 @@ add_custom_target(
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
% if src_files and any([f.endswith((".c", ".cpp")) for f in src_files]):
|
||||
add_executable({{project_name}}
|
||||
% for f in src_files:
|
||||
% if f.endswith((".c", ".cpp")):
|
||||
{{f.replace("\\", "/")}}
|
||||
% end
|
||||
% end
|
||||
)
|
||||
% 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
|
||||
aux_source_directory(src SRC_LIST)
|
||||
add_executable(${PROJECT_NAME} ${SRC_LIST})
|
||||
|
Reference in New Issue
Block a user