BinomialLLC / basis_universal

Basis Universal GPU Texture Codec
Apache License 2.0
2.67k stars 260 forks source link

Trying to fix up the cmake script to be more consumable by downstream #330

Closed Honeybunch closed 4 months ago

Honeybunch commented 1 year ago

I was investigating adding more support to the meshoptimizer port on vcpkg when I realized I needed meshoptimizer to rely on basisu. Unfortunately it seems like the basisu port on vcpkg has rotted. It points to a fork https://github.com/jherico/basis_universal that has basically rotted and is currently read only. The fork has a few tweaks to the cmake in order to make it more easily consumed by downstream cmake projects, specifically (though not exclusively) through vcpkg. I figured I could take a stab at minimizing those changes and bringing them back into upstream so that it would be easier to update and maintain a vcpkg port of basisu, or just consume it downstream from whatever build system.

I tried to make minimal changes here but I did have to add two new targets so that downstream could rely on just the transcoder or encoder libraries. Both libraries seem to compile properly both with and without cmake's internal BUILD_SHARED_LIBS flag being turned on, so both static and shared libraries can be produced now. I also made sure that the install portion of the script will take care of putting all the headers and libs in the right places and added a config file so that downstream cmake projects can find all the targets via a find_package call.

I'm happy to make edits or add any clarifying comments :)