From 73e7dd8f83a5963fa2f4ebe5e36f9827f094e799 Mon Sep 17 00:00:00 2001 From: Aaron Colwell <300262+acolwell@users.noreply.github.com> Date: Sat, 20 Jul 2024 09:27:39 -0700 Subject: [PATCH] Update OpenImageIO to 2.5.13.1 and OpenEXR to 3.2.4 (#983) * Fix Build Installer workflow so it fails when test results don't match 2.5.0 results. * Update OpenImageIO to 2.5.13.1 * Update OpenEXR to 3.2.4 Signed-off-by: Aaron Colwell <300262+acolwell@users.noreply.github.com> --- .github/workflows/build_installer.yml | 1 + .../0006-cmake-soversion.patch | 6 +- .../MINGW-packages/mingw-w64-openexr/PKGBUILD | 30 ++-- ...round-ansidecl-h-PTR-define-conflict.patch | 27 +++ ...01-Fix-building-on-mingw-w64-aarch64.patch | 11 ++ .../mingw-w64-openimageio/PKGBUILD | 100 ++++++----- .../oiio-2.1.10-boost.diff | 20 --- .../oiio-2.2.13.0-c++11.patch | 13 -- .../oiio-2.2.14-libraw.diff | 4 +- .../oiio-2.4.13.0-thread-shutdown.patch | 157 ------------------ .../windows_pacman_repo_version.txt | 2 +- tools/jenkins/genDllVersions.sh | 4 +- 12 files changed, 122 insertions(+), 253 deletions(-) create mode 100644 tools/MINGW-packages/mingw-w64-openimageio/0000-workaround-ansidecl-h-PTR-define-conflict.patch create mode 100644 tools/MINGW-packages/mingw-w64-openimageio/0001-Fix-building-on-mingw-w64-aarch64.patch delete mode 100644 tools/MINGW-packages/mingw-w64-openimageio/oiio-2.1.10-boost.diff delete mode 100644 tools/MINGW-packages/mingw-w64-openimageio/oiio-2.2.13.0-c++11.patch delete mode 100644 tools/MINGW-packages/mingw-w64-openimageio/oiio-2.4.13.0-thread-shutdown.patch diff --git a/.github/workflows/build_installer.yml b/.github/workflows/build_installer.yml index 98c99a6a6b..f31a14b419 100644 --- a/.github/workflows/build_installer.yml +++ b/.github/workflows/build_installer.yml @@ -109,6 +109,7 @@ jobs: echo "Test results match 2.5.0 release : PASS" else echo "Test results match 2.5.0 release : FAILED" + exit 1 fi win-installer-breakpad: diff --git a/tools/MINGW-packages/mingw-w64-openexr/0006-cmake-soversion.patch b/tools/MINGW-packages/mingw-w64-openexr/0006-cmake-soversion.patch index 34bc71db3d..125b1e6dbb 100644 --- a/tools/MINGW-packages/mingw-w64-openexr/0006-cmake-soversion.patch +++ b/tools/MINGW-packages/mingw-w64-openexr/0006-cmake-soversion.patch @@ -17,11 +17,11 @@ Description: OpenEXR image library Version: @OPENEXR_VERSION@ --Libs: @exr_pthread_libs@ -L${libdir} -lOpenEXR${libsuffix} -lOpenEXRUtil${libsuffix} -lOpenEXRCore${libsuffix} -lIex${libsuffix} -lIlmThread${libsuffix} @EXR_DEFLATE_LDFLAGS@ -+Libs: @exr_pthread_libs@ -L${libdir} -lOpenEXR -lOpenEXRUtil -lOpenEXRCore -lIex -lIlmThread @EXR_DEFLATE_LDFLAGS@ +-Libs: @exr_pthread_libs@ -L${libdir} -lOpenEXR${libsuffix} -lOpenEXRUtil${libsuffix} -lOpenEXRCore${libsuffix} -lIex${libsuffix} -lIlmThread${libsuffix} ++Libs: @exr_pthread_libs@ -L${libdir} -lOpenEXR -lOpenEXRUtil -lOpenEXRCore -lIex -lIlmThread Cflags: -I${includedir} -I${OpenEXR_includedir} @exr_pthread_cflags@ Requires: Imath - Libs.private: @zlib_link@ + Requires.private: @EXR_DEFLATE_PKGCONFIG_REQUIRES@ --- a/cmake/OpenEXRLibraryDefine.cmake +++ b/cmake/OpenEXRLibraryDefine.cmake @@ -49,7 +49,9 @@ diff --git a/tools/MINGW-packages/mingw-w64-openexr/PKGBUILD b/tools/MINGW-packages/mingw-w64-openexr/PKGBUILD index dfc2776271..09cb711b01 100644 --- a/tools/MINGW-packages/mingw-w64-openexr/PKGBUILD +++ b/tools/MINGW-packages/mingw-w64-openexr/PKGBUILD @@ -3,12 +3,18 @@ _realname=openexr pkgbase=mingw-w64-natron_${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-natron_${_realname}") -pkgver=3.2.1 +pkgver=3.2.4 pkgrel=99.1 pkgdesc='A high dynamic-range image file format library (mingw-w64)' arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64') url="https://www.openexr.com/" +msys2_repository_url='https://github.com/AcademySoftwareFoundation/openexr' +msys2_references=( + "pypi: OpenEXR" + "cpe: cpe:/a:ilm:openexr" + "cpe: cpe:/a:openexr:openexr" +) license=('spdx:BSD-3-Clause') depends=("${MINGW_PACKAGE_PREFIX}-natron_imath" "${MINGW_PACKAGE_PREFIX}-libdeflate" @@ -28,8 +34,8 @@ replaces=( source=("https://github.com/openexr/openexr/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz" 0006-cmake-soversion.patch 0007-export-TypedAttribute-value.patch) -sha256sums=('61e175aa2203399fb3c8c2288752fbea3c2637680d50b6e306ea5f8ffdd46a9b' - 'a5ce463815e8d05c879dbe6a255e9f8ac2697cd3ef4242dac1e5cb331f78ed02' +sha256sums=('81e6518f2c4656fdeaf18a018f135e96a96e7f66dbe1c1f05860dd94772176cc' + '5653da878ebbf5f3087bb529213931b48e151aef082b34e19d189e22be0411e7' '204777b48cde1c4d390789f10c5e429d5295be701f68a7937a90d0ecf271c048') # Helper macros to help make tasks easier # @@ -59,10 +65,6 @@ build() { extra_config+=("-DCMAKE_BUILD_TYPE=Debug") fi - if [[ ${MINGW_PACKAGE_PREFIX} == *-clang-* ]]; then - extra_config+=("-DOPENEXR_BUILD_TOOLS=OFF") - fi - CXXFLAGS+=" -Wno-ignored-attributes" MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ @@ -72,18 +74,18 @@ build() { ${extra_config[@]} \ -DBUILD_SHARED_LIBS=ON \ -DBUILD_TESTING=OFF \ - -DOPENEXR_INSTALL_EXAMPLES=OFF \ + -DOPENEXR_BUILD_EXAMPLES=OFF \ ../${_realname}-${pkgver} ${MINGW_PREFIX}/bin/cmake --build . } -#check() { -# cd "${srcdir}/build-${MSYSTEM}" -# ${MINGW_PREFIX}/bin/cmake -DBUILD_TESTING=ON ../${_realname}-${pkgver} -# ${MINGW_PREFIX}/bin/cmake --build . -# ${MINGW_PREFIX}/bin/ctest.exe ./ || true -#} +check() { + cd "${srcdir}/build-${MSYSTEM}" + ${MINGW_PREFIX}/bin/cmake -DBUILD_TESTING=ON ../${_realname}-${pkgver} + ${MINGW_PREFIX}/bin/cmake --build . + ${MINGW_PREFIX}/bin/ctest.exe ./ || true +} package() { cd "${srcdir}/build-${MSYSTEM}" diff --git a/tools/MINGW-packages/mingw-w64-openimageio/0000-workaround-ansidecl-h-PTR-define-conflict.patch b/tools/MINGW-packages/mingw-w64-openimageio/0000-workaround-ansidecl-h-PTR-define-conflict.patch new file mode 100644 index 0000000000..0385b3321c --- /dev/null +++ b/tools/MINGW-packages/mingw-w64-openimageio/0000-workaround-ansidecl-h-PTR-define-conflict.patch @@ -0,0 +1,27 @@ +--- a/src/include/OpenImageIO/typedesc.h.orig 2014-01-12 23:34:55.402417300 +0000 ++++ b/src/include/OpenImageIO/typedesc.h 2014-01-12 23:35:17.974708400 +0000 +@@ -47,6 +47,13 @@ + struct OIIO_API TypeDesc { + /// BASETYPE is a simple enum describing the base data types that + /// correspond (mostly) to the C/C++ built-in types. ++// ansidecl.h contains: ++// #if defined (__STDC__) || defined(__cplusplus) .. || defined(_WIN32) ++// "#define PTR void *" ++#ifdef PTR ++#define PTR_OLD_DEFINE PTR ++#undef PTR ++#endif + enum BASETYPE { + UNKNOWN, ///< unknown type + NONE, ///< void/no type +@@ -79,6 +79,10 @@ + PTR, ///< A pointer value. + LASTBASE + }; ++// Set PTR back what it previously contained. ++#ifdef PTR_OLD_DEFINE ++#define PTR PTR_OLD_DEFINE ++#endif + + /// AGGREGATE describes whether our TypeDesc is a simple scalar of one + /// of the BASETYPE's, or one of several simple aggregates. diff --git a/tools/MINGW-packages/mingw-w64-openimageio/0001-Fix-building-on-mingw-w64-aarch64.patch b/tools/MINGW-packages/mingw-w64-openimageio/0001-Fix-building-on-mingw-w64-aarch64.patch new file mode 100644 index 0000000000..5f802ed8e9 --- /dev/null +++ b/tools/MINGW-packages/mingw-w64-openimageio/0001-Fix-building-on-mingw-w64-aarch64.patch @@ -0,0 +1,11 @@ +--- a/src/include/OpenImageIO/simd.h ++++ b/src/include/OpenImageIO/simd.h +@@ -77,7 +77,7 @@ + + #if defined(__CUDA_ARCH__) + // Cuda -- don't include any of these headers +-#elif defined(_WIN32) ++#elif defined(_MSC_VER) || (defined(__MINGW32__) && !defined(__aarch64__)) + # include + #elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) || defined(__e2k__) + # include diff --git a/tools/MINGW-packages/mingw-w64-openimageio/PKGBUILD b/tools/MINGW-packages/mingw-w64-openimageio/PKGBUILD index 83b7dc937e..b94f9eab4f 100644 --- a/tools/MINGW-packages/mingw-w64-openimageio/PKGBUILD +++ b/tools/MINGW-packages/mingw-w64-openimageio/PKGBUILD @@ -3,56 +3,74 @@ _realname=openimageio pkgbase=mingw-w64-natron_${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-natron_${_realname}" -pkgver=2.4.13.0 +pkgver=2.5.13.1 pkgrel=99.1 pkgdesc="A library for reading and writing images, including classes, utilities, and applications (mingw-w64)" arch=('any') -url="http://www.openimageio.org/" -license=("BSD-3") +mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64') +url="https://www.openimageio.org/" +msys2_repository_url="https://github.com/AcademySoftwareFoundation/OpenImageIO" +msys2_references=( + 'archlinux: openimageio' + 'gentoo: media-libs/openimageio' + "cpe: cpe:/a:openimageio:openimageio" +) +license=('spdx:Apache-2.0') depends=("${MINGW_PACKAGE_PREFIX}-boost" + "${MINGW_PACKAGE_PREFIX}-bzip2" "${MINGW_PACKAGE_PREFIX}-freetype" - "${MINGW_PACKAGE_PREFIX}-fmt" - "${MINGW_PACKAGE_PREFIX}-jasper" "${MINGW_PACKAGE_PREFIX}-giflib" + "${MINGW_PACKAGE_PREFIX}-libheif" "${MINGW_PACKAGE_PREFIX}-libjpeg" "${MINGW_PACKAGE_PREFIX}-libpng" "${MINGW_PACKAGE_PREFIX}-natron_libraw-gpl2" - "${MINGW_PACKAGE_PREFIX}-libwebp" "${MINGW_PACKAGE_PREFIX}-libtiff" + "${MINGW_PACKAGE_PREFIX}-libwebp" "${MINGW_PACKAGE_PREFIX}-natron_opencolorio-git" "${MINGW_PACKAGE_PREFIX}-natron_openexr" - "${MINGW_PACKAGE_PREFIX}-libheif" "${MINGW_PACKAGE_PREFIX}-openjpeg2" "${MINGW_PACKAGE_PREFIX}-zlib") -makedepends=("${MINGW_PACKAGE_PREFIX}-cmake" - "${MINGW_PACKAGE_PREFIX}-boost" - "${MINGW_PACKAGE_PREFIX}-cc" - "git") +makedepends=("${MINGW_PACKAGE_PREFIX}-cc" + "${MINGW_PACKAGE_PREFIX}-cmake" + "${MINGW_PACKAGE_PREFIX}-ninja" + "${MINGW_PACKAGE_PREFIX}-fmt" + "${MINGW_PACKAGE_PREFIX}-robin-map") options=('strip' 'buildflags' '!debug') -source=(${_realname}-${pkgver}.tar.gz::https://github.com/OpenImageIO/oiio/archive/v${pkgver}.tar.gz - git+https://github.com/OpenImageIO/oiio-images.git - oiio-2.1.10-boost.diff +source=(https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz + 0000-workaround-ansidecl-h-PTR-define-conflict.patch + 0001-Fix-building-on-mingw-w64-aarch64.patch oiio-2.0.8-invalidatespec.patch oiio-2.2.14-libraw.diff - oiio-2.4.13.0-thread-shutdown.patch # Remove when updating to a future 2.5 release that has these changes. ) -sha256sums=('bb10a7ab6dff5dae2c6d854e9da38136546232235913237e8b1b3c99abb7dd0b' - 'SKIP' - 'e8aec185fd20a6e5cdf77a7155fcaedb301c07bd806f73bd30dfc75af721ac83' +sha256sums=('0fbaec6c15215e11cf4545128c4d64eaa97b461cb9b5fb8a76f9a7d35c99e3df' + '9e4e21333676268a91c0f4e7676aeab7658e5f748e7e5cfe43a92f0fd7931229' + '91bd9a6a07f448a6dd8d1ff9a1c8cefaedb8cdd77029b84b6fc02fe9a7cf71f0' 'd9c2e066ce0e94404d31fd649341cc0ee03faf9b4023dfcdf5cf59fbbf466127' - '89e21326d6445304293bcedc3a52bfa1dfec9b769b397f6a312ca27d1de93423' - '3847eba62ac7a689c4c70b814461583d9c6e921259dd0343b17509d8b35d6f0f' + '59d8b06e11945fd703c1db354457ca2aedda3d48402d89e47f376ff90a17255e' ) +# Helper macros to help make tasks easier # +apply_patch_with_msg() { + for _patch in "$@" + do + msg2 "Applying ${_patch}" + patch -Nbp1 -i "${srcdir}/${_patch}" + done +} + prepare() { cd ${srcdir}/OpenImageIO-${pkgver} - #patch -p0 -i ${srcdir}/oiio-2.1.10-boost.diff - patch -p1 -i ${srcdir}/oiio-2.0.8-invalidatespec.patch - patch -p0 -i ${srcdir}/oiio-2.2.14-libraw.diff - patch -p1 -i ${srcdir}/oiio-2.4.13.0-thread-shutdown.patch + apply_patch_with_msg \ + 0000-workaround-ansidecl-h-PTR-define-conflict.patch \ + 0001-Fix-building-on-mingw-w64-aarch64.patch \ + oiio-2.0.8-invalidatespec.patch \ + oiio-2.2.14-libraw.diff } build() { + [[ -d "${srcdir}"/build-${MSYSTEM} ]] && rm -rf "${srcdir}"/build-${MSYSTEM} + mkdir -p "${srcdir}"/build-${MSYSTEM} && cd "${srcdir}"/build-${MSYSTEM} + declare -a extra_config if check_option "debug" "n"; then extra_config+=("-DCMAKE_BUILD_TYPE=Release") @@ -60,46 +78,44 @@ build() { extra_config+=("-DCMAKE_BUILD_TYPE=Debug") fi - [[ -d "build-${MINGW_CHOST}" ]] && rm -rf "build-${MINGW_CHOST}" - mkdir -p build-${MINGW_CHOST} && cd build-${MINGW_CHOST} - MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ PKG_CONFIG_PATH="${MINGW_PREFIX}/libraw-gpl2/lib/pkgconfig:${PKG_CONFIG_PATH}" \ ${MINGW_PREFIX}/bin/cmake.exe \ -Wno-dev \ - -G"MSYS Makefiles" \ + -G"Ninja" \ -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ - -DUSE_FFMPEG=OFF \ - -DUSE_OPENJPEG=ON \ + -DCMAKE_DLL_NAME_WITH_SOVERSION=ON \ + -DCMAKE_CXX_STANDARD=14 \ -DUSE_FREETYPE=ON \ -DUSE_OPENCV=OFF \ - -DUSE_FIELD3D=OFF \ - -DUSE_OPENSSL=OFF \ + -DUSE_OPENGL=OFF \ + -DUSE_QT=OFF \ + -DUSE_FFMPEG=OFF \ + -DUSE_EXTERNAL_PUGIXML=OFF \ + -DOIIO_BUILD_TESTS=OFF \ + -DBUILD_TESTING=OFF \ + -DSTOP_ON_WARNING=OFF \ -DUSE_GIF=ON \ -DUSE_HEIF=ON \ + -DUSE_OPENJPEG=ON \ -DUSE_LIBRAW=ON \ -DUSE_NUKE=OFF \ - -DSTOP_ON_WARNING=OFF \ -DLibRaw_ROOT="${MINGW_PREFIX}/libraw-gpl2" \ -DBOOST_ROOT=${MINGW_PREFIX} \ -DOpenJPEG_ROOT=${MINGW_PREFIX} \ -DOPENJPEG_INCLUDE_DIR=`pkg-config --variable=includedir libopenjp2` \ - -DUSE_QT=OFF \ -DUSE_PYTHON=OFF \ - -DUSE_PYTHON3=OFF \ -DUSE_PTEX=OFF \ - -DUSE_EXTERNAL_PUGIXML=OFF \ - -DOIIO_BUILD_TESTS=OFF \ - -DCMAKE_CXX_STANDARD=14 \ -DCMAKE_SHARED_LINKER_FLAGS=" -Wl,--export-all-symbols -Wl,--enable-auto-import " \ ${extra_config} \ ../OpenImageIO-${pkgver} - make + + ${MINGW_PREFIX}/bin/cmake --build . } package() { - cd "${srcdir}"/build-${MINGW_CHOST} - #make DESTDIR=${pkgdir} install + cd "${srcdir}"/build-${MSYSTEM} + DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake --install . local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX}) @@ -112,4 +128,6 @@ package() { sed -e "s|${PREFIX_WIN}|\$\{_IMPORT_PREFIX\}|g" -i ${_f} sed -e "s|${MINGW_PREFIX}|\$\{_IMPORT_PREFIX\}|g" -i ${_f} done + + install -Dm644 ${srcdir}/OpenImageIO-${pkgver}/LICENSE.md "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE.md" } diff --git a/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.1.10-boost.diff b/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.1.10-boost.diff deleted file mode 100644 index 0069cf621a..0000000000 --- a/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.1.10-boost.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- src/cmake/externalpackages.cmake.orig 2020-01-13 01:50:20.333267700 +0100 -+++ src/cmake/externalpackages.cmake 2020-01-13 01:53:24.363403800 +0100 -@@ -125,6 +125,8 @@ - else () - if (MSVC) - add_definitions (-DBOOST_ALL_DYN_LINK=1) -+ elseif (MINGW) -+ add_definitions("-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB") - endif () - endif () - if (BOOST_CUSTOM) ---- src/testtex/CMakeLists.txt.orig 2020-01-13 02:03:48.472756200 +0100 -+++ src/testtex/CMakeLists.txt 2020-01-13 02:04:24.872623200 +0100 -@@ -5,5 +5,5 @@ - set (testtex_srcs testtex.cpp) - add_executable (testtex ${testtex_srcs}) - target_include_directories (testtex PRIVATE ${ROBINMAP_INCLUDES}) --target_link_libraries (testtex PRIVATE OpenImageIO) -+target_link_libraries (testtex PRIVATE OpenImageIO ${Boost_SYSTEM_LIBRARY}) - set_target_properties (testtex PROPERTIES FOLDER "Tools") diff --git a/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.2.13.0-c++11.patch b/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.2.13.0-c++11.patch deleted file mode 100644 index ac5982c0d9..0000000000 --- a/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.2.13.0-c++11.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/include/OpenImageIO/hash.h b/src/include/OpenImageIO/hash.h -index 5b1c884a..bfd7eeae 100644 ---- a/src/include/OpenImageIO/hash.h -+++ b/src/include/OpenImageIO/hash.h -@@ -331,7 +331,7 @@ OIIO_HOSTDEVICE inline constexpr uint64_t Uint128High64(const uint128_t x) { - return x.second; - } - --OIIO_HOSTDEVICE inline constexpr uint128_t Uint128(uint64_t lo, uint64_t hi) { -+OIIO_HOSTDEVICE inline OIIO_CONSTEXPR14 uint128_t Uint128(uint64_t lo, uint64_t hi) { - return uint128_t(lo, hi); - } - diff --git a/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.2.14-libraw.diff b/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.2.14-libraw.diff index d264949ed4..a229c7c341 100644 --- a/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.2.14-libraw.diff +++ b/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.2.14-libraw.diff @@ -1,5 +1,5 @@ ---- src/raw.imageio/rawinput.cpp.orig 2021-06-26 18:09:54.016303700 +0200 -+++ src/raw.imageio/rawinput.cpp 2021-06-26 18:13:58.549159600 +0200 +--- a/src/raw.imageio/rawinput.cpp.orig 2021-06-26 18:09:54.016303700 +0200 ++++ b/src/raw.imageio/rawinput.cpp 2021-06-26 18:13:58.549159600 +0200 @@ -368,7 +368,7 @@ m_processor->imgdata.params.user_flip = config.get_int_attribute("raw:user_flip", -1); diff --git a/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.4.13.0-thread-shutdown.patch b/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.4.13.0-thread-shutdown.patch deleted file mode 100644 index 85f6065ee4..0000000000 --- a/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.4.13.0-thread-shutdown.patch +++ /dev/null @@ -1,157 +0,0 @@ -diff --git a/src/include/OpenImageIO/thread.h b/src/include/OpenImageIO/thread.h -index fa66f06de..c6f1b6c38 100644 ---- a/src/include/OpenImageIO/thread.h -+++ b/src/include/OpenImageIO/thread.h -@@ -31,6 +31,7 @@ - #include - - -+#define NATRON_OIIO_HAS_DEFAULT_THREAD_POOL_SHUTDOWN 1 - - // OIIO_THREAD_ALLOW_DCLP, if set to 0, prevents us from using a dodgy - // "double checked lock pattern" (DCLP). We are very careful to construct -@@ -112,11 +113,19 @@ pause(int delay) noexcept - - #elif defined(_MSC_VER) - for (int i = 0; i < delay; ++i) { --# if defined(_WIN64) -- YieldProcessor(); --# else -+ // A reimplementation of winnt.h YieldProcessor, -+ // to avoid including windows headers. -+ #if defined(_M_AMD64) -+ _mm_pause(); -+ #elif defined(_M_ARM64) || defined(_M_HYBRID_X86_ARM64) -+ __dmb(_ARM64_BARRIER_ISHST); -+ __yield(); -+ #elif defined(_M_ARM) -+ __dmb(_ARM_BARRIER_ISHST); -+ __yield(); -+ #else - _asm pause --# endif /* _WIN64 */ -+ #endif - } - - #else -@@ -762,10 +771,18 @@ private: - - - /// Return a reference to the "default" shared thread pool. In almost all --/// ordinary circumstances, you should use this exclusively to get a --/// single shared thread pool, since creating multiple thread pools --/// could result in hilariously over-threading your application. --OIIO_UTIL_API thread_pool* default_thread_pool (); -+/// ordinary circumstances, you should use this exclusively to get a single -+/// shared thread pool, since creating multiple thread pools could result in -+/// hilariously over-threading your application. Note that this call may -+/// (safely, and only once) trigger creation of the thread pool and its -+/// worker threads if it has not yet been created. -+OIIO_UTIL_API thread_pool* default_thread_pool(); -+ -+/// If a thread pool has been created, this call will safely terminate its -+/// worker threads. This should presumably be called by an application -+/// immediately before it exists, when it is confident the thread pool will -+/// no longer be needed. -+OIIO_UTIL_API void default_thread_pool_shutdown(); - - - -diff --git a/src/libutil/thread.cpp b/src/libutil/thread.cpp -index 234e4ceb5..84ce66d32 100644 ---- a/src/libutil/thread.cpp -+++ b/src/libutil/thread.cpp -@@ -35,6 +35,13 @@ - - #include - -+#ifdef _WIN32 -+# define WIN32_LEAN_AND_MEAN -+# define VC_EXTRALEAN -+# define NOMINMAX -+# include -+#endif -+ - #if 0 - - // Use boost::lockfree::queue for the task queue -@@ -151,10 +158,10 @@ public: - this->set_thread(i); - } - } else { // the number of threads is decreased -+ std::vector> terminating_threads; - for (int i = oldNThreads - 1; i >= nThreads; --i) { - *this->flags[i] = true; // this thread will finish -- this->terminating_threads.push_back( -- std::move(this->threads[i])); -+ terminating_threads.push_back(std::move(this->threads[i])); - this->threads.erase(this->threads.begin() + i); - } - { -@@ -162,6 +169,11 @@ public: - std::unique_lock lock(this->mutex); - this->cv.notify_all(); - } -+ // wait for the terminated threads to finish -+ for (auto& thread : terminating_threads) { -+ if (thread->joinable()) -+ thread->join(); -+ } - this->threads.resize( - nThreads); // safe to delete because the threads are detached - this->flags.resize( -@@ -238,16 +250,10 @@ public: - if (thread->joinable()) - thread->join(); - } -- // wait for the terminated threads to finish -- for (auto& thread : this->terminating_threads) { -- if (thread->joinable()) -- thread->join(); -- } - // if there were no threads in the pool but some functors in the queue, the functors are not deleted by the threads - // therefore delete them here - this->clear_queue(); - this->threads.clear(); -- this->terminating_threads.clear(); - this->flags.clear(); - } - -@@ -349,7 +355,6 @@ private: - } - - std::vector> threads; -- std::vector> terminating_threads; - std::vector>> flags; - mutable pvt::ThreadsafeQueue*> q; - std::atomic isDone; -@@ -471,15 +476,29 @@ thread_pool::very_busy() const - - - -+static atomic_int default_thread_pool_created(0); -+ -+ -+ - thread_pool* - default_thread_pool() - { - static std::unique_ptr shared_pool(new thread_pool); -+ default_thread_pool_created = 1; - return shared_pool.get(); - } - - - -+void -+default_thread_pool_shutdown() -+{ -+ if (default_thread_pool_created) -+ default_thread_pool()->resize(0); -+} -+ -+ -+ - void - task_set::wait_for_task(size_t taskindex, bool block) - { diff --git a/tools/MINGW-packages/windows_pacman_repo_version.txt b/tools/MINGW-packages/windows_pacman_repo_version.txt index a56bd6d093..6993b34a24 100644 --- a/tools/MINGW-packages/windows_pacman_repo_version.txt +++ b/tools/MINGW-packages/windows_pacman_repo_version.txt @@ -1 +1 @@ -20240516-1 +20240717-1 diff --git a/tools/jenkins/genDllVersions.sh b/tools/jenkins/genDllVersions.sh index 8dfb636bed..f11f3fa504 100755 --- a/tools/jenkins/genDllVersions.sh +++ b/tools/jenkins/genDllVersions.sh @@ -175,8 +175,8 @@ catDll libopenal- catDll libOpenColorIO catDll libOpenEXR- catDll libOpenEXRCore -catDll libOpenImageIO -catDll libOpenImageIO_Util +catDll libOpenImageIO- +catDll libOpenImageIO_Util- catDll libopenjp2- catDll libopenjph- catDll libopus-