Skip to content

Commit 6394a27

Browse files
ondysakien-mga
andcommitted
Made it easier to use the library with external zstdlib implementations (mostly in non CMake builds).
In our internal repository, we have our own version of zstdlib and introducing extra copy is both undesirable and potentially dangerous (due to ODR violations). Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
1 parent 7c046f8 commit 6394a27

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ target_link_libraries(examples PRIVATE basisu_encoder)
180180
if (ZSTD)
181181
target_compile_definitions(basisu PRIVATE BASISD_SUPPORT_KTX2_ZSTD=1)
182182
target_compile_definitions(examples PRIVATE BASISD_SUPPORT_KTX2_ZSTD=1)
183+
target_include_directories(basisu PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/zstd)
184+
target_include_directories(examples PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/zstd)
183185
else()
184186
target_compile_definitions(basisu PRIVATE BASISD_SUPPORT_KTX2_ZSTD=0)
185187
target_compile_definitions(examples PRIVATE BASISD_SUPPORT_KTX2_ZSTD=0)

encoder/basisu_comp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#endif
3434

3535
#if BASISD_SUPPORT_KTX2_ZSTD
36-
#include "../zstd/zstd.h"
36+
#include <zstd.h>
3737
#endif
3838

3939
// Set to 1 to disable the mipPadding alignment workaround (which only seems to be needed when no key-values are written at all)

transcoder/basisu_transcoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
// If BASISD_SUPPORT_KTX2_ZSTD is 0, UASTC files compressed with Zstd cannot be loaded.
165165
#if BASISD_SUPPORT_KTX2_ZSTD
166166
// We only use two Zstd API's: ZSTD_decompress() and ZSTD_isError()
167-
#include "../zstd/zstd.h"
167+
#include <zstd.h>
168168
#endif
169169
#endif
170170

0 commit comments

Comments
 (0)