how to solve error LNK2005 occurs when linking ktx.dll #1266
-
the external dependencies of cesium-native are now built using vcpkg. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
This is new issue so I don't have an off the shelf solution. Would it be possible to hide the KTX symbols built by the vsgXchange::ktx plugin? Perhaps CMake has an option for this. |
Beta Was this translation helpful? Give feedback.
-
Could you generate at Pull Request with these changes. I will try things
out on Linux and see how easy it is now to pull ktx as an external
dependency. If it goes smoothly we can make it the new way of managing ktx
support.
…On Fri, 30 Aug 2024, 04:01 xingfu2005, ***@***.***> wrote:
Thanks your advice!
The problem has been solved. I modified
vsgXchange\src\ktx\build_vars.cmake to use external ktx dependency build:
find_package(Ktx CONFIG REQUIRED)
if(Ktx_FOUND)
set(SOURCES ${SOURCES} ktx/ktx.cpp)
set(EXTRA_LIBRARIES ${EXTRA_LIBRARIES} KTX::ktx)
set(EXTRA_DEFINES ${EXTRA_DEFINES} NEED_VK_GET_FORMAT_SIZE)
set(EXTRA_INCLUDES ${EXTRA_INCLUDES} $
<BUILD_INTERFACE:${VSGXCHANGE_SOURCE_DIR}/src/ktx/lib>)
if(NOT BUILD_SHARED_LIBS)
set(FIND_DEPENDENCY ${FIND_DEPENDENCY} "find_dependency(Ktx)")
endif()
else()
# Compile ktx read library
set(KTX_SOURCES
ktx/libktx/ktx.h
# ktx/libktx/basis_sgd.h
ktx/libktx/checkheader.c
ktx/libktx/dfdutils/createdfd.c
# ktx/libktx/dfdutils/colourspaces.c
ktx/libktx/dfdutils/dfd.h
ktx/libktx/dfdutils/dfd2vk.inl
ktx/libktx/dfdutils/interpretdfd.c
ktx/libktx/dfdutils/printdfd.c
ktx/libktx/dfdutils/queries.c
ktx/libktx/dfdutils/vk2dfd.c
# ktx/libktx/dfdutils/vulkan/vk_platform.h
# ktx/libktx/dfdutils/vulkan/vulkan_core.h
# ktx/libktx/etcdec.cxx
# ktx/libktx/etcunpack.cxx
ktx/libktx/filestream.c
ktx/libktx/filestream.h
# ktx/libktx/formatsize.h
# ktx/libktx/gl_format.h
# ktx/libktx/gl_funcs.c
# ktx/libktx/gl_funcs.h
# ktx/libktx/glloader.c
ktx/libktx/hashlist.c
# ktx/libktx/info.c
ktx/libktx/ktxint.h
ktx/libktx/memstream.c
ktx/libktx/memstream.h
# ktx/libktx/stream.h
# ktx/libktx/strings.c
ktx/libktx/swap.c
ktx/libktx/texture.c
ktx/libktx/texture.h
ktx/libktx/texture1.c
ktx/libktx/texture1.h
ktx/libktx/texture2.c
ktx/libktx/texture2.h
# ktx/libktx/uthash.h
# ktx/libktx/vk_format.h
# ktx/libktx/vkformat_check.c
# ktx/libktx/vkformat_enum.h
# ktx/libktx/vkformat_str.c
# ktx/libktx/ktxvulkan.h
ktx/libktx/vkloader.c
ktx/libktx/zstddeclib.c
)
source_group(libktx FILES ${KTX_SOURCES})
set(SOURCES ${SOURCES} ${KTX_SOURCES} ktx/ktx.cpp)
set(EXTRA_DEFINES ${EXTRA_DEFINES} KHRONOS_STATIC LIBKTX
BASISD_SUPPORT_FXT1=0 BASISU_NO_ITERATOR_DEBUG_LEVEL KTX_FEATURE_KTX1
KTX_FEATURE_KTX2)
set(EXTRA_INCLUDES ${EXTRA_INCLUDES} $
<BUILD_INTERFACE:${VSGXCHANGE_SOURCE_DIR}/src/ktx/libktx>)
endif()
—
Reply to this email directly, view it on GitHub
<#1266 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKEGUBL34JOZ6MMPPHEIWTZT7OCFAVCNFSM6AAAAABNBPLYVCVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANBZGM2DKNI>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
Thanks your advice!
The problem has been solved. I modified vsgXchange\src\ktx\build_vars.cmake to use external ktx dependency build:
find_package(Ktx CONFIG REQUIRED)${EXTRA_INCLUDES} $ <BUILD_INTERFACE:${VSGXCHANGE_SOURCE_DIR}/src/ktx/lib>)
if(Ktx_FOUND)
set(SOURCES ${SOURCES} ktx/ktx.cpp)
set(EXTRA_LIBRARIES ${EXTRA_LIBRARIES} KTX::ktx)
set(EXTRA_DEFINES ${EXTRA_DEFINES} NEED_VK_GET_FORMAT_SIZE)
set(EXTRA_INCLUDES
if(NOT BUILD_SHARED_LIBS)
set(FIND_DEPENDENCY ${FIND_DEPENDENCY} "find_dependency(Ktx)")
endif()
else()
# Compile ktx read library
set(KTX_SOURCES
ktx/libktx/ktx.h
# ktx/libktx/basis_sgd.h
ktx/libktx/checkheader.c
ktx/libktx/dfdutils/createdfd.c
# ktx/libktx/dfdutils/colou…