ソースを参照

Updates OpenEXR to rev4 and fixes dependency bugs (#8873)

* Updates OpenEXR to Revision 4, which fixes its Find file.  (Fixes #8302 )
* Fixes a bug where missing quotes in our install scripts would
  not correctly interpret a list of target names
* Fixes a bug in the dependency walker function:

The dependency walker function inside RuntimeDependencies_common
assumed that mapped configurations (MAP_IMPORTED_CONFIG_xxxxx) on a
target was a single value like "RELEASE" but it is often a list.

This simplifies and fixes that code so that if a list is supplied
it still functions.  In addition, by default, if no mapping is
specified, we will first try to use IMPORTED_LOCATION_xxxxx where xxxxx
is the one that matches the same config name, and fall back to the
blank default one if not found.

So for example, if no mapping is specified for a given target and
we are in the PROFILE configuration, we'll prefer to use
IMPORTED_LOCATION_PROFILE if present, and if not, fallback to just
IMPORTED_LOCATION.

Signed-off-by: lawsonamzn <[email protected]>
Nicholas Lawson 3 年 前
コミット
82f9458caf

+ 1 - 1
cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake

@@ -36,7 +36,7 @@ ly_associate_package(PACKAGE_NAME qt-5.15.2-rev8-linux
 ly_associate_package(PACKAGE_NAME png-1.6.37-rev2-linux                             TARGETS PNG                         PACKAGE_HASH 5c82945a1648905a5c4c5cee30dfb53a01618da1bf58d489610636c7ade5adf5)
 ly_associate_package(PACKAGE_NAME libsamplerate-0.2.1-rev2-linux                    TARGETS libsamplerate               PACKAGE_HASH 41643c31bc6b7d037f895f89d8d8d6369e906b92eff42b0fe05ee6a100f06261)
 ly_associate_package(PACKAGE_NAME OpenMesh-8.1-rev3-linux                           TARGETS OpenMesh                    PACKAGE_HASH 805bd0b24911bb00c7f575b8c3f10d7ea16548a5014c40811894a9445f17a126)
-ly_associate_package(PACKAGE_NAME OpenEXR-3.1.3-rev2-linux                          TARGETS OpenEXR                     PACKAGE_HASH d6f5fb9b40ccd636537fe69154f4737742eb9e14edf11218644d0a55df87b046)
+ly_associate_package(PACKAGE_NAME OpenEXR-3.1.3-rev4-linux                          TARGETS OpenEXR Imath               PACKAGE_HASH fcbac68cfb4e3b694580bc3741443e111aced5f08fde21a92e0c768e8803c7af)
 ly_associate_package(PACKAGE_NAME DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-linux TARGETS DirectXShaderCompilerDxc    PACKAGE_HASH ac9f98e0e3b07fde0f9bbe1e6daa386da37699819cde06dcc8d3235421f6e977)
 ly_associate_package(PACKAGE_NAME SPIRVCross-2021.04.29-rev1-linux                  TARGETS SPIRVCross                  PACKAGE_HASH 7889ee5460a688e9b910c0168b31445c0079d363affa07b25d4c8aeb608a0b80)
 ly_associate_package(PACKAGE_NAME azslc-1.7.35-rev1-linux                           TARGETS azslc                       PACKAGE_HASH 273484be06dfc25e8da6a6e17937ae69a2efdb0b4c5f105efa83d6ad54d756e5)

+ 1 - 1
cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake

@@ -34,7 +34,7 @@ ly_associate_package(PACKAGE_NAME googletest-1.8.1-rev4-mac
 ly_associate_package(PACKAGE_NAME googlebenchmark-1.5.0-rev2-mac                    TARGETS GoogleBenchmark             PACKAGE_HASH ad25de0146769c91e179953d845de2bec8ed4a691f973f47e3eb37639381f665)
 ly_associate_package(PACKAGE_NAME OpenMesh-8.1-rev3-mac                             TARGETS OpenMesh                    PACKAGE_HASH af92db02a25c1f7e1741ec898f49d81d52631e00336bf9bddd1e191590063c2f)
 ly_associate_package(PACKAGE_NAME OpenSSL-1.1.1m-rev1-mac                           TARGETS OpenSSL                     PACKAGE_HASH 277ee9920e54614bac9f8aaf821ecf0857e535e8b616f4d194476448ba03e363)
-ly_associate_package(PACKAGE_NAME OpenEXR-3.1.3-rev2-mac                            TARGETS OpenEXR                     PACKAGE_HASH af8163d3a92ebf8833ebf61589c5f82ba48d8b5fe42e55693ed6248e540609ef)
+ly_associate_package(PACKAGE_NAME OpenEXR-3.1.3-rev4-mac                            TARGETS OpenEXR Imath               PACKAGE_HASH 927b8ca6cc5815fa8ee4efe6ea2845487cba2540f7958d537692e7c9481a68fc)
 ly_associate_package(PACKAGE_NAME qt-5.15.2-rev7-mac                                TARGETS Qt                          PACKAGE_HASH d3d450e36d22b82e275457ac25c4d2d6fbf04536b952018d4de6a955519fc546)
 ly_associate_package(PACKAGE_NAME png-1.6.37-rev2-mac                               TARGETS PNG                         PACKAGE_HASH 515252226a6958c459f53d8598d80ec4f90df33d2f1637104fd1a636f4962f07)
 ly_associate_package(PACKAGE_NAME libsamplerate-0.2.1-rev2-mac                      TARGETS libsamplerate               PACKAGE_HASH b912af40c0ac197af9c43d85004395ba92a6a859a24b7eacd920fed5854a97fe)

+ 1 - 1
cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake

@@ -21,7 +21,7 @@ ly_associate_package(PACKAGE_NAME xxhash-0.7.4-rev1-multiplatform
 # platform-specific:
 ly_associate_package(PACKAGE_NAME expat-2.4.2-rev2-windows                              TARGETS expat                       PACKAGE_HASH 748d08f21f5339757059a7887e72b52d15e954c549245c638b0b05bd5961e307)
 ly_associate_package(PACKAGE_NAME assimp-5.1.6-rev1-windows                             TARGETS assimplib                   PACKAGE_HASH 299d8a3c70657d74af8841650538e9d083fda9356f6782416edbec0ef5a0493e)
-ly_associate_package(PACKAGE_NAME OpenEXR-3.1.3-rev2-windows                            TARGETS OpenEXR                     PACKAGE_HASH cf7707193d4b1c3dd9de7a940641d7750522fc1079f47fde145f31052206a6f3)
+ly_associate_package(PACKAGE_NAME OpenEXR-3.1.3-rev4-windows                            TARGETS OpenEXR Imath               PACKAGE_HASH c850268e849171751cdaefdab1952333ac38afbb771b999e99d67f9761706d98)
 ly_associate_package(PACKAGE_NAME AWSGameLiftServerSDK-3.4.2-rev1-windows               TARGETS AWSGameLiftServerSDK        PACKAGE_HASH 9d30eb265adc8b46a7f6a9ad122c2d3c8820ca16961533a3cc994734e264969a)
 ly_associate_package(PACKAGE_NAME DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-windows   TARGETS DirectXShaderCompilerDxc    PACKAGE_HASH fdcdc081e67abcfdc8172866258a9c36f1fd0d7b963ba5378ca01cb4fcdbf9c7)
 ly_associate_package(PACKAGE_NAME SPIRVCross-2021.04.29-rev1-windows                    TARGETS SPIRVCross                  PACKAGE_HASH 7d601ea9d625b1d509d38bd132a1f433d7e895b16adab76bac6103567a7a6817)

+ 12 - 10
cmake/Platform/Common/Install_common.cmake

@@ -590,7 +590,7 @@ endif()
 
     set(permutation_builtin_file ${CMAKE_CURRENT_BINARY_DIR}/cmake/3rdParty/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}/BuiltInPackages_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
     file(GENERATE OUTPUT ${permutation_builtin_file}
-        CONTENT ${builtinpackages}
+        CONTENT "${builtinpackages}"
     )
     ly_install(FILES "${permutation_builtin_file}"
         DESTINATION cmake/3rdParty/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}
@@ -611,15 +611,17 @@ function(ly_setup_runtime_dependencies)
         foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES)
             string(TOUPPER ${conf} UCONF)
             ly_install(CODE
-"function(ly_copy source_file target_directory)
-    cmake_path(GET source_file FILENAME target_filename)
-    cmake_path(APPEND full_target_directory \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\" \"\${target_directory}\")
-    cmake_path(APPEND target_file \"\${full_target_directory}\" \"\${target_filename}\")
-    if(\"\${source_file}\" IS_NEWER_THAN \"\${target_file}\")
-        message(STATUS \"Copying \${source_file} to \${full_target_directory}...\")
-        file(COPY \"\${source_file}\" DESTINATION \"\${full_target_directory}\" FILE_PERMISSIONS ${LY_COPY_PERMISSIONS} FOLLOW_SYMLINK_CHAIN)
-        file(TOUCH_NOCREATE \"${target_file}\")
-    endif()
+"function(ly_copy source_files target_directory)
+    foreach(source_file IN LISTS source_files)
+        cmake_path(GET source_file FILENAME target_filename)
+        cmake_path(APPEND full_target_directory \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\" \"\${target_directory}\")
+        cmake_path(APPEND target_file \"\${full_target_directory}\" \"\${target_filename}\")
+        if(\"\${source_file}\" IS_NEWER_THAN \"\${target_file}\")
+            message(STATUS \"Copying \${source_file} to \${full_target_directory}...\")
+            file(COPY \"\${source_file}\" DESTINATION \"\${full_target_directory}\" FILE_PERMISSIONS ${LY_COPY_PERMISSIONS} FOLLOW_SYMLINK_CHAIN)
+            file(TOUCH_NOCREATE \"${target_file}\")
+        endif()
+    endforeach()
 endfunction()"
                 COMPONENT ${LY_INSTALL_PERMUTATION_COMPONENT}_${UCONF}
             )

+ 39 - 24
cmake/Platform/Common/RuntimeDependencies_common.cmake

@@ -121,34 +121,48 @@ function(ly_get_runtime_dependencies ly_RUNTIME_DEPENDENCIES ly_TARGET)
                 set(imported_property IMPORTED_LOCATION)
             endif()
 
+            # The below loop emulates CMake's search for imported locations:
             unset(target_locations)
-            get_target_property(target_locations ${ly_TARGET} ${imported_property})
-            if(target_locations)
-                list(APPEND all_runtime_dependencies "${target_locations}")
-            else()
-                # Check if the property exists for configurations
-                unset(target_locations)
-                foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES)
-                    string(TOUPPER ${conf} UCONF)
-                    unset(current_target_locations)
-                    get_target_property(current_target_locations ${ly_TARGET} ${imported_property}_${UCONF})
-                    if(current_target_locations)
-                        string(APPEND target_locations $<$<CONFIG:${conf}>:${current_target_locations}>)
+            foreach(conf IN LISTS CMAKE_CONFIGURATION_TYPES)
+                string(TOUPPER ${conf} UCONF)
+                # try to use the mapping
+                get_target_property(mapped_conf ${ly_TARGET} MAP_IMPORTED_CONFIG_${UCONF})
+                if(NOT mapped_conf)
+                    # if there's no mapping specified, prefer a matching conf if its available
+                    # and if its not, fall back to the blank/empty one (the semicolon is not a typo)
+                    set(mapped_conf "${UCONF};")
+                endif()
+
+                unset(current_target_locations)
+                # note that mapped_conf is a LIST, we need to iterate the list and find the first one that exists:
+                foreach(check_conf IN LISTS mapped_conf)
+                    # check_conf will either be a string like "RELEASE" or the blank empty string.
+                    if (check_conf)
+                        # a non-empty element indicates to look fro IMPORTED_LOCATION_xxxxxxxxx
+                        get_target_property(current_target_locations ${ly_TARGET} ${imported_property}_${check_conf})
                     else()
-                        # try to use the mapping
-                        get_target_property(mapped_conf ${ly_TARGET} MAP_IMPORTED_CONFIG_${UCONF})
-                        if(mapped_conf)
-                            unset(current_target_locations)
-                            get_target_property(current_target_locations ${ly_TARGET} ${imported_property}_${mapped_conf})
-                            if(current_target_locations)
-                                string(APPEND target_locations $<$<CONFIG:${conf}>:${current_target_locations}>)
-                            endif()
-                        endif()
+                        # an empty element indicates to look at the IMPORTED_LOCATION with no suffix.
+                        get_target_property(current_target_locations ${ly_TARGET} ${imported_property})
+                    endif()
+
+                    if(current_target_locations)
+                        # we need to escape any semicolons, since this could be a list.
+                        string(REPLACE ";" "$<SEMICOLON>" current_target_locations "${current_target_locations}")
+                        string(APPEND target_locations "$<$<CONFIG:${conf}>:${current_target_locations}>")
+                        break() # stop looking after the first one is found (This emulates CMakes behavior)
                     endif()
                 endforeach()
-                if(target_locations)
-                    list(APPEND all_runtime_dependencies ${target_locations})
+                if (NOT current_target_locations)
+                    # we didn't find any locations.
+                    if(NOT target_type STREQUAL "INTERFACE_LIBRARY")
+                        # If you explicitly chose to declare a STATIC library but not supply an imported location
+                        # then its a mistake.
+                        message(FATAL_ERROR "${target_type} Library ${ly_TARGET} specified MAP_IMPORTED_CONFIG_${UCONF} = ${mapped_conf} but did not have any of ${imported_property}_xxxx set")
+                    endif()
                 endif()
+            endforeach()
+            if(target_locations)
+                list(APPEND all_runtime_dependencies ${target_locations})
             endif()
 
         endif()
@@ -266,7 +280,8 @@ function(ly_delayed_generate_runtime_dependencies)
         foreach(runtime_dependency ${runtime_dependencies})
             unset(runtime_command)
             unset(runtime_depend)
-            ly_get_runtime_dependency_command(runtime_command runtime_depend ${runtime_dependency})
+           
+            ly_get_runtime_dependency_command(runtime_command runtime_depend "${runtime_dependency}")
             string(APPEND LY_COPY_COMMANDS ${runtime_command})
             list(APPEND runtime_depends ${runtime_depend})
         endforeach()

+ 21 - 19
cmake/Platform/Common/runtime_dependencies_common.cmake.in

@@ -8,25 +8,27 @@
 
 cmake_policy(SET CMP0012 NEW) # new policy for the if that evaluates a boolean out of "if(NOT ${same_location})"
 
-function(ly_copy source_file target_directory)
-    cmake_path(GET source_file FILENAME target_filename)
-    cmake_path(APPEND target_file "${target_directory}" "${target_filename}")
-    cmake_path(COMPARE "${source_file}" EQUAL "${target_file}" same_location)
-    if(NOT ${same_location})
-        file(LOCK "${target_file}.lock" GUARD FUNCTION TIMEOUT 300)
-        file(SIZE "${source_file}" source_file_size)
-        if(EXISTS "${target_file}")
-            file(SIZE "${target_file}" target_file_size)
-        else()
-            set(target_file_size 0)
-        endif()
-        if((NOT source_file_size EQUAL target_file_size) OR "${source_file}" IS_NEWER_THAN "${target_file}")
-            message(STATUS "Copying \"${source_file}\" to \"${target_directory}\"...")
-            file(MAKE_DIRECTORY "${full_target_directory}")
-            file(COPY "${source_file}" DESTINATION "${target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
-            file(TOUCH_NOCREATE "${target_file}")
-        endif()
-    endif()    
+function(ly_copy source_files target_directory)
+    foreach(source_file IN LISTS source_files)
+        cmake_path(GET source_file FILENAME target_filename)
+        cmake_path(APPEND target_file "${target_directory}" "${target_filename}")
+        cmake_path(COMPARE "${source_file}" EQUAL "${target_file}" same_location)
+        if(NOT ${same_location})
+            file(LOCK "${target_file}.lock" GUARD FUNCTION TIMEOUT 300)
+            file(SIZE "${source_file}" source_file_size)
+            if(EXISTS "${target_file}")
+                file(SIZE "${target_file}" target_file_size)
+            else()
+                set(target_file_size 0)
+            endif()
+            if((NOT source_file_size EQUAL target_file_size) OR "${source_file}" IS_NEWER_THAN "${target_file}")
+                message(STATUS "Copying \"${source_file}\" to \"${target_directory}\"...")
+                file(MAKE_DIRECTORY "${full_target_directory}")
+                file(COPY "${source_file}" DESTINATION "${target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
+                file(TOUCH_NOCREATE "${target_file}")
+            endif()
+        endif()  
+    endforeach() 
 endfunction()
 
 @LY_COPY_COMMANDS@

+ 23 - 21
cmake/Platform/Linux/Install_linux.cmake

@@ -8,29 +8,31 @@
 
 #! ly_setup_runtime_dependencies_copy_function_override: Linux-specific copy function to handle RPATH fixes
 set(ly_copy_template [[
-function(ly_copy source_file target_directory)
-    cmake_path(GET source_file FILENAME target_filename)
-    cmake_path(APPEND full_target_directory "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}" "${target_directory}")
-    cmake_path(APPEND target_file "${full_target_directory}" "${target_filename}")
-    if("${source_file}" IS_NEWER_THAN "${target_file}")
-        message(STATUS "Copying ${source_file} to ${full_target_directory}...")
-        file(MAKE_DIRECTORY "${full_target_directory}")
-        file(COPY "${source_file}" DESTINATION "${full_target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
-        file(TOUCH_NOCREATE "${target_file}")
-        
-        # Special case for install
-        cmake_PATH(GET source_file EXTENSION target_filename_ext)
-        if("${target_filename_ext}" STREQUAL ".so")
-            if("${source_file}" MATCHES "qt/plugins")
-                file(RPATH_CHANGE FILE "${target_file}" OLD_RPATH "\$ORIGIN/../../lib" NEW_RPATH "\$ORIGIN/..")
+function(ly_copy source_files target_directory)
+    foreach(source_file IN LISTS source_files)  
+        cmake_path(GET source_file FILENAME target_filename)
+        cmake_path(APPEND full_target_directory "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}" "${target_directory}")
+        cmake_path(APPEND target_file "${full_target_directory}" "${target_filename}")
+        if("${source_file}" IS_NEWER_THAN "${target_file}")
+            message(STATUS "Copying ${source_file} to ${full_target_directory}...")
+            file(MAKE_DIRECTORY "${full_target_directory}")
+            file(COPY "${source_file}" DESTINATION "${full_target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
+            file(TOUCH_NOCREATE "${target_file}")
+            
+            # Special case for install
+            cmake_PATH(GET source_file EXTENSION target_filename_ext)
+            if("${target_filename_ext}" STREQUAL ".so")
+                if("${source_file}" MATCHES "qt/plugins")
+                    file(RPATH_CHANGE FILE "${target_file}" OLD_RPATH "\$ORIGIN/../../lib" NEW_RPATH "\$ORIGIN/..")
+                endif()
+                if(CMAKE_INSTALL_DO_STRIP)
+                    execute_process(COMMAND @CMAKE_STRIP@ "${target_file}")
+                endif()
+            elseif("${source_file}" MATCHES "lrelease")
+                file(RPATH_CHANGE FILE "${target_file}" OLD_RPATH "\$ORIGIN/../lib" NEW_RPATH "\$ORIGIN")
             endif()
-            if(CMAKE_INSTALL_DO_STRIP)
-                execute_process(COMMAND @CMAKE_STRIP@ "${target_file}")
-            endif()
-        elseif("${source_file}" MATCHES "lrelease")
-            file(RPATH_CHANGE FILE "${target_file}" OLD_RPATH "\$ORIGIN/../lib" NEW_RPATH "\$ORIGIN")
         endif()
-    endif()
+    endforeach()
 endfunction()]])
 
 function(ly_setup_runtime_dependencies_copy_function_override)

+ 26 - 24
cmake/Platform/Linux/runtime_dependencies_linux.cmake.in

@@ -8,33 +8,35 @@
 
 cmake_policy(SET CMP0012 NEW) # new policy for the if that evaluates a boolean out of "if(NOT ${same_location})"
 
-function(ly_copy source_file target_directory)
-    cmake_path(GET source_file FILENAME target_filename)
-    cmake_PATH(GET source_file EXTENSION target_filename_ext)
-    cmake_path(APPEND target_file "${target_directory}" "${target_filename}")
-    cmake_path(COMPARE "${source_file}" EQUAL "${target_file}" same_location)
-    if(NOT ${same_location})
-        file(LOCK "${target_file}.lock" GUARD FUNCTION TIMEOUT 300)
-        file(SIZE "${source_file}" source_file_size)
-        if(EXISTS "${target_file}")
-            file(SIZE "${target_file}" target_file_size)
-        else()
-            set(target_file_size 0)
-        endif()
-        if((NOT source_file_size EQUAL target_file_size) OR "${source_file}" IS_NEWER_THAN "${target_file}")
-            message(STATUS "Copying \"${source_file}\" to \"${target_directory}\"...")
-            file(MAKE_DIRECTORY "${full_target_directory}")
-            file(COPY "${source_file}" DESTINATION "${target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
-            file(TOUCH_NOCREATE "${target_file}")
+function(ly_copy source_files target_directory)
+    foreach(source_file IN LISTS source_files)
+        cmake_path(GET source_file FILENAME target_filename)
+        cmake_PATH(GET source_file EXTENSION target_filename_ext)
+        cmake_path(APPEND target_file "${target_directory}" "${target_filename}")
+        cmake_path(COMPARE "${source_file}" EQUAL "${target_file}" same_location)
+        if(NOT ${same_location})
+            file(LOCK "${target_file}.lock" GUARD FUNCTION TIMEOUT 300)
+            file(SIZE "${source_file}" source_file_size)
+            if(EXISTS "${target_file}")
+                file(SIZE "${target_file}" target_file_size)
+            else()
+                set(target_file_size 0)
+            endif()
+            if((NOT source_file_size EQUAL target_file_size) OR "${source_file}" IS_NEWER_THAN "${target_file}")
+                message(STATUS "Copying \"${source_file}\" to \"${target_directory}\"...")
+                file(MAKE_DIRECTORY "${full_target_directory}")
+                file(COPY "${source_file}" DESTINATION "${target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
+                file(TOUCH_NOCREATE "${target_file}")
 
-            # Special case, shared libraries that are copied from qt/plugins have their RPATH set to \$ORIGIN/../../lib 
-            # which is the correct relative path based on the source location. But when we copy it to their subfolder, 
-            # the rpath needs to be adjusted to the parent ($ORIGIN/..)
-            if("${source_file}" MATCHES "qt/plugins" AND "${target_filename_ext}" STREQUAL ".so")
-                file(RPATH_CHANGE FILE "${target_file}" OLD_RPATH "\$ORIGIN/../../lib" NEW_RPATH "\$ORIGIN/..")
+                # Special case, shared libraries that are copied from qt/plugins have their RPATH set to \$ORIGIN/../../lib 
+                # which is the correct relative path based on the source location. But when we copy it to their subfolder, 
+                # the rpath needs to be adjusted to the parent ($ORIGIN/..)
+                if("${source_file}" MATCHES "qt/plugins" AND "${target_filename_ext}" STREQUAL ".so")
+                    file(RPATH_CHANGE FILE "${target_file}" OLD_RPATH "\$ORIGIN/../../lib" NEW_RPATH "\$ORIGIN/..")
+                endif()
             endif()
         endif()
-    endif()    
+    endforeach()
 endfunction()
 
 @LY_COPY_COMMANDS@

+ 29 - 29
cmake/Platform/Mac/InstallUtils_mac.cmake.in

@@ -128,39 +128,39 @@ function(codesign_python_framework_binaries framework_path)
 
 endfunction()
 
-function(ly_copy source_file target_directory)
-    
-    if("${source_file}" MATCHES "\\.[Ff]ramework")
-
-        # fixup origin to copy the whole Framework folder
-        string(REGEX REPLACE "(.*\\.[Ff]ramework).*" "\\1" source_file "${source_file}")
+function(ly_copy source_files target_directory)
+    foreach(source_file IN LISTS source_files)
+        if("${source_file}" MATCHES "\\.[Ff]ramework")
 
-    endif()
+            # fixup origin to copy the whole Framework folder
+            string(REGEX REPLACE "(.*\\.[Ff]ramework).*" "\\1" source_file "${source_file}")
 
-    cmake_path(GET source_file FILENAME target_filename)
-    cmake_path(APPEND full_target_directory "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}" "${target_directory}")
-    cmake_path(APPEND target_file "${full_target_directory}" "${target_filename}")
-    
-    if("${source_file}" IS_NEWER_THAN "${target_file}")
-        message(STATUS "Copying ${source_file} to ${full_target_directory}...")
-        file(MAKE_DIRECTORY "${full_target_directory}")
-        file(COPY "${source_file}" DESTINATION "${full_target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
-        file(TOUCH_NOCREATE "${target_file}")
-
-        # Our Qt and Python frameworks aren't in the correct bundle format to be codesigned.
-        if("${target_filename}" MATCHES "(Qt[^.]+)\\.[Ff]ramework")
-            fixup_qt_framework(${CMAKE_MATCH_1} "${target_file}")
-            # For some Qt frameworks(QtCore), signing the bundle doesn't work because of bundle
-            # format issues(despite the fixes above). But once we've patched the framework above, there's
-            # only one executable that we need to sign so we can do it directly.
-            set(target_filename "${target_filename}/Versions/5/${CMAKE_MATCH_1}")
-        elseif("${target_filename}" MATCHES "Python.framework")
-            fixup_python_framework("${target_file}")
-            codesign_python_framework_binaries("${target_file}")
         endif()
-        codesign_file("${target_file}" "none")
-    endif()
 
+        cmake_path(GET source_file FILENAME target_filename)
+        cmake_path(APPEND full_target_directory "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}" "${target_directory}")
+        cmake_path(APPEND target_file "${full_target_directory}" "${target_filename}")
+        
+        if("${source_file}" IS_NEWER_THAN "${target_file}")
+            message(STATUS "Copying ${source_file} to ${full_target_directory}...")
+            file(MAKE_DIRECTORY "${full_target_directory}")
+            file(COPY "${source_file}" DESTINATION "${full_target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
+            file(TOUCH_NOCREATE "${target_file}")
+
+            # Our Qt and Python frameworks aren't in the correct bundle format to be codesigned.
+            if("${target_filename}" MATCHES "(Qt[^.]+)\\.[Ff]ramework")
+                fixup_qt_framework(${CMAKE_MATCH_1} "${target_file}")
+                # For some Qt frameworks(QtCore), signing the bundle doesn't work because of bundle
+                # format issues(despite the fixes above). But once we've patched the framework above, there's
+                # only one executable that we need to sign so we can do it directly.
+                set(target_filename "${target_filename}/Versions/5/${CMAKE_MATCH_1}")
+            elseif("${target_filename}" MATCHES "Python.framework")
+                fixup_python_framework("${target_file}")
+                codesign_python_framework_binaries("${target_file}")
+            endif()
+            codesign_file("${target_file}" "none")
+        endif()
+    endforeach()
 endfunction()
 
 function(ly_download_and_codesign_sdk_python)

+ 90 - 89
cmake/Platform/Mac/runtime_dependencies_mac.cmake.in

@@ -51,112 +51,113 @@ function(ly_is_newer_than file1 file2 is_newer)
 
 endfunction()
 
-function(ly_copy source_file target_directory)
-    
-    cmake_path(GET source_file FILENAME target_filename)
-    
-    # If target_directory is a bundle
-    if("${target_directory}" MATCHES "\\.app/Contents/MacOS")
-
-        set(target_is_bundle TRUE)
-        if("${source_file}" MATCHES "\\.[Ff]ramework[^\\.]")
-
-            if(NOT @LY_BUILD_FIXUP_BUNDLE@)
-                return()
-            endif()
-
-            # fixup origin to copy the whole Framework folder and change destination to Contents/Frameworks
-            string(REGEX REPLACE "(.*\\.[Ff]ramework).*" "\\1" source_file "${source_file}")
-            get_filename_component(source_file_folder "${source_file}" DIRECTORY)
+function(ly_copy source_files target_directory)
+    foreach(source_file IN LISTS source_files)
+        cmake_path(GET source_file FILENAME target_filename)
+        
+        # If target_directory is a bundle
+        if("${target_directory}" MATCHES "\\.app/Contents/MacOS")
+
+            set(target_is_bundle TRUE)
+            if("${source_file}" MATCHES "\\.[Ff]ramework[^\\.]")
+
+                if(NOT @LY_BUILD_FIXUP_BUNDLE@)
+                    return()
+                endif()
+
+                # fixup origin to copy the whole Framework folder and change destination to Contents/Frameworks
+                string(REGEX REPLACE "(.*\\.[Ff]ramework).*" "\\1" source_file "${source_file}")
+                get_filename_component(source_file_folder "${source_file}" DIRECTORY)
+
+                # Python.framework produces a bug in BundleUtilities so it needs manual handling
+                # https://gitlab.kitware.com/cmake/cmake/-/issues/20165
+                if("${source_file}" MATCHES "Python.framework")
+                    # fixup the destination so it ends up in Contents/Frameworks
+                    string(REGEX REPLACE "(.*\\.app/Contents)/MacOS" "\\1/Frameworks" target_directory "${target_directory}")
+                    set(local_plugin_dirs ${plugin_dirs})
+                    list(APPEND local_plugin_dirs "${target_directory}/Python.framework")
+                    set(target_filename Python.framework)
+                    set(plugin_dirs ${local_plugin_dirs} PARENT_SCOPE)
+                    set(depends_on_python TRUE PARENT_SCOPE)
+                else()
+                    set(local_plugin_dirs ${plugin_dirs})
+                    list(APPEND local_plugin_dirs "${source_file_folder}")
+                    set(plugin_dirs ${local_plugin_dirs} PARENT_SCOPE)
+                    return()
+                endif()
+
+            elseif("${source_file}" MATCHES "qt/plugins")
+
+                if(NOT @LY_BUILD_FIXUP_BUNDLE@)
+                    return()
+                endif()
+
+                # fixup the destination so it ends up in Contents/PlugIns
+                string(REGEX REPLACE "(.*\\.app/Contents)/MacOS" "\\1/PlugIns" target_directory "${target_directory}")
 
-            # Python.framework produces a bug in BundleUtilities so it needs manual handling
-            # https://gitlab.kitware.com/cmake/cmake/-/issues/20165
-            if("${source_file}" MATCHES "Python.framework")
-                # fixup the destination so it ends up in Contents/Frameworks
-                string(REGEX REPLACE "(.*\\.app/Contents)/MacOS" "\\1/Frameworks" target_directory "${target_directory}")
                 set(local_plugin_dirs ${plugin_dirs})
-                list(APPEND local_plugin_dirs "${target_directory}/Python.framework")
-                set(target_filename Python.framework)
+                list(APPEND local_plugin_dirs "${target_directory}")
                 set(plugin_dirs ${local_plugin_dirs} PARENT_SCOPE)
-                set(depends_on_python TRUE PARENT_SCOPE)
-            else()
+                set(local_plugin_libs ${plugin_libs})
+                list(APPEND local_plugin_libs "${target_directory}/${target_filename}")
+                set(plugin_libs ${local_plugin_libs} PARENT_SCOPE)
+
+            elseif("${source_file}" MATCHES "qt/translations")
+
+                return() # skip, is this used?
+            
+            elseif("${source_file}" MATCHES ".dylib")
+                
                 set(local_plugin_dirs ${plugin_dirs})
-                list(APPEND local_plugin_dirs "${source_file_folder}")
+                list(APPEND local_plugin_dirs "${target_directory}")
                 set(plugin_dirs ${local_plugin_dirs} PARENT_SCOPE)
-                return()
-            endif()
 
-        elseif("${source_file}" MATCHES "qt/plugins")
-
-            if(NOT @LY_BUILD_FIXUP_BUNDLE@)
-                return()
             endif()
-
-            # fixup the destination so it ends up in Contents/PlugIns
-            string(REGEX REPLACE "(.*\\.app/Contents)/MacOS" "\\1/PlugIns" target_directory "${target_directory}")
-
-            set(local_plugin_dirs ${plugin_dirs})
-            list(APPEND local_plugin_dirs "${target_directory}")
-            set(plugin_dirs ${local_plugin_dirs} PARENT_SCOPE)
-            set(local_plugin_libs ${plugin_libs})
-            list(APPEND local_plugin_libs "${target_directory}/${target_filename}")
-            set(plugin_libs ${local_plugin_libs} PARENT_SCOPE)
-
-        elseif("${source_file}" MATCHES "qt/translations")
-
-            return() # skip, is this used?
         
-        elseif("${source_file}" MATCHES ".dylib")
+        else()
             
-            set(local_plugin_dirs ${plugin_dirs})
-            list(APPEND local_plugin_dirs "${target_directory}")
-            set(plugin_dirs ${local_plugin_dirs} PARENT_SCOPE)
-
-        endif()
-    
-    else()
-        
-        # target is not a bundle
-        set(target_is_bundle FALSE)
-        if("${source_file}" MATCHES "\\.[Ff]ramework[^\\.]")
+            # target is not a bundle
+            set(target_is_bundle FALSE)
+            if("${source_file}" MATCHES "\\.[Ff]ramework[^\\.]")
 
-            # fixup origin to copy the whole Framework folder
-            string(REGEX REPLACE "(.*\\.[Ff]ramework).*" "\\1" source_file "${source_file}")
-            get_filename_component(target_filename "${source_file}" NAME)
+                # fixup origin to copy the whole Framework folder
+                string(REGEX REPLACE "(.*\\.[Ff]ramework).*" "\\1" source_file "${source_file}")
+                get_filename_component(target_filename "${source_file}" NAME)
 
-            if("${source_file}" MATCHES "Python.framework")
-                set(depends_on_python TRUE PARENT_SCOPE)
+                if("${source_file}" MATCHES "Python.framework")
+                    set(depends_on_python TRUE PARENT_SCOPE)
+                endif()
+            
             endif()
-        
-        endif()
-
-    endif()
 
-    cmake_path(APPEND target_file "${target_directory}" "${target_filename}")
-    cmake_path(COMPARE "${source_file}" EQUAL "${target_file}" same_location)
-    if(NOT ${same_location})
-        if(NOT EXISTS "${target_directory}")
-            file(MAKE_DIRECTORY "${target_directory}")
         endif()
 
-        unset(is_source_newer)
+        cmake_path(APPEND target_file "${target_directory}" "${target_filename}")
+        cmake_path(COMPARE "${source_file}" EQUAL "${target_file}" same_location)
+        if(NOT ${same_location})
+            if(NOT EXISTS "${target_directory}")
+                file(MAKE_DIRECTORY "${target_directory}")
+            endif()
 
-        # ly_is_newer_than will be true if:
-        # 1. The source library was rebuilt.
-        # 2. The library is a 3rdParty lib and it was downloaded after the target was copied.
-        # 3. The library is being copied over for the first time(target does not exist).
-        # While downloaded 3rdParty libs will have the creation time set to when it was built,
-        # their modification time will reflect the time it was downloaded.
-        ly_is_newer_than(${source_file} ${target_file} is_source_newer)
-        
-        if(${is_source_newer})
-            message(STATUS "Copying \"${source_file}\" to \"${target_directory}\"...")
-            file(MAKE_DIRECTORY "${target_directory}")
-            file(COPY "${source_file}" DESTINATION "${target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
-            file(TOUCH_NOCREATE "${target_file}")
-            set(anything_new TRUE PARENT_SCOPE)
+            unset(is_source_newer)
+
+            # ly_is_newer_than will be true if:
+            # 1. The source library was rebuilt.
+            # 2. The library is a 3rdParty lib and it was downloaded after the target was copied.
+            # 3. The library is being copied over for the first time(target does not exist).
+            # While downloaded 3rdParty libs will have the creation time set to when it was built,
+            # their modification time will reflect the time it was downloaded.
+            ly_is_newer_than(${source_file} ${target_file} is_source_newer)
+            
+            if(${is_source_newer})
+                message(STATUS "Copying \"${source_file}\" to \"${target_directory}\"...")
+                file(MAKE_DIRECTORY "${target_directory}")
+                file(COPY "${source_file}" DESTINATION "${target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
+                file(TOUCH_NOCREATE "${target_file}")
+                set(anything_new TRUE PARENT_SCOPE)
+            endif()
         endif()
-    endif()
+    endforeach()
 endfunction()
 
 @LY_COPY_COMMANDS@

+ 1 - 1
cmake/Projects.cmake

@@ -115,7 +115,7 @@ function(ly_generate_project_build_path_setreg project_real_path)
     set(project_bin_path ${CMAKE_BINARY_DIR})
     string(CONFIGURE ${project_build_path_template} project_build_path_setreg_content @ONLY)
     set(project_user_build_path_setreg_file ${project_real_path}/user/Registry/Platform/${PAL_PLATFORM_NAME}/build_path.setreg)
-    file(GENERATE OUTPUT ${project_user_build_path_setreg_file} CONTENT ${project_build_path_setreg_content})
+    file(GENERATE OUTPUT ${project_user_build_path_setreg_file} CONTENT "${project_build_path_setreg_content}")
 endfunction()
 
 function(install_project_asset_artifacts project_real_path)

+ 1 - 1
cmake/TestImpactFramework/LYTestImpactFramework.cmake

@@ -433,7 +433,7 @@ function(ly_test_impact_write_config_file CONFIG_TEMPLATE_FILE BIN_DIR)
     # Write out entire config contents to a file in the build directory of the test impact framework console target
     file(GENERATE
         OUTPUT "${LY_TEST_IMPACT_CONFIG_FILE_PATH}" 
-        CONTENT ${config_file}
+        CONTENT "${config_file}"
     )
 
     message(DEBUG "Test impact framework post steps complete")

+ 1 - 1
cmake/UnitTest.cmake

@@ -99,6 +99,6 @@ function(ly_delayed_generate_unit_test_module_registry)
     list(JOIN target_test_dependencies_names ",\n" target_test_dependencies_names)
     string(CONFIGURE ${test_json_template} testrunner_json @ONLY)
     set(dependencies_setreg ${CMAKE_BINARY_DIR}/unit_test_modules.json)
-    file(GENERATE OUTPUT ${dependencies_setreg} CONTENT ${testrunner_json})
+    file(GENERATE OUTPUT ${dependencies_setreg} CONTENT "${testrunner_json}")
 
 endfunction()