CMake / CLion

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

CMake / CLion

Postby permal » Sat Jun 24, 2017 6:34 pm

Hi,

Are there any plans to provide a guide on how to setup an ESP32/IDF build using CMake (and thus enabling use of all the build generators it supports) just as is provided for Eclipse? So far my attempts to get xtensa-gcc to work with CMake fails at the stage where CMake tries to compile a test program to determine the capabilities of the compiler.

I've setup my CLion to build using the regular CLI/make and a CMakeLists.txt to get code completion working. While this is a good step forward, it'd be even better to actually utilize the power of CMake and eventually debug via GDB from within CLion.

Cheers.

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: CMake / CLion

Postby ESP_igrr » Sun Jun 25, 2017 12:04 pm

We don't have plans for CMake support, but we can help with compilation issues you are seeing. Can you attach compiler output and the test program which CMake is trying to compile?

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: CMake / CLion

Postby permal » Sun Jun 25, 2017 1:32 pm

I tried to get the source CMake tries to build, but it seems to delete it immediately after failing to compile.

Since I wrote the initial question I've also realized that it'll take a lot of more work to get it all up and running so I'm refocusing on learning ESP-IDF instead. After all, I have code completion working and it all compiles directly from CLion via make.

Beck-Sisyphus
Posts: 14
Joined: Sun Jan 03, 2016 12:15 am

Re: CMake / CLion

Postby Beck-Sisyphus » Thu Nov 02, 2017 2:41 pm

Following this thread for progress. It will be great if ESP32 works for CMake / CLion!

Currently manually add include_directories() in CMakeLists.txt for looking into code.

User avatar
Gfast2
Posts: 182
Joined: Fri Aug 11, 2017 1:52 am

Re: CMake / CLion

Postby Gfast2 » Fri Nov 03, 2017 11:39 am

Hi,

I've got the same wish. But going to walk through another way:
https://github.com/espressif/esp-idf/issues/921
This is still not Finished. Because the library will not be used shortly. But with the help from the AWESOME esp-idf Team, The library which use cmake to compile firstly get compiled beautifully.

Stay tune.

Su

hilmarv
Posts: 1
Joined: Sat Dec 30, 2017 11:26 am

Re: CMake / CLion

Postby hilmarv » Sat Dec 30, 2017 11:35 am

permal wrote:After all, I have code completion working and it all compiles directly from CLion via make.
Can you explain for a rookie how you achieved this? Haven't coded C for a while :)

Thanks in advance!

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: CMake / CLion

Postby permal » Sun Dec 31, 2017 7:35 am

I simply set up the CMakeLists.txt like any other project. Then I configured Clion to parse the output of an external tool that calls the correct make.

Since I asked the original question I’ve expanded my project to also include the ability to compile large parts on Linux, but since that is mostly only code you can still gain some info from my repo.

https://github.com/PerMalmberg/Smooth-test

william.ferguson.au
Posts: 107
Joined: Wed Jan 02, 2019 8:55 am

Re: CMake / CLion

Postby william.ferguson.au » Tue Apr 02, 2019 10:12 am

Does anyone have a clear walk through for setting up CLion to use with an esp-idf project.
I have burnt several days trying to get configured, but I suspect it's falling down somewhere in the tool chain setup.

William

ESP_cermak
Posts: 69
Joined: Thu Nov 01, 2018 8:32 am

Re: CMake / CLion

Postby ESP_cermak » Wed Apr 03, 2019 6:40 am

Hi,

Configuring CLion with CMake IDF build system is very simple, that is: no configuration needed ;) Just open an existing project, where your project CMakeLists.txt resides, possibly set your IDF_PATH and a generation path (to be in line with `idf.py` so you can conveniently run flash/monitor from IDE).
At least this is true for linux and mac, on windows might be a bit tricky, because you cannot simply configure which generator CMake uses when executed from CLion. The easiest way was to install visual studio (at least at the time I've tried), which would cause run CMake with VS's nmake generator and build correctly. Of course standard windows tools like cmake, python (+packages), mconf-idf (for native windows terminal, not MSYS) need to be installed per https://docs.espressif.com/projects/esp ... setup.html

william.ferguson.au
Posts: 107
Joined: Wed Jan 02, 2019 8:55 am

Re: CMake / CLion

Postby william.ferguson.au » Wed Apr 03, 2019 8:11 am

Yes, I should have mentioned I am using Windows.

Thanks for the link.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 91 guests