From b6b5c0b9a44819b095b369f507599c79ac885ec5 Mon Sep 17 00:00:00 2001 From: Lily Wang <94091114+LilyWangLL@users.noreply.github.com> Date: Fri, 16 Dec 2022 14:22:42 -0800 Subject: [PATCH] [vcpkg baseline] [bgfx] Fix dependencies (#28377) * [vcpkg baseline] [bgfx] Fix dependencies * format vcpkg.json * x-add-version --- ports/bgfx/fix-dependencies.patch | 49 +++++++++++++++++++++++++++++++ ports/bgfx/fix-headerfile.patch | 13 ++++++++ ports/bgfx/portfile.cmake | 2 ++ ports/bgfx/vcpkg.json | 4 +++ versions/b-/bgfx.json | 5 ++++ versions/baseline.json | 2 +- 6 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 ports/bgfx/fix-dependencies.patch create mode 100644 ports/bgfx/fix-headerfile.patch diff --git a/ports/bgfx/fix-dependencies.patch b/ports/bgfx/fix-dependencies.patch new file mode 100644 index 0000000000..05b209a970 --- /dev/null +++ b/ports/bgfx/fix-dependencies.patch @@ -0,0 +1,49 @@ +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 + $ + $) + ++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 diff --git a/ports/bgfx/fix-headerfile.patch b/ports/bgfx/fix-headerfile.patch new file mode 100644 index 0000000000..c464c12f47 --- /dev/null +++ b/ports/bgfx/fix-headerfile.patch @@ -0,0 +1,13 @@ +diff --git a/src/image_decode.cpp b/src/image_decode.cpp +index dd391e5..8218ac9 100644 +--- a/src/image_decode.cpp ++++ b/src/image_decode.cpp +@@ -19,7 +19,7 @@ BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4505) // warning C4505: 'tinyexr::miniz::def_r + #define MINIZ_NO_ARCHIVE_APIS + #define MINIZ_NO_STDIO + #define TINYEXR_IMPLEMENTATION +-#include ++#include + BX_PRAGMA_DIAGNOSTIC_POP() + + BX_PRAGMA_DIAGNOSTIC_PUSH(); diff --git a/ports/bgfx/portfile.cmake b/ports/bgfx/portfile.cmake index 9bc743d374..52a22f7a1a 100644 --- a/ports/bgfx/portfile.cmake +++ b/ports/bgfx/portfile.cmake @@ -18,6 +18,7 @@ vcpkg_from_github( HEAD_REF master REF 85109d7cdbe775a0ab72cf38510df525d5e8d3da SHA512 b3e082cd249e802e6d209ed45a552843604713a06597277b2855d1fa1c39b3d5136d5589599a85126eda218ccfee0ce6177f004cb5dccb912fe64ea7e07af2a8 + PATCHES fix-headerfile.patch ) vcpkg_from_github( @@ -44,6 +45,7 @@ endif () vcpkg_extract_source_archive(SOURCE_PATH ARCHIVE "${ARCHIVE}" + PATCHES fix-dependencies.patch ) vcpkg_cmake_configure( diff --git a/ports/bgfx/vcpkg.json b/ports/bgfx/vcpkg.json index 63fc590dd7..fd2dcc866b 100644 --- a/ports/bgfx/vcpkg.json +++ b/ports/bgfx/vcpkg.json @@ -1,12 +1,16 @@ { "name": "bgfx", "version": "1.118.8384-362", + "port-version": 1, "maintainers": "Sandy Carter ", "description": "Cross-platform, graphics API agnostic, Bring Your Own Engine/Framework style rendering library.", "homepage": "https://bkaradzic.github.io/bgfx/overview.html", "documentation": "https://bkaradzic.github.io/bgfx", "license": "BSD-2-Clause", "dependencies": [ + "libsquish", + "nvtt", + "tinyexr", { "name": "vcpkg-cmake", "host": true diff --git a/versions/b-/bgfx.json b/versions/b-/bgfx.json index 190c18afeb..6805b47395 100644 --- a/versions/b-/bgfx.json +++ b/versions/b-/bgfx.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "9359637243730a77d0139bd3ecdf317bd16fa38e", + "version": "1.118.8384-362", + "port-version": 1 + }, { "git-tree": "6554186755cae40eef0b34bf0c447861d6e6dd7a", "version": "1.118.8384-362", diff --git a/versions/baseline.json b/versions/baseline.json index 266c56ebf7..628ea81f6d 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -490,7 +490,7 @@ }, "bgfx": { "baseline": "1.118.8384-362", - "port-version": 0 + "port-version": 1 }, "bigint": { "baseline": "2010.04.30",