Preview release: CMake-based build system for ESP-IDF

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

Re: Preview release: CMake-based build system for ESP-IDF

Postby ESP_igrr » Sat Sep 29, 2018 1:32 pm

Hi, thanks for reporting. We have the fix for the crash itself in review now, due to some changes in component ordering between the build systems it only happens in CMake...

Oleg Endo
Posts: 18
Joined: Fri Sep 28, 2018 1:48 pm

Re: Preview release: CMake-based build system for ESP-IDF

Postby Oleg Endo » Mon Oct 01, 2018 1:59 am

Hi. Thanks for the confirmation. Approx. when can we expect the fix to be available in mainline?

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Preview release: CMake-based build system for ESP-IDF

Postby ESP_Angus » Fri Oct 05, 2018 12:23 am

Oleg Endo wrote:Hi. Thanks for the confirmation. Approx. when can we expect the fix to be available in mainline?
It's been a bit slow this week because of China's national holiday, but I'd expect the linker fix will be merged early next week.

Moderator's note, the ongoing discussion about cross-platform CMake has been moved here: https://esp32.com/viewtopic.php?f=13&t=7535&p=31759

Oleg Endo
Posts: 18
Joined: Fri Sep 28, 2018 1:48 pm

Re: Preview release: CMake-based build system for ESP-IDF

Postby Oleg Endo » Tue Oct 09, 2018 1:05 am

Hi,
I can confirm that the cmake build is now working with the latest ESP-IDF master.

Thanks everyone!

Cheers,
Oleg

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

Re: Preview release: CMake-based build system for ESP-IDF

Postby permal » Tue Oct 09, 2018 8:14 pm

Anyone successfully used the COMPONENTS variable to trim down the number of included components in a project, as per the docs?

Starting with the hello_world example (latest master as of today), changing the top-level CMakeLists.txt to this

Code: Select all

cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(COMPONENTS cxx)
project(hello-world)
results in this:
CMake Error at /home/permal/esp/esp-idf/components/partition_table/CMakeLists.txt:61 (add_dependencies):
Cannot add target-level dependencies to non-existent target "bootloader".

The add_dependencies works for top-level logical targets created by the
add_executable, add_library, or add_custom_target commands. If you want to
add file-level dependencies see the DEPENDS option of the add_custom_target
and add_custom_command commands.

CMake Error at /home/permal/esp/esp-idf/components/partition_table/CMakeLists.txt:62 (add_dependencies):
Cannot add target-level dependencies to non-existent target "app".

The add_dependencies works for top-level logical targets created by the
add_executable, add_library, or add_custom_target commands. If you want to
add file-level dependencies see the DEPENDS option of the add_custom_target
and add_custom_command commands.
Ok, so I add the bootloader component:

Code: Select all

set(COMPONENTS cxx bootloader)
but that still leaves me with this:
CMake Error at /home/permal/esp/esp-idf/components/partition_table/CMakeLists.txt:62 (add_dependencies):
Cannot add target-level dependencies to non-existent target "app".

The add_dependencies works for top-level logical targets created by the
add_executable, add_library, or add_custom_target commands. If you want to
add file-level dependencies see the DEPENDS option of the add_custom_target
and add_custom_command commands.
Am I using this wrong? It seems the minim one must include is this, anything less and it breaks.

Code: Select all

set(COMPONENTS bootloader esptool_py )
The reason I'm even trying to reduce the number of components is because of all the different target generated by CMake. In CLion, these are all listed in the project window and debug/run targets, and it gets quite long; this is only about half of them. Having to navigate them all is a bit of a pain since I have no actual interest in them other than as libraries. Even with the minimum set of components, the list is nearly as long as in the image. The poor hello_world gets lost among them all.
Screenshot from 2018-10-09 22-06-48.png
Screenshot from 2018-10-09 22-06-48.png (115.45 KiB) Viewed 7920 times

afranko
Posts: 3
Joined: Wed Aug 15, 2018 2:10 pm

Re: Preview release: CMake-based build system for ESP-IDF

Postby afranko » Fri Mar 08, 2019 11:00 am

permal wrote:
Tue Oct 09, 2018 8:14 pm
Anyone successfully used the COMPONENTS variable to trim down the number of included components in a project, as per the docs?

Starting with the hello_world example (latest master as of today), changing the top-level CMakeLists.txt to this

Code: Select all

cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(COMPONENTS cxx)
project(hello-world)
results in this:
CMake Error at /home/permal/esp/esp-idf/components/partition_table/CMakeLists.txt:61 (add_dependencies):
Cannot add target-level dependencies to non-existent target "bootloader".

The add_dependencies works for top-level logical targets created by the
add_executable, add_library, or add_custom_target commands. If you want to
add file-level dependencies see the DEPENDS option of the add_custom_target
and add_custom_command commands.

CMake Error at /home/permal/esp/esp-idf/components/partition_table/CMakeLists.txt:62 (add_dependencies):
Cannot add target-level dependencies to non-existent target "app".

The add_dependencies works for top-level logical targets created by the
add_executable, add_library, or add_custom_target commands. If you want to
add file-level dependencies see the DEPENDS option of the add_custom_target
and add_custom_command commands.
Ok, so I add the bootloader component:

Code: Select all

set(COMPONENTS cxx bootloader)
but that still leaves me with this:
CMake Error at /home/permal/esp/esp-idf/components/partition_table/CMakeLists.txt:62 (add_dependencies):
Cannot add target-level dependencies to non-existent target "app".

The add_dependencies works for top-level logical targets created by the
add_executable, add_library, or add_custom_target commands. If you want to
add file-level dependencies see the DEPENDS option of the add_custom_target
and add_custom_command commands.
Am I using this wrong? It seems the minim one must include is this, anything less and it breaks.

Code: Select all

set(COMPONENTS bootloader esptool_py )
The reason I'm even trying to reduce the number of components is because of all the different target generated by CMake. In CLion, these are all listed in the project window and debug/run targets, and it gets quite long; this is only about half of them. Having to navigate them all is a bit of a pain since I have no actual interest in them other than as libraries. Even with the minimum set of components, the list is nearly as long as in the image. The poor hello_world gets lost among them all.
Screenshot from 2018-10-09 22-06-48.png
Today, I tried to use that function and after a while I managed to build a binary with a minimal subset of IDF components. I've used this code snippet in my CMakeLists.txt file placed in the root folder in my project. Before compiling the project I deleted the sdkconfig file.

Code: Select all

set(COMPONENTS cxx app bootloader esptool_py main)
It really improved the overall build time, but not as much as I excepted. However, it's a good feature, especially if you often recompile the whole thing.

Who is online

Users browsing this forum: prodigysounds and 141 guests