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

Platformio 4.3+ generates unusable CMake files in CLion

Open thorrak opened this issue 4 years ago • 9 comments

Under Platformio 4.2, when running platformio init --ide=clion I get a CMakelists.txt that starts with the following line and has numerous build targets, including ones for uploading a filesystem, rebuilding the project index, etc:

cmake_minimum_required(VERSION 3.2)

Under Platformio 4.3+, the cmake_minimum_version becomes <3.2 and the build targets are replaced with something unusable.

thorrak avatar Apr 25 '20 03:04 thorrak

Did you install PlatformIO for CLion plugin? See https://docs.platformio.org/en/latest/integration/ide/clion.html

ivankravets avatar Apr 25 '20 06:04 ivankravets

I did, but my (existing) project didn't get picked up, and the CLion plugin doesn't seem to support the same feature set that was previously supported.

thorrak avatar Apr 25 '20 11:04 thorrak

Could you remove all CLion files and folders from project and regenerate? Also, please remove CMake files.

ivankravets avatar Apr 25 '20 12:04 ivankravets

I've removed all files as requested, but the CMake files that were generated are still a far cry from what they were prior to Platformio 4.3.

My CMakeLists.txt files are as follows: CMakeLists under 4.2.1: CMakeLists.txt

CMakeLists under 4.3.1: CMakeLists 4.3.txt

I still am missing functionality like the ability to upload a SPIFFS filesystem for ESP32 devices, compile for different environments, or run the custom cmake commands I added. Additionally, functionality I don't use/want ("build" vs. "build production"?) is what seems to be added.

Is there any way under Platformio 4.3 to NOT use the plugin and revert to using the command line interface with the functionality that was available under 4.2?

thorrak avatar Apr 25 '20 17:04 thorrak

Hi @thorrak ! Could you please explain what you mean by "unusable"? Are there any errors?

Is there any way under Platformio 4.3 to NOT use the plugin and revert to using the command line interface with the functionality that was available under 4.2?

Probably the best way is to use PlatformIO v4.2 until the plugin has the required features.

valeros avatar Apr 25 '20 17:04 valeros

Hi @thorrak ! Could you please explain what you mean by "unusable"? Are there any errors?

Is there any way under Platformio 4.3 to NOT use the plugin and revert to using the command line interface with the functionality that was available under 4.2?

Probably the best way is to use PlatformIO v4.2 until the plugin has the required features.

What I mean by unusable is that after reinitializing the project in Platformio 4.3.1, the build options disappear completely:

Screen Shot 2020-04-25 at 1 53 43 PM

Is the plan going forward that the plugin is now required for CLion use?

thorrak avatar Apr 25 '20 17:04 thorrak

If I'm not mistaken you need to manually load build environments as decribed here at least for the first time.

Is the plan going forward that the plugin is now required for CLion use?

At the moment this plugin is the only way to use PlatformIO projects with CLion. As a hacky workaround, you can create a custom extra script and implement there a simplified version of our project generator with the previous CMake template.

valeros avatar Apr 25 '20 18:04 valeros

Hi There Thanks for your work. I installed CLion, VSCode and PIO, 2 days ago. I am a happy user of IntelliJ IDEs (PyCharm, Android Studio, PHPStorm) and I find that Arduino IDE is so bad... that I was writing my programs on EditPlus or Sublime then compile/upload with Arduino IDE... So the couple CLion-PIO is something great!

I wrote a tutorial in french today: https://baghli.blogspot.com/2020/05/clion-et-pateformio-au-lieu-darduino-ide.html to encourage Arduino/ESP community to use CLion-PIO

The main issues I had:

I Couldn't install the PIO utilities from CLion alone. I had to first install them with VSCode Same for the Platforms and tools (Espressif, AVR...), but I found that if I add to the path the PIO scripts, then CLion can found the PIO utility and install them like VSCode Debug is not working (tried on ESP32 for Arduino) Syntax highlighting of Arduino, Lib function and names (String, uint8_t, SoftwareSerial, U8g2,...) doesn't work, though the programs compile and upload well. It seems that CLion doesn't found them in its search path. I tried to add them to the CMakeLists, so far without success. For me, it is very important, since I want to clic on a function to go directly to its definition in the c:\Users\xxx.platformio\lib\yyyy So if you and CLion team can fix this ASAP, it would be great. Thanks

blotfi avatar May 01 '20 05:05 blotfi

more info here : https://community.platformio.org/t/syntax-highlighting-not-working-for-external-lib-of-plateformeio-on-clion-ide/13431

blotfi avatar May 02 '20 17:05 blotfi