tmxlite
tmxlite copied to clipboard
Read maps with zstd if compression is zstd.
I added support for base64 encoded maps with zstd compression. This fixes #80.
The build fails. I don't know if zstd is installed on the build machine. Do we need a FindZstd.cmake file? It worked without one for me.
Thanks for the contribution. To pass the CI zstd will need to be added to the cmake file as a dependency. This is somewhat unfortunate as it goes against the original mantra of being 'lite' - which was that tmxlite should not need any external dependencies which couldn't be included in the repository. However, if this is a much sought feature then an exception can probably be made.
Just looking at this library for the first time, so not an expert on it or its philosophy, I just have a suggestion: could it be an option to make the dependency on zstd (and thus the support for compressed files) optional in cmake? The project could be made to build anyways even if zstd is not there, or even add a user-controlled option like -DTMX_WITH_ZSTD=ON
. It should be simple with a few ifdefs around in the code.
This would be the way to go, I think, should support be added. If there are more requests for it, or the original author of the PR wants to update it then I would happily accept it. It's not a high priority for me personally right now, however, mostly as I don't have time to work on the feature for the foreseeable future, but also because I'm not sure what advantage it offers over the existing zlib compression supported by tmxlite?
I'm not personally interested in this either, but to answer your question I believe most distros are switching to using zstd as the default compression. From what I read the motivation is that zstd offers a compression ratio comparable to xz but with faster decompression and lower memory requirements. That also makes it superion to gzip, which is fast but doesn't achieve very high compression afaik.
Since I just opened a PR myself, if this gets merged I'll be happy to update my build scripts from my own PR as well.
Ah OK, thanks for clarifying. Perhaps I shall take another look at this in the future.