BinomialLLC / basis_universal

Basis Universal GPU Texture Codec
Apache License 2.0
2.73k stars 267 forks source link

build: support find_package basisu via CMake + CMake improvements #383

Open aminya opened 3 weeks ago

aminya commented 3 weeks ago

This adds needed CMake commands to make basisu usable via find_package(basisu CONFIG), which is the preferred method when using basisu in another project.

This is how the installation directory would look like

image

I added an option that allows for disabling the building of the examples, which can be optionally enabled. I added the code for forwarding the BASISID CMake definitions to the targets if defined externally.

Finally, I fixed an issue with stripping when using Multi-config generators with LLVM.

Here's how you can test this:

cmake -S . -B ./build/ -G "Ninja Multi-Config" -DEXAMPLES=OFF
cmake --build ./build/ --config Release
cmake --install ./build/ --config Release --prefix ./install