diff --git a/ports/openimageio/fix-emscripten.patch b/ports/openimageio/fix-emscripten.patch new file mode 100644 index 0000000000..16b4cce3ae --- /dev/null +++ b/ports/openimageio/fix-emscripten.patch @@ -0,0 +1,94 @@ +diff --git a/src/libutil/strutil.cpp b/src/libutil/strutil.cpp +index 844275c..3c3b67b 100644 +--- a/src/libutil/strutil.cpp ++++ b/src/libutil/strutil.cpp +@@ -29,6 +29,9 @@ OIIO_PRAGMA_WARNING_POP + #if defined(__APPLE__) || defined(__FreeBSD__) + # include + #endif ++#ifdef __EMSCRIPTEN__ ++# include ++#endif + #ifdef _WIN32 + # include + #endif +@@ -51,7 +54,7 @@ OIIO_PRAGMA_WARNING_POP + #endif + #define stbsp__uintptr std::uintptr_t + +-#ifdef OpenImageIO_SANITIZE ++#if defined(OpenImageIO_SANITIZE) || defined(__EMSCRIPTEN__) + # define STB_SPRINTF_NOUNALIGNED + #endif + +@@ -539,6 +542,8 @@ strcasecmp(const char* a, const char* b) + if (*us1++ == '\0') + return (0); + return (tolower_l(*us1, c_loc) - tolower_l(*--us2, c_loc)); ++#elif defined(__EMSCRIPTEN__) ++ return ::strcasecmp(a, b); + #else + # error("need equivalent of strcasecmp_l on this platform"); + #endif +@@ -567,6 +572,8 @@ strncasecmp(const char* a, const char* b, size_t size) + } while (--size != 0); + } + return (0); ++#elif defined(__EMSCRIPTEN__) ++ return ::strncasecmp(a, b, size); + #else + # error("need equivalent of strncasecmp_l on this platform"); + #endif +diff --git a/src/libutil/sysutil.cpp b/src/libutil/sysutil.cpp +index 03e9127..e3075ea 100644 +--- a/src/libutil/sysutil.cpp ++++ b/src/libutil/sysutil.cpp +@@ -62,6 +62,11 @@ + # include + #endif + ++#ifdef __EMSCRIPTEN__ ++# include ++# include ++#endif ++ + #include + #include + #include +@@ -132,6 +137,8 @@ Sysutil::memory_used(bool resident) + // FIXME -- does somebody know a good method for figuring this out for + // FreeBSD? + return 0; // Punt ++#elif defined(__EMSCRIPTEN__) ++ return 0; + #else + // No idea what platform this is + OIIO_ASSERT(0 && "Need to implement Sysutil::memory_used on this platform"); +@@ -204,6 +211,8 @@ Sysutil::physical_memory() + sysctl(mib, 2, &physical_memory, &length, NULL, 0); + return physical_memory; + ++#elif defined(__EMSCRIPTEN__) ++ return 0; + #else + // No idea what platform this is + OIIO_ASSERT( +@@ -270,7 +279,8 @@ Sysutil::this_program_path() + size_t cb = sizeof(filename); + int r = 1; + sysctl(mib, 4, filename, &cb, NULL, 0); +-#elif defined(__GNU__) || defined(__OpenBSD__) || defined(_WIN32) ++#elif defined(__GNU__) || defined(__OpenBSD__) || defined(_WIN32) \ ++ || defined(__EMSCRIPTEN__) + int r = 0; + #else + // No idea what platform this is +@@ -301,6 +311,8 @@ Sysutil::usleep(unsigned long useconds) + { + #ifdef _WIN32 + Sleep(useconds / 1000); // Win32 Sleep() is milliseconds, not micro ++#elif defined(__EMSCRIPTEN__) ++ std::this_thread::sleep_for(std::chrono::microseconds(useconds)); + #else + ::usleep(useconds); // *nix usleep() is in microseconds + #endif diff --git a/ports/openimageio/portfile.cmake b/ports/openimageio/portfile.cmake index c96d46d040..166109bb23 100644 --- a/ports/openimageio/portfile.cmake +++ b/ports/openimageio/portfile.cmake @@ -6,6 +6,10 @@ set(PATCHES fix-openexr-target-missing.patch ) +if(VCPKG_TARGET_IS_EMSCRIPTEN) + list(APPEND PATCHES fix-emscripten.patch) +endif() + if(VCPKG_TARGET_IS_OSX) execute_process(COMMAND xcrun --show-sdk-version OUTPUT_VARIABLE OSX_SDK_VERSION diff --git a/ports/openimageio/vcpkg.json b/ports/openimageio/vcpkg.json index 0c5251ad84..434dd26dc5 100644 --- a/ports/openimageio/vcpkg.json +++ b/ports/openimageio/vcpkg.json @@ -1,9 +1,10 @@ { "name": "openimageio", "version": "3.1.14.0", + "port-version": 1, "description": "A library for reading and writing images, and a bunch of related classes, utilities, and application.", "homepage": "https://github.com/AcademySoftwareFoundation/OpenImageIO", - "license": "BSD-3-Clause", + "license": "Apache-2.0", "dependencies": [ "fmt", "libjpeg-turbo", diff --git a/versions/baseline.json b/versions/baseline.json index fd75153853..eb52497398 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7434,7 +7434,7 @@ }, "openimageio": { "baseline": "3.1.14.0", - "port-version": 0 + "port-version": 1 }, "openjpeg": { "baseline": "2.5.4", diff --git a/versions/o-/openimageio.json b/versions/o-/openimageio.json index c34d75c0a0..6f4e1e3d59 100644 --- a/versions/o-/openimageio.json +++ b/versions/o-/openimageio.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "648091caae50e7dddcf995b073c560e2fa187cb3", + "version": "3.1.14.0", + "port-version": 1 + }, { "git-tree": "947e6e8fe959efdb060e5b034ac77e5a7939e2b5", "version": "3.1.14.0",