diff --git a/cmake/Platform/Mac/RuntimeDependencies_mac.cmake b/cmake/Platform/Mac/RuntimeDependencies_mac.cmake index 169b6d2764..e89dedfc8b 100644 --- a/cmake/Platform/Mac/RuntimeDependencies_mac.cmake +++ b/cmake/Platform/Mac/RuntimeDependencies_mac.cmake @@ -12,18 +12,25 @@ set(LY_RUNTIME_DEPENDENCIES_HEADER " set(anything_new FALSE) +set(plugin_libs) +set(plugin_dirs) function(ly_copy source_file target_directory) + get_filename_component(target_filename \"\${source_file}\" NAME) + get_filename_component(source_file_dir \"\${source_file}\" DIRECTORY) # If source_file is a Framework and target_directory is a bundle if(\"\${source_file}\" MATCHES \".[Ff]ramework\" AND \"\${target_directory}\" MATCHES \".app/Contents/MacOS\") + set(plugin_dirs \"\${plugin_dirs};\${source_file_dir}\" PARENT_SCOPE) return() # skip, it will be fixed with fixup_bundle elseif(\"\${source_file}\" MATCHES \"qt/plugins\" AND \"\${target_directory}\" MATCHES \".app/Contents/MacOS\") # fixup the destination so it ends up in Contents/Plugins - string(REGEX REPLACE \"(.*.app/Contents)/MacOS(.*)\" \"\\\\1/plugins\\\\2\" target_directory \"\${target_directory}\") + set(plugin_dirs \"\${plugin_dirs};\${source_file_dir}\" PARENT_SCOPE) + set(plugin_libs \"\${plugin_libs};\${target_directory}/\${target_filename}\" PARENT_SCOPE) elseif(\"\${source_file}\" MATCHES \"qt/translations\" AND \"\${target_directory}\" MATCHES \".app/Contents/MacOS\") return() # skip + elseif(\"\${source_file}\" MATCHES \".dylib\") + set(plugin_dirs \"\${plugin_dirs};\${source_file_dir}\" PARENT_SCOPE) endif() - get_filename_component(target_filename \"\${source_file}\" NAME) if(NOT \"\${source_file}\" STREQUAL \"\${target_directory}/\${target_filename}\") if(NOT EXISTS \"\${target_directory}\") file(MAKE_DIRECTORY \"\${target_directory}\") @@ -57,7 +64,9 @@ if(@target_file_dir@ MATCHES \".app/Contents/MacOS\") endif() if(anything_new) include(BundleUtilities) - fixup_bundle(\"\${bundle_path}\" \"\" \"\") + list(REMOVE_DUPLICATES plugin_libs) + list(REMOVE_DUPLICATES plugin_dirs) + fixup_bundle(\"\${bundle_path}\" \"\${plugin_libs}\" \"\${plugin_dirs}\") file(TOUCH \"\${timestamp_file}\") endif() endif()