mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-26 01:30:55 +08:00
[mdl-sdk] Fix build of openimageio feature after update to OpenImageIO 3.x. (#42492)
This commit is contained in:
parent
1ee711b50e
commit
d05fa3fd4d
100
ports/mdl-sdk/013-openimageio-3.0.patch
Normal file
100
ports/mdl-sdk/013-openimageio-3.0.patch
Normal file
@ -0,0 +1,100 @@
|
||||
diff -u -r a/cmake/find/find_boost_ext.cmake b/cmake/find/find_boost_ext.cmake
|
||||
--- a/cmake/find/find_boost_ext.cmake
|
||||
+++ b/cmake/find/find_boost_ext.cmake
|
||||
@@ -38,13 +38,7 @@
|
||||
set(Boost_NO_WARN_NEW_VERSIONS ON CACHE INTERNAL "")
|
||||
#set(Boost_DEBUG ON)
|
||||
|
||||
- if(MDL_BUILD_OPENIMAGEIO_PLUGIN OR MDL_BUILD_CORE_EXAMPLES)
|
||||
- # OpenImageIO needs Boost::filesystem and Boost::thread.
|
||||
- find_package(Boost COMPONENTS filesystem thread)
|
||||
- else()
|
||||
- # Otherwise the Boost headers are sufficient.
|
||||
- find_package(Boost)
|
||||
- endif()
|
||||
+ find_package(Boost)
|
||||
|
||||
set(Boost_FOUND ${Boost_FOUND} CACHE INTERNAL "Dependency boost has been resolved.")
|
||||
|
||||
diff -u -r a/cmake/find/find_openimageio_ext.cmake b/cmake/find/find_openimageio_ext.cmake
|
||||
--- a/cmake/find/find_openimageio_ext.cmake
|
||||
+++ b/cmake/find/find_openimageio_ext.cmake
|
||||
@@ -4,19 +4,17 @@
|
||||
|
||||
function(FIND_OPENIMAGEIO_EXT)
|
||||
|
||||
- if(${CMAKE_VERSION} VERSION_LESS "3.19.0")
|
||||
- find_package(OpenImageIO)
|
||||
- if(OpenImageIO_FOUND)
|
||||
- if(${OpenImageIO_VERSION} VERSION_LESS "2.4")
|
||||
- set(OpenImageIO_FOUND OFF)
|
||||
- message(WARNING "Found OpenImageIO version ${OpenImageIO_VERSION} is too old.")
|
||||
- elseif(${OpenImageIO_VERSION} VERSION_GREATER_EQUAL "3.0")
|
||||
- set(OpenImageIO_FOUND OFF)
|
||||
- message(WARNING "Found OpenImageIO version ${OpenImageIO_VERSION} is too new.")
|
||||
- endif()
|
||||
+ # Explicit code since a version range on find_package() does not support multiple major
|
||||
+ # versions.
|
||||
+ find_package(OpenImageIO)
|
||||
+ if(OpenImageIO_FOUND)
|
||||
+ if(${OpenImageIO_VERSION} VERSION_LESS "2.4")
|
||||
+ set(OpenImageIO_FOUND OFF)
|
||||
+ message(WARNING "Found OpenImageIO version ${OpenImageIO_VERSION} is too old.")
|
||||
+ elseif(${OpenImageIO_VERSION} VERSION_GREATER_EQUAL "4.0")
|
||||
+ set(OpenImageIO_FOUND OFF)
|
||||
+ message(WARNING "Found OpenImageIO version ${OpenImageIO_VERSION} is too new.")
|
||||
endif()
|
||||
- else()
|
||||
- find_package(OpenImageIO 2.4...<3.0)
|
||||
endif()
|
||||
|
||||
# See https://github.com/microsoft/vcpkg/issues/29284
|
||||
diff -u -r a/src/shaders/plugin/openimageio/openimageio_utilities.cpp b/src/shaders/plugin/openimageio/openimageio_utilities.cpp
|
||||
--- a/src/shaders/plugin/openimageio/openimageio_utilities.cpp
|
||||
+++ b/src/shaders/plugin/openimageio/openimageio_utilities.cpp
|
||||
@@ -421,14 +421,22 @@
|
||||
|
||||
const char* proxytype () const override { return "nv_reader"; }
|
||||
void close() override { m_reader.reset(); }
|
||||
+#if OIIO_VERSION >= OIIO_MAKE_VERSION(3,0,0)
|
||||
+ int64_t tell() const override { return m_reader->tell_absolute(); }
|
||||
+#else
|
||||
int64_t tell() override { return m_reader->tell_absolute(); }
|
||||
+#endif
|
||||
bool seek( int64_t offset) override { return m_reader->seek_absolute( offset); }
|
||||
size_t read( void* buf, size_t size) override;
|
||||
size_t write( const void* buf, size_t size) override;
|
||||
size_t pread( void* buf, size_t size, int64_t offset) override;
|
||||
size_t pwrite( const void* buf, size_t size, int64_t offset) override;
|
||||
size_t size() const override { return m_reader->get_file_size(); }
|
||||
+#if OIIO_VERSION >= OIIO_MAKE_VERSION(3,0,0)
|
||||
+ void flush() override { }
|
||||
+#else
|
||||
void flush() const override { }
|
||||
+#endif
|
||||
|
||||
private:
|
||||
/// The wrapped reader.
|
||||
@@ -502,14 +510,22 @@
|
||||
|
||||
const char* proxytype () const override { return "nv_writer"; }
|
||||
void close() override { m_writer.reset(); }
|
||||
+#if OIIO_VERSION >= OIIO_MAKE_VERSION(3,0,0)
|
||||
+ int64_t tell() const override { return m_writer->tell_absolute(); }
|
||||
+#else
|
||||
int64_t tell() override { return m_writer->tell_absolute(); }
|
||||
+#endif
|
||||
bool seek( int64_t offset) override { return m_writer->seek_absolute( offset); }
|
||||
size_t read( void* buf, size_t size) override;
|
||||
size_t write( const void* buf, size_t size) override;
|
||||
size_t pread( void* buf, size_t size, int64_t offset) override;
|
||||
size_t pwrite( const void* buf, size_t size, int64_t offset) override;
|
||||
size_t size() const override { return m_writer->get_file_size(); }
|
||||
+#if OIIO_VERSION >= OIIO_MAKE_VERSION(3,0,0)
|
||||
+ void flush() override { m_writer->flush(); }
|
||||
+#else
|
||||
void flush() const override { m_writer->flush(); }
|
||||
+#endif
|
||||
|
||||
private:
|
||||
/// The wrapped writer.
|
@ -83,6 +83,7 @@ vcpkg_from_github(
|
||||
PATCHES
|
||||
008-build-static-llvm.patch
|
||||
012-remove-wrong-llvm-cxx-standard.patch
|
||||
013-openimageio-3.0.patch
|
||||
)
|
||||
|
||||
vcpkg_find_acquire_program(PYTHON3)
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "mdl-sdk",
|
||||
"version": "2024.0.4",
|
||||
"port-version": 1,
|
||||
"description": "NVIDIA Material Definition Language SDK",
|
||||
"homepage": "https://github.com/NVIDIA/MDL-SDK",
|
||||
"license": "BSD-3-Clause",
|
||||
|
@ -5866,7 +5866,7 @@
|
||||
},
|
||||
"mdl-sdk": {
|
||||
"baseline": "2024.0.4",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"mdns": {
|
||||
"baseline": "1.4.3",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "d1412426eab60c60fc3bbfb4efda57da723cbe9c",
|
||||
"version": "2024.0.4",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "089fc6e3fd51fbe06084eb0e59cbecb3b68387a3",
|
||||
"version": "2024.0.4",
|
||||
|
Loading…
x
Reference in New Issue
Block a user