mirror of https://github.com/microsoft/vcpkg.git
83 lines
2.7 KiB
Diff
83 lines
2.7 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 135b35e..19d02b2 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -33,6 +33,10 @@ message("Initial ZSTD=${ZSTD}")
|
|
message("Initial OPENCL=${OPENCL}")
|
|
message("Initial SAN=${SAN}")
|
|
|
|
+if(BASISU_SYSTEM_ZSTD)
|
|
+ find_package(zstd CONFIG REQUIRED)
|
|
+endif()
|
|
+
|
|
if ((NOT MSVC) AND OPENCL)
|
|
# With MSVC builds we use the Khronos lib/include files in the project's "OpenCL" directory, to completely avoid requiring fiddly to install vendor SDK's.
|
|
# Otherwise we use the system's (if any).
|
|
@@ -163,10 +167,6 @@ set(ENCODER_LIB_SRC_LIST
|
|
transcoder/basisu_transcoder.cpp
|
|
)
|
|
|
|
-if (ZSTD)
|
|
- set(ENCODER_LIB_SRC_LIST ${ENCODER_LIB_SRC_LIST} zstd/zstd.c)
|
|
-endif()
|
|
-
|
|
# Create the static library
|
|
add_library(basisu_encoder STATIC ${ENCODER_LIB_SRC_LIST})
|
|
target_include_directories(basisu_encoder PUBLIC
|
|
@@ -174,6 +174,14 @@ target_include_directories(basisu_encoder PUBLIC
|
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/encoder>
|
|
$<INSTALL_INTERFACE:include>)
|
|
|
|
+if (ZSTD AND BASISU_SYSTEM_ZSTD)
|
|
+ find_package(zstd CONFIG REQUIRED)
|
|
+ target_link_libraries(basisu_encoder PRIVATE zstd::libzstd)
|
|
+elseif (ZSTD)
|
|
+ target_sources(basisu_encoder PRIVATE zstd/zstd.c)
|
|
+ target_include_directories(basisu_encoder BEFORE PRIVATE zstd)
|
|
+endif()
|
|
+
|
|
# Create the basisu executable and link against the static library
|
|
add_executable(basisu basisu_tool.cpp)
|
|
target_link_libraries(basisu PRIVATE basisu_encoder)
|
|
diff --git a/basisu-config.cmake.in b/basisu-config.cmake.in
|
|
index 15c0d7e..da4d9ee 100644
|
|
--- a/basisu-config.cmake.in
|
|
+++ b/basisu-config.cmake.in
|
|
@@ -1,5 +1,10 @@
|
|
@PACKAGE_INIT@
|
|
|
|
+include(CMakeFindDependencyMacro)
|
|
+if("@ZSTD@" AND "@BASISU_SYSTEM_ZSTD@")
|
|
+ find_dependency(zstd CONFIG)
|
|
+endif()
|
|
+
|
|
include("${CMAKE_CURRENT_LIST_DIR}/basisu-targets.cmake")
|
|
|
|
check_required_components(basisu)
|
|
diff --git a/encoder/basisu_comp.cpp b/encoder/basisu_comp.cpp
|
|
index 59a2a50..e9aa20f 100644
|
|
--- a/encoder/basisu_comp.cpp
|
|
+++ b/encoder/basisu_comp.cpp
|
|
@@ -33,7 +33,7 @@
|
|
#endif
|
|
|
|
#if BASISD_SUPPORT_KTX2_ZSTD
|
|
-#include "../zstd/zstd.h"
|
|
+#include <zstd.h>
|
|
#endif
|
|
|
|
// Set to 1 to disable the mipPadding alignment workaround (which only seems to be needed when no key-values are written at all)
|
|
diff --git a/transcoder/basisu_transcoder.cpp b/transcoder/basisu_transcoder.cpp
|
|
index 0f7ca15..5b9f032 100644
|
|
--- a/transcoder/basisu_transcoder.cpp
|
|
+++ b/transcoder/basisu_transcoder.cpp
|
|
@@ -169,7 +169,7 @@
|
|
// If BASISD_SUPPORT_KTX2_ZSTD is 0, UASTC files compressed with Zstd cannot be loaded.
|
|
#if BASISD_SUPPORT_KTX2_ZSTD
|
|
// We only use two Zstd API's: ZSTD_decompress() and ZSTD_isError()
|
|
- #include "../zstd/zstd.h"
|
|
+ #include "zstd.h"
|
|
#endif
|
|
#endif
|
|
|