Making `container node sizes` optional?
weefuzzy opened this issue · comments
Hello, I have questions about the container node sizes
stuff, motivated by (a) not really grasping what exactly it's for and (b) the amount of time it's adding to my configure step every time I re-run CMake.
- It seems like before #129 this step was optional, based on the value of
FOONATHAN_MEMORY_BUILD_TOOLS
, but now it runsget_container_node_sizes
unconditionally on every CMake invocation. Is this correct? And is it necessary? - If it really can't be made optional, is there a case for only running on the first invocation of CMake? Presumably, for a given toolchain, the things it discovers will remain constant. I guess one could use an internal cache variable as a flag – happy to submit a PR if that seems like a useful thing.
Perhaps relevant:
- I'm pulling in the
memory
library using CMakeFetchContent
and then doingadd_subdirectory
withEXCLUDE_FROM_ALL
. Perhaps this is too off-label. It just happens to be the way I get the other dependencies for my project. - I'm not (yet) doing anything sophisticated with
memory
, like making my own pools. I'm just using it to get polymorphic-memory-resource like behaviour so I can switch between a small number of pre-existing allocators.
Seconding this - I'm having the exact same issue. I don't know what might cause the size of nodes to change between builds, but it seems to me like get_container_node_sizes
should be able to short circuit if outfile
already exists? Maybe it needs to cache some settings values such that it can determine if the file needs to be regenerated? Depending on what exactly could cause the node size to change, it might be acceptable to just require that if the user needs to recalculate it, they need to do a clean build with new settings
The header is no longer re-generated if it already exists. If someone wants to do more sophisticated guarding against CMake changes (I don't know whether it's necessary), feel free to do a PR.
If you want to disable the header entirely, it is enough to use CMake to create an empty file at that location.
That's great, thank you!