fpm icon indicating copy to clipboard operation
fpm copied to clipboard

Only compile source of dependencies needed for project

Open awvwgk opened this issue 4 years ago • 4 comments

Not sure whether we currently have a mechanism to discard disconnected target graphs from the compilation which are not needed for any module in the library. It could be beneficial to only compile source code we actually use in our project, however we have to be careful to not discard non-module functions (either bind(c) or declared outside of a module).

This way we could depend on stdlib without having to worry about a too large single file version which can't be compiled anymore and lose our most important bootstrap mechanism.

awvwgk avatar Dec 13 '21 21:12 awvwgk

For stdlib specifically, I've been thinking it would be nice to have the possibility to only download/build selected modules specified in the manifest. I think what you are suggesting here is precisely this, however fpm would still be required to parse everything.

ivan-pi avatar Dec 14 '21 08:12 ivan-pi

This should be possible and is something I have thought would be useful.

... however we have to be careful to not discard non-module functions

The same goes for submodule objects which are not technically part of the module dependency tree (hence #556).

LKedward avatar Dec 15 '21 12:12 LKedward

The same goes for submodule objects which are not technically part of the module dependency tree (hence #556).

Would a weak/link-time dependency of the archive or the executable target help to capture the complete graph?

awvwgk avatar Dec 15 '21 12:12 awvwgk

Would a weak/link-time dependency of the archive or the executable target help to capture the complete graph?

Yes, I think something like that would work.

LKedward avatar Dec 15 '21 12:12 LKedward