Skip to content

Commit 0738c55

Browse files
build: fix OCIO Windows staging and OIIO/OCIO Imath resolution on RHEL
Fix two build regressions introduced by the find_package dispatcher work: 1. OCIO Windows staging: RV_MAKE_STANDARD_LIB_NAME generates "OpenColorIO.dll" but OCIO builds "OpenColorIO_2.3.dll" (version- suffixed). Fix _libpath to match the actual DLL so TARGET_LIBS staging resolves the correct file. 2. OIIO/OCIO Imath_DIR: hardcoded lib/cmake/Imath is wrong on RHEL/Rocky Linux where GNUInstallDirs sets LIBDIR to lib64. Use RV_DEPS_IMATH_CMAKE_DIR (set in imath.cmake from _lib_dir) which correctly resolves to lib64/cmake/Imath on RHEL. The broken Imath_DIR caused find_dependency(Imath) inside OpenEXRConfig.cmake to fail, surfacing as "OpenEXR not found" in the OIIO sub-build. Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
1 parent 5f25d37 commit 0738c55

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

cmake/dependencies/ocio.cmake

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ IF(RV_TARGET_WINDOWS)
5252
${_bin_dir}/${_ocio_win_sharedlibname}
5353
)
5454
LIST(APPEND _byproducts ${_ocio_win_sharedlib_path})
55+
56+
# Fix _libpath to match the actual version-suffixed DLL name that OCIO produces. RV_MAKE_STANDARD_LIB_NAME generates "OpenColorIO.dll" but OCIO builds
57+
# "OpenColorIO_2.3.dll".
58+
SET(_libpath
59+
${_ocio_win_sharedlib_path}
60+
)
5561
ENDIF()
5662

5763
IF(RV_TARGET_WINDOWS)
@@ -138,8 +144,9 @@ IF(NOT RV_TARGET_WINDOWS)
138144
ENDIF()
139145
LIST(APPEND _configure_options "-DOCIO_PYTHON_VERSION=${RV_DEPS_PYTHON_VERSION_SHORT}")
140146

141-
# Use explicit Imath_DIR for precise config resolution. Works for both built-from-source and found (e.g. Homebrew) packages.
142-
LIST(APPEND _configure_options "-DImath_DIR=${RV_DEPS_IMATH_ROOT_DIR}/lib/cmake/Imath")
147+
# Use explicit Imath_DIR for precise config resolution. Works for both built-from-source and found (e.g. Homebrew) packages. Use RV_DEPS_IMATH_CMAKE_DIR which
148+
# accounts for lib vs lib64 (RHEL) rather than hardcoding lib/.
149+
LIST(APPEND _configure_options "-DImath_DIR=${RV_DEPS_IMATH_CMAKE_DIR}")
143150

144151
LIST(APPEND _configure_options "-DZLIB_ROOT=${RV_DEPS_ZLIB_ROOT_DIR}")
145152

@@ -202,7 +209,7 @@ ELSE() # Windows
202209
"-DZLIB_LIBRARY=${_zlib_library}"
203210
"-DZLIB_INCLUDE_DIR=${_zlib_include_dir}"
204211
"-Dexpat_ROOT=${RV_DEPS_EXPAT_ROOT_DIR}"
205-
"-DImath_DIR=${RV_DEPS_IMATH_ROOT_DIR}/lib/cmake/Imath"
212+
"-DImath_DIR=${RV_DEPS_IMATH_CMAKE_DIR}"
206213
"-DPython_ROOT=${RV_DEPS_BASE_DIR}/RV_DEPS_PYTHON3/install"
207214
# Mandatory param: OCIO CMake code finds Python.
208215
"-DPython_LIBRARY=${RV_DEPS_BASE_DIR}/RV_DEPS_PYTHON3/install/bin/python${PYTHON_VERSION_SHORT_NO_DOT}.lib" # with this param

cmake/dependencies/oiio.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ LIST(APPEND _configure_options "-DUSE_OCIO=0")
5252
LIST(APPEND _configure_options "-DUSE_FREETYPE=0")
5353
LIST(APPEND _configure_options "-DUSE_GIF=OFF")
5454

55-
# Use explicit *_DIR variables pointing directly to config file directories for more precise package resolution.
55+
# Use explicit *_DIR variables pointing directly to config file directories for more precise package resolution. Use RV_DEPS_*_CMAKE_DIR which accounts for lib
56+
# vs lib64 (RHEL) rather than hardcoding lib/.
5657
LIST(APPEND _configure_options "-DBoost_DIR=${RV_DEPS_BOOST_ROOT_DIR}/lib/cmake/Boost-${RV_DEPS_BOOST_VERSION}")
5758
LIST(APPEND _configure_options "-DOpenEXR_ROOT=${RV_DEPS_OPENEXR_ROOT_DIR}")
58-
LIST(APPEND _configure_options "-DImath_DIR=${RV_DEPS_IMATH_ROOT_DIR}/lib/cmake/Imath")
59+
LIST(APPEND _configure_options "-DImath_DIR=${RV_DEPS_IMATH_CMAKE_DIR}")
5960

6061
GET_TARGET_PROPERTY(_png_library PNG::PNG IMPORTED_LOCATION)
6162
GET_TARGET_PROPERTY(_png_include_dir PNG::PNG INTERFACE_INCLUDE_DIRECTORIES)

0 commit comments

Comments
 (0)