vcpkg/ports/bgfx/fix-dependencies.patch
Lily Wang b6b5c0b9a4
[vcpkg baseline] [bgfx] Fix dependencies (#28377)
* [vcpkg baseline] [bgfx] Fix dependencies

* format vcpkg.json

* x-add-version
2022-12-16 14:22:42 -08:00

50 lines
2.2 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 14eb13d..dad3b53 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -149,7 +149,7 @@ if( BGFX_INSTALL )
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
if( NOT BGFX_LIBRARY_TYPE MATCHES "SHARED" )
- install( TARGETS bimg bx astc-encoder edtaa3 etc1 etc2 iqa squish nvtt pvrtc tinyexr
+ install( TARGETS bimg bx astc-encoder edtaa3 etc1 etc2 iqa pvrtc
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
diff --git a/cmake/bimg.cmake b/cmake/bimg.cmake
index 9519b3a..e4b6341 100644
--- a/cmake/bimg.cmake
+++ b/cmake/bimg.cmake
@@ -14,10 +14,11 @@ include( ${CMAKE_CURRENT_LIST_DIR}/3rdparty/edtaa3.cmake )
include( ${CMAKE_CURRENT_LIST_DIR}/3rdparty/etc1.cmake )
include( ${CMAKE_CURRENT_LIST_DIR}/3rdparty/etc2.cmake )
include( ${CMAKE_CURRENT_LIST_DIR}/3rdparty/iqa.cmake )
-include( ${CMAKE_CURRENT_LIST_DIR}/3rdparty/libsquish.cmake )
-include( ${CMAKE_CURRENT_LIST_DIR}/3rdparty/nvtt.cmake )
include( ${CMAKE_CURRENT_LIST_DIR}/3rdparty/pvrtc.cmake )
-include( ${CMAKE_CURRENT_LIST_DIR}/3rdparty/tinyexr.cmake )
+find_package(tinyexr CONFIG REQUIRED)
+find_package(unofficial-libsquish CONFIG REQUIRED)
+find_library(NVTT_LIBRARIES NAMES nvtt libnvtt PATH_SUFFIXES static)
+find_path(NVTT_INCLUDE_DIRS NAMES nvtt.h PATH_SUFFIXES nvtt)
# Ensure the directory exists
if( NOT IS_DIRECTORY ${BIMG_DIR} )
@@ -33,12 +34,13 @@ add_library( bimg STATIC ${BIMG_SOURCES} )
# Add include directory of bimg
target_include_directories( bimg
- PUBLIC
+ PUBLIC
$<BUILD_INTERFACE:${BIMG_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
+target_include_directories( bimg PRIVATE ${NVTT_INCLUDE_DIRS})
# bimg dependencies
-target_link_libraries( bimg PUBLIC bx PRIVATE astc-encoder edtaa3 etc1 etc2 iqa squish nvtt pvrtc tinyexr )
+target_link_libraries( bimg PUBLIC bx PRIVATE astc-encoder edtaa3 etc1 etc2 iqa unofficial::libsquish::squish ${NVTT_LIBRARIES} pvrtc unofficial::tinyexr::tinyexr )
# Put in a "bgfx" folder in Visual Studio
set_target_properties( bimg PROPERTIES FOLDER "bgfx" )
\ No newline at end of file