Files
Richard Geldreich 57a0a0b4c6 previewers: regenerate single-file transcoder with KTX2/Zstd enabled
Regenerate contrib/previewers/lib/basisu_transcoder.cpp from the current
transcoder sources with the single_file_transcoder combine.py script,
replacing a long-stale copy. KTX2 and Zstd are enabled.

Only the Basis Universal sources are amalgamated; Zstd is kept as an
ordinary #include "../zstd/zstd.h" (via combine.py's -k option) rather
than being inlined, and zstd/zstd.c is compiled and linked separately,
so Zstd is neither touched nor duplicated.

Update the previewers project to build the current (C++17) transcoder:
- set LanguageStandard to stdcpp17 (the transcoder uses inline variables
  and other C++17 features);
- define NOMINMAX (the Windows shell headers, included before the
  transcoder, otherwise define min/max macros that break the
  std::numeric_limits<>::max() calls);
- add the zstd directory to the include paths and compile
  ..\..\..\zstd\zstd.c as a separate compilation unit.

The DLL builds for Debug/Release, x64 and Win32. The previewer still
only registers .basis files; enabling KTX2/Zstd just makes the
transcoder compile cleanly out of the box.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 17:59:57 -04:00
..

Single File Basis Universal Transcoder

basisu_transcoder.cpp is an amalgamated single-file build of the Basis Universal transcoder, generated with the single file transcoder combine.py script. KTX2 and Zstd support are enabled.

Only the Basis Universal sources are amalgamated. Zstd is intentionally not inlined or duplicated: it is left as an ordinary #include "../zstd/zstd.h" (via combine.py's -k option), and its implementation (zstd/zstd.c) is compiled and linked separately by the consuming project. So the single file is just our code.

To regenerate it after changing the transcoder sources:

cd basis_universal/contrib/single_file_transcoder
python3 combine.py -r ../../transcoder -k ../../zstd/zstd.h \
    -o ../previewers/lib/basisu_transcoder.cpp basisu_transcoder-in.cpp

The consuming project must add the zstd directory to its include paths and build zstd/zstd.c as a separate compilation unit — see ../win/previewers.vcxproj, which adds ..\..\..\zstd to the include paths and compiles ..\..\..\zstd\zstd.c. (The Explorer previewer itself only registers .basis files, but the transcoder is built with KTX2/Zstd enabled so it compiles cleanly out of the box.)