Skip to content

Commit

Permalink
fix(build): Fix recently broken rpath setting (#4618)
Browse files Browse the repository at this point in the history
As part of the recent big python wheel merge, compiler.cmake got changed
in a subtle way in how it sets CMAKE_INSTALL_RPATH.

This broken iv for me on a Mac with dynamic libraries. Strangely (and
I'm too lazy to chase down exactly why), oiiotool seems fine. So this
was missed entirely by the CI, which never runs 'iv', since it's an
interactive app. (Note to self: we should find some way to at least
verify that it can execute as part of the testsuite.)

Anyway, I believe that this change adds the install lib area back to the
path, and it does seem to repair my ability to run iv on my end.

---------

Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
lgritz authored Feb 6, 2025
1 parent c4873d5 commit 1b2ce1d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/cmake/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,8 @@ else ()
else()
set(BASEPOINT $ORIGIN)
endif()
set (CMAKE_INSTALL_RPATH ${BASEPOINT} ${BASEPOINT}/${CMAKE_INSTALL_LIBDIR})
set (CMAKE_INSTALL_RPATH ${BASEPOINT}
${BASEPOINT}/../${CMAKE_INSTALL_LIBDIR})
endif ()
# add the automatically determined parts of the RPATH that
# point to directories outside the build tree to the install RPATH
Expand Down
6 changes: 0 additions & 6 deletions src/cmake/fancy_add_executable.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ macro (fancy_add_executable)
target_link_libraries (${_target_NAME} PRIVATE ${_target_LINK_LIBRARIES})
target_link_libraries (${_target_NAME} PRIVATE ${PROFILER_LIBRARIES})
set_target_properties (${_target_NAME} PROPERTIES FOLDER ${_target_FOLDER})
if (SKBUILD)
# The installed bin and lib directories are at the same level, so we
# need to set the rpath to look for the libraries in ../lib
set_target_properties (${_target_NAME} PROPERTIES
INSTALL_RPATH "$<IF:$<BOOL:${APPLE}>,@loader_path,$ORIGIN>/../${CMAKE_INSTALL_LIBDIR}")
endif ()
check_is_enabled (INSTALL_${_target_NAME} _target_NAME_INSTALL_enabled)
if (CMAKE_UNITY_BUILD AND UNITY_BUILD_MODE STREQUAL GROUP)
set_source_files_properties(${_target_SRC} PROPERTIES
Expand Down
2 changes: 0 additions & 2 deletions src/libutil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ function (setup_oiio_util_library targetname)

if (SKBUILD)
set (PYTHON_SITE_DIR .)
set_target_properties (${targetname} PROPERTIES
INSTALL_RPATH "$<IF:$<BOOL:${APPLE}>,@loader_path,$ORIGIN>/${CMAKE_INSTALL_LIBDIR}")
install_targets (NAMELINK_SKIP ${targetname})
else ()
install_targets (${targetname})
Expand Down

0 comments on commit 1b2ce1d

Please sign in to comment.