Skip to content

Commit 6a38a06

Browse files
authored
Minor build tweaks (KhronosGroup#407)
* Use zstd.h from basisu clone. * Use different BASISD_SUPPORT_KTX2 values for ktx and ktx_read targets.
1 parent d41755a commit 6a38a06

File tree

3 files changed

+24
-2085
lines changed

3 files changed

+24
-2085
lines changed

CMakeLists.txt

+24-32
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ macro(commom_lib_settings lib write)
226226
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/basisu/transcoder>
227227
$<INSTALL_INTERFACE:lib/basisu/transcoder>
228228

229-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/basisu/transcoder>
229+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/basisu/zstd>
230230
$<INSTALL_INTERFACE:lib/basisu/zstd>
231231

232232
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/other_include>
@@ -237,17 +237,6 @@ macro(commom_lib_settings lib write)
237237
target_compile_definitions(${lib} PUBLIC KHRONOS_STATIC)
238238
endif()
239239

240-
# BASISD_SUPPORT_KTX2 has to be 1 to compile the encoder. We
241-
# don't use it. Hopefully it doesn't add too much code. We're using
242-
# the zstd encoder in basisu by explicitly including the file in our
243-
# source list. We don't need to related code in the encoder.
244-
target_compile_definitions(
245-
${lib}
246-
PRIVATE
247-
BASISD_SUPPORT_KTX2_ZSTD=0
248-
BASISD_SUPPORT_KTX2=1
249-
)
250-
251240
# To reduce size, don't support transcoding to ancient formats.
252241
target_compile_definitions(${lib} PRIVATE BASISD_SUPPORT_FXT1=0)
253242

@@ -365,6 +354,13 @@ commom_lib_settings(ktx_read 0)
365354

366355
create_version_header(lib ktx)
367356

357+
target_compile_definitions(
358+
ktx_read
359+
PRIVATE
360+
# We're reading the files ourselves so don't need Basis KTX v2 support.
361+
BASISD_SUPPORT_KTX2_ZSTD=0
362+
BASISD_SUPPORT_KTX2=0
363+
)
368364

369365
# Adding write capability to target ktx
370366

@@ -430,27 +426,23 @@ target_compile_definitions(
430426
ktx
431427
PUBLIC
432428
KTX_FEATURE_WRITE
429+
PRIVATE
430+
# BASISD_SUPPORT_KTX2 has to be 1 to compile the encoder. We
431+
# don't use it. Hopefully it doesn't add too much code. We're using
432+
# the zstd encoder in basisu by explicitly including the file in our
433+
# source list. We don't need the related code in the encoder.
434+
BASISD_SUPPORT_KTX2_ZSTD=0
435+
BASISD_SUPPORT_KTX2=1
436+
$<$<BOOL:${BASISU_SUPPORT_SSE}>:BASISU_SUPPORT_SSE=1>
437+
$<$<NOT:$<BOOL:${BASISU_SUPPORT_SSE}>>:BASISU_SUPPORT_SSE=0>
438+
)
439+
target_compile_options(
440+
ktx
441+
PRIVATE
442+
$<$<AND:$<BOOL:${BASISU_SUPPORT_SSE}>,$<CXX_COMPILER_ID:AppleClang,Clang,GNU>>:
443+
-msse4.1
444+
>
433445
)
434-
if(BASISU_SUPPORT_SSE)
435-
target_compile_definitions(
436-
ktx
437-
PRIVATE
438-
BASISU_SUPPORT_SSE=1
439-
)
440-
target_compile_options(
441-
ktx
442-
PRIVATE
443-
$<$<CXX_COMPILER_ID:AppleClang,Clang,GNU>:
444-
-msse4.1
445-
>
446-
)
447-
else()
448-
target_compile_definitions(
449-
ktx
450-
PRIVATE
451-
BASISU_SUPPORT_SSE=0
452-
)
453-
endif()
454446

455447
if(EMSCRIPTEN)
456448
set(

lib/basis_transcode.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "vkformat_enum.h"
3030
#include "vk_format.h"
3131
#include "basis_sgd.h"
32-
#include "basisu/encoder/basisu_comp.h"
3332
#include "basisu/transcoder/basisu_file_headers.h"
3433
#include "basisu/transcoder/basisu_transcoder.h"
3534
#include "basisu/transcoder/basisu_transcoder_internal.h"

0 commit comments

Comments
 (0)