diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake index eadbebd59bf..4a072df3bde 100644 --- a/build_files/build_environment/cmake/harvest.cmake +++ b/build_files/build_environment/cmake/harvest.cmake @@ -85,11 +85,7 @@ else() cmake_policy(SET CMP0009 NEW)\n file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}) \n foreach(f \${shared_libs}) \n - if(IS_SYMLINK \${f})\n - if(APPLE)\n - file(REMOVE_RECURSE \${f}) - endif()\n - else()\n + if((NOT IS_SYMLINK \${f}) OR APPLE)\n execute_process(COMMAND ${set_rpath_cmd} \${f}) \n endif()\n endforeach()") @@ -230,7 +226,7 @@ else() ) harvest(openimagedenoise/include openimagedenoise/include "*") harvest_rpath_lib(openimagedenoise/lib openimagedenoise/lib "*${SHAREDLIBEXT}*") - harvest(openimagedenoise/lib/cmake/OpenImageDenoise-${OIDN_VERSION} openimagedenoise/lib/cmake/OpenImageDenoise "*.cmake") + harvest(openimagedenoise/lib/cmake openimagedenoise/lib/cmake) harvest(embree/include embree/include "*.h") harvest(embree/lib embree/lib "*.a") harvest_rpath_lib(embree/lib embree/lib "*${SHAREDLIBEXT}*") @@ -292,9 +288,9 @@ else() ) harvest(usd/plugin usd/plugin "*") harvest(materialx/include materialx/include "*.h") + harvest(materialx/lib/cmake/MaterialX materialx/lib/cmake/MaterialX "*.cmake") harvest_rpath_lib(materialx/lib materialx/lib "*${SHAREDLIBEXT}*") harvest(materialx/libraries materialx/libraries "*") - harvest(materialx/lib/cmake/MaterialX materialx/lib/cmake/MaterialX "*.cmake") harvest_rpath_python( materialx/python/MaterialX python/lib/python${PYTHON_SHORT_VERSION}/site-packages/MaterialX diff --git a/build_files/build_environment/darwin/set_rpath.py b/build_files/build_environment/darwin/set_rpath.py index 0da7880e548..b0512369f7c 100644 --- a/build_files/build_environment/darwin/set_rpath.py +++ b/build_files/build_environment/darwin/set_rpath.py @@ -6,6 +6,7 @@ # macOS utility to remove all `rpaths` and add a new one. import os +import pathlib import re import subprocess import sys @@ -20,8 +21,28 @@ def strip_lib_version(name): return name +# Patch cmake config to match rename +def update_cmake_config(oldfile, newfile): + for cmakefile in oldfile.parent.glob("cmake/*/*.cmake"): + text = cmakefile.read_text() + text = text.replace(oldfile.name, newfile.name) + cmakefile.write_text(text) + + rpath = sys.argv[1] file = sys.argv[2] +new_file = strip_lib_version(file) + +file = pathlib.Path(file) +new_file = pathlib.Path(new_file) + +# Update cmake config files. +update_cmake_config(file, new_file) + +# Remove if symlink. +if file.is_symlink(): + os.remove(file) + sys.exit(0) # Find existing rpaths and delete them one by one. p = subprocess.run(['otool', '-l', file], capture_output=True) @@ -44,7 +65,6 @@ for i, token in enumerate(tokens): subprocess.run(['install_name_tool', '-change', token, new_token, file]) # Strip version from library itself. -new_file = strip_lib_version(file) -new_id = '@rpath/' + os.path.basename(new_file) +new_id = '@rpath/' + new_file.name os.rename(file, new_file) subprocess.run(['install_name_tool', '-id', new_id, new_file]) diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake index 52a4ec91124..6cf5eef9426 100644 --- a/build_files/cmake/platform/platform_apple.cmake +++ b/build_files/cmake/platform/platform_apple.cmake @@ -174,6 +174,9 @@ if(WITH_CODEC_FFMPEG) if(EXISTS ${LIBDIR}/ffmpeg/lib/libaom.a) list(APPEND FFMPEG_FIND_COMPONENTS aom) endif() + if(EXISTS ${LIBDIR}/ffmpeg/lib/libx265.a) + list(APPEND FFMPEG_FIND_COMPONENTS x265) + endif() if(EXISTS ${LIBDIR}/ffmpeg/lib/libxvidcore.a) list(APPEND FFMPEG_FIND_COMPONENTS xvidcore) endif()