platformio-core icon indicating copy to clipboard operation
platformio-core copied to clipboard

How to configure CLion Project

Open bkuberek opened this issue 11 years ago • 18 comments

Apologies if this is the wrong place to ask this question but I am trying get my current platformio project working on CLion.

I have a working platformio project that is getting bigger and difficult to manage and I was hoping to use CLion IDE. Any help is appreciated.

bkuberek avatar Mar 22 '15 19:03 bkuberek

You can integrate PlatformIO into any IDE. Which type of problem do you have? From CLion site:

CLion supports the well-known CMake build system

You can replace built-in cmake system with platformio run command. Could I ask you to write an article about it and I will place it to main PlatformIO documentation?

Thanks in advance!

ivankravets avatar Mar 22 '15 20:03 ivankravets

Here is interesting example how to replace built-in Eclipse builder with PlatformIO: Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO

ivankravets avatar Mar 22 '15 20:03 ivankravets

I'd be interested in any results on this as well, I use IntelliJ regularly and have considered trying out CLion. If it supports a any standard makefile system you could always put together a config that mapped to platformio commands, if CLion doesn't let you do that directly within its preferences.

aphelps avatar Mar 22 '15 20:03 aphelps

Friends,

Who can help PlatformIO with short manual with pictures how to configure CLion and PlatformIO? It can be any format: PDF/DOC/RTF/etc., then we will convert it to RST and put to core documentation with preserving author's rights.

We could do it, but you can see how much issues we have opened. In this situation I want to concentrate our forces to the new features for PlatformIO.

ivankravets avatar Mar 22 '15 20:03 ivankravets

This is the first time I do something with C/C++ and I am still wrapping my head around basic concepts. I would gladly contribute this write up if I could figure it out on my own. I hope someone has already gone through the trouble and could share their setup.

For now I was able to get IntelliJ Ultimate with C/C++ plugin to give me basic editing help. I had to add the following paths to the C++ project settings:

# Additional include directories
/Users/bkuberek/[...]/RevoBotController/lib/Ultrasonic;
/Users/bkuberek/[...]/RevoBotController/lib/nanopb

# Additional system include directories
/Users/bkuberek/[...]/RevoBotController/.pioenvs/arduino_mega2560/FrameworkArduino;
/Users/bkuberek/[...]/RevoBotController/.pioenvs/arduino_mega2560/FrameworkArduinoVariant;
/Users/bkuberek/.platformio/packages/framework-arduinoavr/cores/arduino;
/Users/bkuberek/.platformio/packages/toolchain-atmelavr/avr/include

[line breaks added for clarity]

bkuberek avatar Mar 22 '15 20:03 bkuberek

@valeros has tried to configure CLion with PlatformIO, but didn't received any results. They don't allow to redefine own builder. I've just posted the comments to their issues tracker:

https://youtrack.jetbrains.com/issue/CPP-871#comment=27-960431

Here is explanation by CLion owners: http://blog.jetbrains.com/clion/2014/09/cmake-vs-the-others-round-1/

ivankravets avatar Mar 27 '15 14:03 ivankravets

thanks for the update

bkuberek avatar Mar 28 '15 19:03 bkuberek

Just tried this feature out, seems like it generates a solid CMakeLists.txt but trying to build from inside clion pops a dialog asking for an executable. It seems like I can specify any old executable (i picked the platformio file). The build will then be allowed to run, and it definitely uploads the code to my board, but it then replaces the output on the console with the standard "platformio" help message. Also, when importing the project that platformio generates, every file except CMakeLists.txt is "grayed out" in the project pane, as in CLion doesn't think it's part of the project. It also doesn't seem to be aware of the standard arduino library for purposes of auto-complete. Thoughts?

jimbojsb avatar Jul 16 '15 03:07 jimbojsb

@jimbojsb which PlatformIO version do you use? I've just re-tested it under Mac. See my results:

PlatformIO integration with CLion IDE

I used this example: https://github.com/platformio/platformio/tree/develop/examples/wiring-blink and this command:

platformio init --project-dir examples/wiring-blink --ide clion -b uno

As for "auto-complete" - see explanation in Warning block: http://docs.platformio.org/en/latest/ide/clion.html

ivankravets avatar Jul 16 '15 10:07 ivankravets

I got auto complete working by setting include_directories as absolute paths and adding a line like

add_executable(Test src/test.cpp)

voneiden avatar Oct 10 '15 17:10 voneiden

Dear friends,

Please re-test full support of CLion IDE in the latest development version http://docs.platformio.org/en/latest/installation.html#development-version

Waiting for your feedbacks.

ivankravets avatar Oct 13 '15 13:10 ivankravets

@voneiden thanks a lot for the hint! :+1:

ivankravets avatar Oct 13 '15 13:10 ivankravets

@ivankravets Nice, no problem.

voneiden avatar Oct 13 '15 13:10 voneiden

I have followed all the documentations, and this is what I get:

image

averri avatar Nov 09 '16 19:11 averri

I am having the problem that Clion doesn't resolve my own library in the lib folder, platformio created. platformio run works quite well without any error but I cannot use the code completion from the IDE because the editor displays me the error: Cannot find Foo.h which I include in my mainProgram.c which is in the src folder.

Can someone help me, please? Thanks in advance.

earliestearl avatar Nov 11 '16 12:11 earliestearl

@earliestearl see docs http://docs.platformio.org/en/stable/ide/clion.html

The libraries which are added, installed or used in the project after generating process wont be reflected in IDE. To fix it please run PLATFORMIO_REBUILD_PROJECT_INDEX target.

ivankravets avatar Nov 11 '16 13:11 ivankravets

@ivankravets Sorry, I should have read the instructions more carefully. But thank you so much for your fast and good reply. Now, everything's working. Thanks for your great work, PlatformIO!

earliestearl avatar Nov 11 '16 13:11 earliestearl

@earliestearl Would be thankful for a star ⭐️ https://github.com/platformio/platformio/stargazers and don't forget to follow us on https://twitter.com/PlatformIO_Org

ivankravets avatar Nov 11 '16 13:11 ivankravets