runtime_dependencies_mac.cmake.in 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. #
  2. # Copyright (c) Contributors to the Open 3D Engine Project.
  3. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. #
  5. # SPDX-License-Identifier: Apache-2.0 OR MIT
  6. #
  7. #
  8. cmake_minimum_required(VERSION 3.22)
  9. function(gp_resolve_item_override context item exepath dirs resolved_item_var resolved_var)
  10. # Qt frameworks could resolve the binary to eg qt/lib/QtCore.framework/Headers/QtCore instead of qt/lib/QtCore.framework/Versions/5/QtCore
  11. # This is because GetPrerequisites.cmake gp_resolve_item function searches for the first file that matches the "frameworks name"
  12. if(${${resolved_var}} AND ${item} MATCHES "/(Qt[^\\.]+\\.framework)/(.*)")
  13. set(qt_framework ${CMAKE_MATCH_1})
  14. set(qt_framework_subpath ${CMAKE_MATCH_2})
  15. string(REGEX REPLACE "(.*)/(Qt[^\\.]+\\.framework)/(.*)" "\\1/\\2/${qt_framework_subpath}" new_resolved_item "${${resolved_item_var}}")
  16. set(${resolved_item_var} ${new_resolved_item} PARENT_SCOPE)
  17. elseif(NOT ${resolved_var})
  18. cmake_path(GET item FILENAME source_filename)
  19. cmake_path(COMPARE "${source_filename}" EQUAL "libdxcompiler.3.7.dylib" is_libdirectx_shader_compiler)
  20. cmake_path(COMPARE "${source_filename}" EQUAL "Python" is_python)
  21. if(is_libdirectx_shader_compiler)
  22. unset(resolved_filepath)
  23. cmake_path(APPEND resolved_filepath "${target_file_dir}" "Builders/DirectXShaderCompiler/bin/dxc-3.7")
  24. set(${resolved_item_var} "${resolved_filepath}" PARENT_SCOPE)
  25. set(${resolved_var} TRUE PARENT_SCOPE)
  26. message(STATUS "Custom resolving file ${item} -> ${resolved_filepath}")
  27. elseif(is_python)
  28. unset(resolved_filepath)
  29. cmake_path(APPEND resolved_filepath "${target_bundle_framework_dir}" "Python.framework/Versions/3.10/Python")
  30. set(${resolved_item_var} "${resolved_filepath}" PARENT_SCOPE)
  31. set(${resolved_var} TRUE PARENT_SCOPE)
  32. message(STATUS "Custom resolving file ${item} -> ${resolved_filepath}")
  33. endif()
  34. endif()
  35. endfunction()
  36. include(BundleUtilities)
  37. cmake_policy(SET CMP0012 NEW) # new policy for the if that evaluates a boolean out of the LY_BUILD_FIXUP_BUNDLE expansion
  38. cmake_policy(SET CMP0009 NEW) # do not traverse symlinks on GLOB_RECURSE
  39. # Stores a set of executable, dylib and frameworks to ignore for fixup bundle
  40. set_property(SOURCE "${CMAKE_CURRENT_LIST_FILE}" PROPERTY BUNDLE_IGNORE_FILES
  41. "Python;python3.10m;python3.10;dxc-3.7;dxc;dxsc-3.7;dxsc;libdxcompiler.3.7.dylib;libdxcompiler.dylib")
  42. # Values configured for the output locations of the target
  43. # Gathered from the generator expression for TARGET_FILE_DIR, TARGET_BUNDLE_DIR
  44. # and TARGET_BUNDLE_CONTENT_DIR
  45. cmake_path(SET target_file_dir "@target_file_dir@")
  46. cmake_path(SET target_bundle_dir "@target_bundle_dir@")
  47. # The parent of the bundle directory contains the bundle.app file
  48. # It should be the same as the TARGET_FILE_DIR for a non-bundle
  49. cmake_path(GET target_bundle_dir PARENT_PATH target_bundle_parent_dir)
  50. cmake_path(SET target_bundle_content_dir "@target_bundle_content_dir@")
  51. set(target_copy_files $<FILTER:$<REMOVE_DUPLICATES:"@target_copy_files@">,EXCLUDE,"^$">)
  52. set(target_target_files $<FILTER:$<REMOVE_DUPLICATES:"@target_target_files@">,EXCLUDE,"^$">)
  53. set(target_link_files $<FILTER:$<REMOVE_DUPLICATES:"@target_link_files@">,EXCLUDE,"^$">)
  54. set(target_imported_files $<FILTER:$<REMOVE_DUPLICATES:"@target_imported_files@">,EXCLUDE,"^$">)
  55. # Set the Frameworks directory using the <bundle-content-dir> as the root
  56. unset(target_bundle_framework_dir)
  57. cmake_path(APPEND target_bundle_framework_dir "${target_bundle_content_dir}" "Frameworks")
  58. unset(target_bundle_plugins_dir)
  59. cmake_path(APPEND target_bundle_plugins_dir "${target_bundle_content_dir}" "PlugIns")
  60. find_program(LY_INSTALL_NAME_TOOL install_name_tool)
  61. if (NOT LY_INSTALL_NAME_TOOL)
  62. message(FATAL_ERROR "Unable to locate 'install_name_tool'")
  63. endif()
  64. # IS_NEWER_THAN returns true if:
  65. # 1. file1 is newer than file2
  66. # 2. Either file1 or file2 do not exist
  67. # 3. If both files have the same timestamp
  68. # We would like it to return false if the mod times are the same.
  69. function(ly_is_newer_than file1 file2 is_newer)
  70. set(${is_newer} FALSE PARENT_SCOPE)
  71. if("${file1}" IS_NEWER_THAN "${file2}")
  72. file(TIMESTAMP "${file1}" file1_mod_time)
  73. file(TIMESTAMP "${file2}" file2_mod_time)
  74. # note that the above modtimes will come thru in string format
  75. # like "2022-06-09T14:21:30" - not as numbers, so use STREQUAL
  76. if (NOT "${file1_mod_time}" STREQUAL "${file2_mod_time}")
  77. set(${is_newer} TRUE PARENT_SCOPE)
  78. endif()
  79. endif()
  80. endfunction()
  81. function(o3de_copy_file_to_bundle)
  82. set(options)
  83. set(oneValueArgs SOURCE_FILE SOURCE_TYPE SOURCE_GEM_MODULE RELATIVE_TARGET_DIRECTORY)
  84. set(multiValueArgs)
  85. cmake_parse_arguments("${CMAKE_CURRENT_FUNCTION}" "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
  86. cmake_path(SET source_file NORMALIZE "${${CMAKE_CURRENT_FUNCTION}_SOURCE_FILE}")
  87. set(source_type "${${CMAKE_CURRENT_FUNCTION}_SOURCE_TYPE}")
  88. set(source_is_gem "${${CMAKE_CURRENT_FUNCTION}_SOURCE_GEM_MODULE}")
  89. cmake_path(SET relative_target_directory NORMALIZE "${${CMAKE_CURRENT_FUNCTION}_RELATIVE_TARGET_DIRECTORY}")
  90. # Use the final component of the source file has the target_filename
  91. cmake_path(GET source_file FILENAME target_filename)
  92. if("${source_file}" MATCHES "qt/translations")
  93. # Do not copy QT translation files to bundle
  94. return()
  95. endif()
  96. string(REGEX MATCH "\\.dylib$" is_dylib "${source_file}")
  97. string(REGEX MATCH "^(.*\\.[Ff]ramework)(/.*|$)" is_framework "${source_file}")
  98. # If the source file is in a framework, get it's framework directory
  99. if(is_framework)
  100. set(source_framework_directory ${CMAKE_MATCH_1})
  101. endif()
  102. string(REGEX MATCH "qt/plugins" is_qt_plugin "${source_file}")
  103. # Option to indicate if a manual copy to the bundle should take place
  104. set(explicit_copy_to_bundle TRUE)
  105. ## Get the full target path based on the dependency type
  106. # Link time dylib dependencies should go into the Contents/Frameworks folder according to the
  107. # Apple Placing Content in a Bundle page
  108. # https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle#3875930
  109. if(is_qt_plugin)
  110. # Plugins need to be copied into the bundle "PlugIns" before running fixup_bundle on them
  111. # https://cmake.org/cmake/help/latest/module/BundleUtilities.html?highlight=bundleutilities#bundleutilities
  112. unset(target_file)
  113. # set the target file QT plugins to be inside <bundle-content-dir>/PlugIns directory
  114. cmake_path(APPEND target_file "${target_bundle_plugins_dir}" "${relative_target_directory}" "${target_filename}")
  115. elseif(is_framework)
  116. cmake_path(GET source_framework_directory FILENAME source_framework_filename)
  117. unset(target_file)
  118. cmake_path(APPEND target_file "${target_bundle_framework_dir}" "${source_framework_filename}")
  119. # Python.framework produces a bug in BundleUtilities so it needs manual handling
  120. # https://gitlab.kitware.com/cmake/cmake/-/issues/20165
  121. # if the source file being copied is from the Python framework
  122. # copy the entire Python.framework folder to the <bundle-app/Conents/Frameworks directory
  123. cmake_path(COMPARE "${source_framework_filename}" EQUAL "Python.framework" is_python_framework)
  124. if(is_python_framework)
  125. set_property(SOURCE "${CMAKE_CURRENT_LIST_FILE}" PROPERTY DEPENDS_ON_PYTHON TRUE)
  126. ly_is_newer_than("${source_framework_directory}" "${target_file}" is_python_newer)
  127. # If 3rdParty python is newer it needs to be removed before copying it to the bundle.
  128. # Otherwise the copy would file to do a previous invovation of this script
  129. # creating symlinks to the "Python.framework/Versions/3.10/Headers" directory
  130. # Because the source framework has real "Headers" directory the copy would fail
  131. # with the following error
  132. # file COPY cannot make directory
  133. # "<build-dir>/bin/profile/AssetProcessor.app/Contents/Frameworks/Python.framework/Versions/3.10/Headers":
  134. # No such file or directory.
  135. if (is_python_newer)
  136. file(REMOVE_RECURSE "${target_file}")
  137. endif()
  138. else()
  139. # Do not copy other Frameworks to the bundle manually
  140. set(explicit_copy_to_bundle FALSE)
  141. endif()
  142. elseif("${source_file}" IN_LIST target_copy_files OR "${source_file}" IN_LIST target_imported_files)
  143. unset(target_file)
  144. # copy the file dependencies to the directory relative to the <bundle-app>/Content/MacOS directory
  145. # imported dependencies refer to the IMPORTED_LOCATION property of the TARGET, so those
  146. # should also be copied to the <bundle-dir>/Content/MacOS if they are not a dylib
  147. if(is_dylib)
  148. # fixup bundle expects raw .dylib files to be directly under the <bundle-app>/Content/Framework folder
  149. # So don't add relative_target_directory as part of the target file path
  150. cmake_path(APPEND target_file "${target_bundle_framework_dir}" "${target_filename}")
  151. else()
  152. cmake_path(APPEND target_file "${target_file_dir}" "${relative_target_directory}" "${target_filename}")
  153. endif()
  154. elseif("${source_file}" IN_LIST target_link_files)
  155. unset(target_file)
  156. # copy the link dependencies to the <bundle-app>/Content/Frameworks directory
  157. cmake_path(APPEND target_file "${target_bundle_framework_dir}" "${relative_target_directory}" "${target_filename}")
  158. elseif("${source_file}" IN_LIST target_target_files)
  159. unset(target_file)
  160. # copy the target dependencies to the directory containing the bundle
  161. cmake_path(APPEND target_file "${target_bundle_parent_dir}" "${relative_target_directory}" "${target_filename}")
  162. if(is_dylib)
  163. # These are dynamic load dependencies that are triggered by the application,
  164. # they should not be copied to the bundle
  165. set(explicit_copy_to_bundle FALSE)
  166. endif()
  167. endif()
  168. # Set the target directory to be the parent of the target_file
  169. cmake_path(GET target_file PARENT_PATH target_directory)
  170. # Any ignored files are skipped from the bundle
  171. get_property(bundle_files_to_ignore SOURCE "${CMAKE_CURRENT_LIST_FILE}" PROPERTY BUNDLE_IGNORE_FILES)
  172. # dylibs and frameworks are passed to fixup bundle
  173. # Ignored files are based only on the filename path segment and not the full path
  174. # So the ${target_filename} variable is the one being checked in this case
  175. if((is_dylib OR is_framework) AND NOT "${target_filename}" IN_LIST bundle_files_to_ignore)
  176. # Invoke fixup bundle on copy dependencies, link dependencies and imported dependencies
  177. # Fixup bundle should not be invoked on target dependencies.
  178. # target dependencies can be dynamically loaded libraries via `dlopen`
  179. # or dependencies that need to build before the current target and are used
  180. # in some way that is only in the runtime
  181. # Ex. Gem Modules such as libPrefabBuilder.Builders.dylib should not be added to the bundle
  182. # Append to the SOURCE file property target file path if the target_file is a dylib
  183. # otherwise the target_file is within a Mac framework so append to the bundle directory property
  184. if(is_dylib)
  185. # Also skip adding symlinks to the list of libraries to fix up
  186. if(NOT "${source_file}" IN_LIST target_target_files AND NOT IS_SYMLINK "${source_file}")
  187. set_property(SOURCE "${CMAKE_CURRENT_LIST_FILE}" APPEND PROPERTY BUNDLE_LIBS "${target_file}")
  188. endif()
  189. else()
  190. # For frameworks fixup_bundle is used copy them to the output bundle
  191. # Therefore the source framework directory into the BUNDLE_DIRS
  192. set_property(SOURCE "${CMAKE_CURRENT_LIST_FILE}" APPEND PROPERTY BUNDLE_DIRS "${source_framework_directory}")
  193. endif()
  194. endif()
  195. # For frameworks copy the entire framework to the bundle
  196. if(is_framework)
  197. set(source_file "${source_framework_directory}")
  198. endif()
  199. # invoke o3de_copy_file_to_filesystem to copy the files to the bundle
  200. if(explicit_copy_to_bundle)
  201. o3de_copy_file_to_filesystem(
  202. SOURCE_FILE "${source_file}"
  203. SOURCE_TYPE "${source_type}"
  204. SOURCE_GEM_MODULE "${source_is_gem}"
  205. TARGET_FILE "${target_file}"
  206. )
  207. endif()
  208. endfunction()
  209. function(o3de_copy_file_to_filesystem)
  210. set(options)
  211. set(oneValueArgs SOURCE_FILE SOURCE_TYPE SOURCE_GEM_MODULE TARGET_FILE)
  212. set(multiValueArgs)
  213. cmake_parse_arguments("${CMAKE_CURRENT_FUNCTION}" "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
  214. cmake_path(SET source_file NORMALIZE "${${CMAKE_CURRENT_FUNCTION}_SOURCE_FILE}")
  215. set(source_type "${${CMAKE_CURRENT_FUNCTION}_SOURCE_TYPE}")
  216. set(source_is_gem "${${CMAKE_CURRENT_FUNCTION}_SOURCE_GEM_MODULE}")
  217. cmake_path(SET target_file NORMALIZE "${${CMAKE_CURRENT_FUNCTION}_TARGET_FILE}")
  218. cmake_path(GET target_file PARENT_PATH target_directory)
  219. # Only copy the the source_file to destination if they are different
  220. cmake_path(COMPARE "${source_file}" EQUAL "${target_file}" same_location)
  221. if(NOT ${same_location})
  222. if(NOT EXISTS "${target_directory}")
  223. file(MAKE_DIRECTORY "${target_directory}")
  224. endif()
  225. unset(is_source_newer)
  226. # ly_is_newer_than will be true if:
  227. # 1. The source library was rebuilt.
  228. # 2. The library is a 3rdParty lib and it was downloaded after the target was copied.
  229. # 3. The library is being copied over for the first time(target does not exist).
  230. # While downloaded 3rdParty libs will have the creation time set to when it was built,
  231. # their modification time will reflect the time it was downloaded.
  232. ly_is_newer_than(${source_file} ${target_file} is_source_newer)
  233. if(${is_source_newer})
  234. message(STATUS "Copying \"${source_file}\" to \"${target_directory}\"...")
  235. file(MAKE_DIRECTORY "${target_directory}")
  236. file(COPY "${source_file}" DESTINATION "${target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
  237. file(TOUCH_NOCREATE "${target_file}")
  238. set_property(SOURCE "${CMAKE_CURRENT_LIST_FILE}" PROPERTY ANYTHING_NEW TRUE)
  239. endif()
  240. endif()
  241. endfunction()
  242. function(ly_copy source_files relative_target_directory)
  243. set(options)
  244. set(oneValueArgs TARGET_FILE_DIR SOURCE_TYPE SOURCE_GEM_MODULE)
  245. set(multiValueArgs)
  246. cmake_parse_arguments("${CMAKE_CURRENT_FUNCTION}" "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
  247. set(source_type "${${CMAKE_CURRENT_FUNCTION}_SOURCE_TYPE}")
  248. set(source_is_gem "${${CMAKE_CURRENT_FUNCTION}_SOURCE_GEM_MODULE}")
  249. foreach(source_file IN LISTS source_files)
  250. # target is a bundle
  251. if(target_bundle_dir)
  252. o3de_copy_file_to_bundle(
  253. SOURCE_FILE "${source_file}"
  254. SOURCE_TYPE "${source_type}"
  255. SOURCE_GEM_MODULE "${source_is_gem}"
  256. RELATIVE_TARGET_DIRECTORY "${relative_target_directory}"
  257. )
  258. else()
  259. # target is not a bundle
  260. if("${source_file}" MATCHES "\\.[Ff]ramework[^\\.]")
  261. # fixup origin to copy the whole Framework folder
  262. string(REGEX REPLACE "(.*\\.[Ff]ramework).*" "\\1" source_file "${source_file}")
  263. endif()
  264. # Use final path segment as target file name
  265. cmake_path(GET source_file FILENAME target_filename)
  266. cmake_path(APPEND target_file "${target_file_dir}" "${relative_target_directory}" "${target_filename}")
  267. # Invoke o3de_copy_file_to_filestream to copy the source_file to the target_file
  268. o3de_copy_file_to_filesystem(
  269. SOURCE_FILE "${source_file}"
  270. SOURCE_TYPE "${source_type}"
  271. SOURCE_GEM_MODULE "${source_is_gem}"
  272. TARGET_FILE "${target_file}"
  273. )
  274. endif()
  275. endforeach()
  276. endfunction()
  277. @LY_COPY_COMMANDS@
  278. if(NOT @LY_BUILD_FIXUP_BUNDLE@)
  279. return()
  280. endif()
  281. if(target_bundle_content_dir)
  282. # Use get_property(SOURCE) to query the variables set within the ly_copy function calls
  283. # The PARENT_SCOPE option to set only applys to the immediate function scope
  284. # So a nested function call would prevent the variables from being set in this file scope
  285. get_property(anything_new SOURCE "${CMAKE_CURRENT_LIST_FILE}" PROPERTY ANYTHING_NEW)
  286. get_property(plugin_libs SOURCE "${CMAKE_CURRENT_LIST_FILE}" PROPERTY BUNDLE_LIBS)
  287. get_property(plugin_dirs SOURCE "${CMAKE_CURRENT_LIST_FILE}" PROPERTY BUNDLE_DIRS)
  288. get_property(depends_on_python SOURCE "${CMAKE_CURRENT_LIST_FILE}" PROPERTY DEPENDS_ON_PYTHON)
  289. set(fixup_timestamp_file "${target_bundle_dir}.fixup.stamp")
  290. if(NOT anything_new)
  291. ly_is_newer_than(${target_bundle_dir} ${fixup_timestamp_file} anything_new)
  292. endif()
  293. if(anything_new)
  294. # LYN-4502: Patch python bundle, it contains some windows executables, some files that fixup_bundle doesnt like and has
  295. # other issues that produce signature problems
  296. if(depends_on_python)
  297. message(STATUS "Fixing ${target_bundle_framework_dir}/Python.framework...")
  298. file(REMOVE_RECURSE
  299. "${target_bundle_framework_dir}/Python.framework/Versions/Current"
  300. "${target_bundle_framework_dir}/Python.framework/Versions/3.10/Headers"
  301. "${target_bundle_framework_dir}/Python.framework/Versions/3.10/lib/Python"
  302. "${target_bundle_framework_dir}/Python.framework/Versions/3.10/lib/python3.10/test"
  303. "${target_bundle_framework_dir}/Python.framework/Versions/3.10/lib/python3.10/site-packages/scipy/io/tests"
  304. "${target_bundle_framework_dir}/Python.framework/Python"
  305. "${target_bundle_framework_dir}/Python.framework/Resources"
  306. "${target_bundle_framework_dir}/Python.framework/Headers"
  307. )
  308. file(GLOB_RECURSE exe_file_list "${target_bundle_framework_dir}/Python.framework/**/*.exe")
  309. if(exe_file_list)
  310. file(REMOVE_RECURSE ${exe_file_list})
  311. endif()
  312. execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink 3.10 Current
  313. WORKING_DIRECTORY "${target_bundle_framework_dir}/Python.framework/Versions/"
  314. )
  315. execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink Versions/Current/Python Python
  316. WORKING_DIRECTORY "${target_bundle_framework_dir}/Python.framework"
  317. )
  318. execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink Versions/Current/Resources Resources
  319. WORKING_DIRECTORY "${target_bundle_framework_dir}/Python.framework"
  320. )
  321. file(CHMOD "${target_bundle_framework_dir}/Python.framework/Versions/Current/Python"
  322. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
  323. )
  324. endif()
  325. # Read the source property with the list of files to ignore for bundling
  326. get_property(fixup_bundle_ignore SOURCE "${CMAKE_CURRENT_LIST_FILE}" PROPERTY BUNDLE_IGNORE_FILES)
  327. list(REMOVE_DUPLICATES plugin_libs)
  328. list(REMOVE_DUPLICATES plugin_dirs)
  329. fixup_bundle("${target_bundle_dir}" "${plugin_libs}" "${plugin_dirs}" IGNORE_ITEM ${fixup_bundle_ignore})
  330. # fix the rpath for the DirectXShaderCompiler `dxc-3.7` to point at
  331. # <bundle-app>/Contents/Frameworks/libDirectXShaderCompiler.dylib
  332. #
  333. # The proper fix is to update the
  334. # https://github.com/o3de/3p-package-source/blob/main/package-system/DirectXShaderCompiler/FindDirectXShaderCompilerDxc.cmake.Mac
  335. # file to make an IMPORTED SHARED target for the library file and to add an IMPORTED executable for the application
  336. # That way the dxc executable and library will be copied through the link dependencies correctly
  337. # The [ly_add_target_files](https://github.com/o3de/3p-package-source/blob/main/package-system/DirectXShaderCompiler/FindDirectXShaderCompilerDxc.cmake.Mac#L24)
  338. # calls in that file should be removed as part resolving issue https://github.com/o3de/3p-package-source/issues/201
  339. # Furthermore the ly_add_target_files method would benefit from an rpath change argument
  340. # to allow authors to correct the rpath after a copy
  341. cmake_path(SET dxc_path "${target_file_dir}/Builders/DirectXShaderCompiler/bin/dxc-3.7")
  342. if(EXISTS "${dxc_path}")
  343. execute_process(COMMAND "${LY_INSTALL_NAME_TOOL}"
  344. -add_rpath "@executable_path/../../../../Frameworks"
  345. "${dxc_path}")
  346. endif()
  347. cmake_path(SET dxsc_path "${target_file_dir}/Builders/DirectXShaderCompiler/bin/dxsc-3.7")
  348. if(EXISTS "${dxsc_path}")
  349. execute_process(COMMAND "${LY_INSTALL_NAME_TOOL}"
  350. -add_rpath "@executable_path/../../../../Frameworks"
  351. "${dxsc_path}")
  352. endif()
  353. # misplaced .DS_Store files can cause signing to fail
  354. # Interrupted signatures can leave cstemp files behind that fail next signature
  355. file(GLOB_RECURSE remove_file_list
  356. "${target_bundle_dir}/**/.DS_Store"
  357. "${target_bundle_dir}/**/*.cstemp"
  358. )
  359. if(remove_file_list)
  360. message(STATUS "Cleaning up .DS_store *.cstemp files: ${remove_file_list}")
  361. file(REMOVE "${remove_file_list}")
  362. unset(remove_file_list)
  363. file(GLOB_RECURSE remove_file_list
  364. "${target_bundle_dir}/**/.DS_Store"
  365. "${target_bundle_dir}/**/*.cstemp"
  366. )
  367. if(remove_file_list)
  368. message(STATUS "Removal of files has failed: ${remove_file_list}")
  369. endif()
  370. endif()
  371. file(TOUCH "${target_bundle_dir}")
  372. file(TOUCH "${fixup_timestamp_file}")
  373. endif()
  374. endif()