Exclude files/folders from build

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Exclude files/folders from build

2,109 Views
giusloq
Contributor III

I often include a complete third party component repository to my project. For example, I copy (or clone) lwip repository in a folder of my C project for MCUXpresso.

As you know, only one or a small set of folders in lwip repository must be build, others are for documentation, tests and so on.

I'm wondering what is the best way to exclude certain files/subfolders of a main folder or, on the contrary, include only certain files/subfolders.

I found two ways. One is the most obvious: right-click on the folder to exclude, Properties, Exclude resource from Build in C/C++ Build window. All excluded resources will be added as a filter in Source Location tab of Paths and Symbols window of project properties.
All excluded files/folders are shown in the Project Explorer with a slash over the icon.

Another way is to play with Resource Filters. Right-click on lwip folder, Properties, Resource Filters. Here I can choose to use an "include only" or "exclude all" logic. In this case, filtered resources aren't shown at all in the Project Explorer.

I don't know if there are other ways and I'm not sure what is the best approach. Anyway I noticed SDK examples projects have something similar. If you add lwip component (through Manage SDK Component), there will be some files and folders in the lwip directory on the filesystem, but they aren't shown at all in the Project Explorer. However I couldn't find any Resource Filter either any filter in the Source Location.

0 Kudos
3 Replies

2,101 Views
ErichStyger
Senior Contributor V

What I'm using in my projects is the 'exclude from build' way: it has the advantage that you can do this differently for different build configuration too.

Erich

2,090 Views
giusloq
Contributor III

What I'm using in my projects is the 'exclude from build' way: it has the advantage that you can do this differently for different build configuration too.

Yes, you're right for resources that must be compiled only for certain Configuration Builds.

However, when you want to exclude the test folder of lwip repository (for example), you want to exclude for all builds.

Moreover, in this case, it's not simple to maintain the "exclude from build" identical on different builds. You need to remember to exclude the files/folders in every builds and if you have many builds...

Another point for Resource Filter: when you use it, the files/folders are completely removed from Project Explorer, so I suspect it's much more fast for Eclipse to skip everything in filtered folders. I think excluded from build folders are there in the Project Explorer and I suspect Eclipse takes some time to process files in it.

2,080 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello giusloq,

Thanks very much for your sharing, for now ,it seems only the two methods you mentioned, thanks.

 

BR

Alice

0 Kudos