Page 1 of 1

Limiting compilation of all libraries

Posted: Fri Oct 25, 2019 1:19 pm
by jcdmelo
Hi, everyone,

I am new to the ESP-IDF environment, and I noticed that when I compile a project from the "examples" directory, ALL libraries in the "components" directory are compiled, even though I am not making any references to most of them.

Another issue is that for every project, all compiled libraries are created in a "build" directory which holds a substantial amount of data (around 100 MB is typical). After compiling 10 projects, I get close to 1 GB of data.

I am wondering if it would be possible (and how to do that):
1. to specify the libraries which are specific to my project (say, I am not using SPI, so I would not need to compile it);
2. to direct the output of the compilation of the libraries to a single/general "build" directory, not the project's build directory, so that
for any number of projects my "build" directory would hold only 100 MB.

I am used to doing this on a number of IDEs (I am working on WIndows :( ), but being new to ESP-IDF, I am having difficulties on where to find information about these options.

Thanks for any pointers, including to documentation I am supposed to read.

Re: Limiting compilation of all libraries

Posted: Sat Oct 26, 2019 7:39 am
by ESP_igrr
Hi Julio,

If you are using the CMake build system, you can set COMPONENTS variable to a short list of components you are actually using (see ... -variables). By default the main component implicitly "REQUIRE"s all other components, you can set an explicit list there as well, see the same documentation page.

With regards to sharing the build products, it is not possible in the general case, since compilation of every IDF project depends on the options set in sdkconfig file. Each project may have different settings in the sdkconfig files, so object files built with different projects will be exactly the same.

Re: Limiting compilation of all libraries

Posted: Tue Oct 29, 2019 8:56 pm
by jcdmelo
Hi, ESP_igrr (sorry, didn't catch your name),

Thanks for the reply. I will look into the documentation to know how to set the COMPONENTS variable.

In your last phrase, I guess you meant "will NOT be exactly the same", right?