KTX-Software
KTX-Software copied to clipboard
Add more options to control which CMake targets are created
Hi!
I've noticed that CMakeLists.txt
includes several targets by default with no option to prevent that. For example, both ktx
and ktx_read
would be added (leading to compilation of both targets when building the app regardless of which target is linked to it). Also obj_basisu_cbind
and objUtil
are always added (but looks like they are unused by the core library)
Apart from that ktx
always includes ASTC encoder and basisu encoder, which might not always be desired
My current setup is that I use libktx
as a CMake dependency (via FetchContent). My project consists of 2 parts: a simple offline tool which saves the input image data to the ktx2 format without encoding; and a renderer which only needs to read the ktx2 file without transcoding.
My ideal setup would be that I could disable everything I don't need, leaving only a basic library with the read/write functionality
Would that be in line with the project to add additional CMake options to conditionally skip adding some targets? If yes, I can try to come up with a PR
PRs for the following changes are acceptable:
- Build only ktx_read. Must disable tests. I think this may be the case already.
- Don't include obj_basisu_cbind unless the tests are being built. I think this may the case currently. It is only used by the transcode tests.
- Don't include objUtil unless tools or loadtests are being built. If this isn't the case I'd be surprised. The only part of objUtil that is used by the core library is
unused.h
which doesn't require the library to be built.
It's best to wait a month or so before creating PRs for these as some big changes are coming ...
The following are unacceptable
- Omitting the transcoder from ktx or ktx_read.
- Omitting the encoders from ktx.
Great, thanks for the confirmation I'll wait then for those big changes you mentioned before looking further into that
Those big changes are in main now.
@AntonShalgachev Do you still plan to provide a PR? I think the only thing to be done here is make it possible to build only one of ktx
or ktx_read
.
I'm still interested in having this change, but I won't be able to find time for a PR in the foreseeable future (I've switched to something else at the moment). If anyone else would need this feature earlier and would find some time for a PR, I'll happily let them do it :) Otherwise I can look into it once I'm back on the ktx
topic