Fixup editor bundle working
This commit is contained in:
@@ -9,19 +9,5 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(LY_RUNTIME_DEPENDENCIES_HEADER
|
||||
"function(ly_copy source_file target_directory)
|
||||
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}\")
|
||||
endif()
|
||||
if(\"\${source_file}\" IS_NEWER_THAN \"\${target_directory}/\${target_filename}\")
|
||||
file(LOCK \"\${CMAKE_BINARY_DIR}/runtimedependencies.lock\" GUARD FUNCTION TIMEOUT 30)
|
||||
file(COPY \"\${source_file}\" DESTINATION \"\${target_directory}\" FILE_PERMISSIONS ${LY_COPY_PERMISSIONS})
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
\n")
|
||||
|
||||
set(LY_RUNTIME_DEPENDENCIES_TEMPLATE ${LY_ROOT_FOLDER}/cmake/Platform/Common/runtime_dependencies_common.cmake.in)
|
||||
include(cmake/Platform/Common/RuntimeDependencies_common.cmake)
|
||||
@@ -247,23 +247,23 @@ function(ly_delayed_generate_runtime_dependencies)
|
||||
endif()
|
||||
|
||||
unset(runtime_dependencies)
|
||||
set(runtime_commands ${LY_RUNTIME_DEPENDENCIES_HEADER})
|
||||
unset(LY_COPY_COMMANDS)
|
||||
|
||||
ly_get_runtime_dependencies(runtime_dependencies ${target})
|
||||
foreach(runtime_dependency ${runtime_dependencies})
|
||||
unset(runtime_command)
|
||||
ly_get_runtime_dependency_command(runtime_command ${runtime_dependency})
|
||||
string(APPEND runtime_commands ${runtime_command})
|
||||
string(APPEND LY_COPY_COMMANDS ${runtime_command})
|
||||
endforeach()
|
||||
|
||||
string(APPEND runtime_commands ${LY_RUNTIME_DEPENDENCIES_FOOTER})
|
||||
|
||||
# Generate the output file
|
||||
set(target_file_dir "$<TARGET_FILE_DIR:${target}>")
|
||||
string(CONFIGURE "${runtime_commands}" generated_commands @ONLY)
|
||||
file(READ ${LY_RUNTIME_DEPENDENCIES_TEMPLATE} template_file)
|
||||
string(CONFIGURE "${LY_COPY_COMMANDS}" LY_COPY_COMMANDS @ONLY)
|
||||
string(CONFIGURE "${template_file}" configured_template_file @ONLY)
|
||||
file(GENERATE
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/runtime_dependencies/$<CONFIG>/${target}.cmake
|
||||
CONTENT "${generated_commands}"
|
||||
CONTENT "${configured_template_file}"
|
||||
)
|
||||
|
||||
endforeach()
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
function(ly_copy source_file target_directory)
|
||||
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}")
|
||||
endif()
|
||||
if("${source_file}" IS_NEWER_THAN "${target_directory}/${target_filename}")
|
||||
file(LOCK "${CMAKE_BINARY_DIR}/runtimedependencies.lock" GUARD FUNCTION TIMEOUT 30)
|
||||
file(COPY "${source_file}" DESTINATION "${target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
@LY_COPY_COMMANDS@
|
||||
@@ -9,19 +9,5 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(LY_RUNTIME_DEPENDENCIES_HEADER
|
||||
"function(ly_copy source_file target_directory)
|
||||
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}\")
|
||||
endif()
|
||||
if(\"\${source_file}\" IS_NEWER_THAN \"\${target_directory}/\${target_filename}\")
|
||||
file(LOCK \"\${CMAKE_BINARY_DIR}/runtimedependencies.lock\" GUARD FUNCTION TIMEOUT 30)
|
||||
file(COPY \"\${source_file}\" DESTINATION \"\${target_directory}\" FILE_PERMISSIONS ${LY_COPY_PERMISSIONS} FOLLOW_SYMLINK_CHAIN)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
\n")
|
||||
|
||||
set(LY_RUNTIME_DEPENDENCIES_TEMPLATE ${LY_ROOT_FOLDER}/cmake/Platform/Common/runtime_dependencies_common.cmake.in)
|
||||
include(cmake/Platform/Common/RuntimeDependencies_common.cmake)
|
||||
@@ -9,70 +9,7 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
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
|
||||
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()
|
||||
if(NOT \"\${source_file}\" STREQUAL \"\${target_directory}/\${target_filename}\")
|
||||
if(NOT EXISTS \"\${target_directory}\")
|
||||
file(MAKE_DIRECTORY \"\${target_directory}\")
|
||||
endif()
|
||||
if(\"\${source_file}\" IS_NEWER_THAN \"\${target_directory}/\${target_filename}\")
|
||||
file(LOCK \"\${CMAKE_BINARY_DIR}/runtimedependencies.lock\" GUARD FUNCTION TIMEOUT 30)
|
||||
file(COPY \"\${source_file}\" DESTINATION \"\${target_directory}\" FILE_PERMISSIONS ${LY_COPY_PERMISSIONS} FOLLOW_SYMLINK_CHAIN)
|
||||
set(anything_new TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
\n")
|
||||
|
||||
set(LY_RUNTIME_DEPENDENCIES_FOOTER
|
||||
"
|
||||
if(@target_file_dir@ MATCHES \".app/Contents/MacOS\")
|
||||
if(NOT anything_new)
|
||||
string(REGEX REPLACE \"(.*.app)/Contents/MacOS.*\" \"\\\\1\" bundle_path \"@target_file_dir@\")
|
||||
set(timestamp_file \"\${bundle_path}.fixup.stamp\")
|
||||
if(NOT EXISTS \"\${timestamp_file}\")
|
||||
set(anything_new TRUE)
|
||||
else()
|
||||
file(GLOB_RECURSE files_in_bundle FOLLOW_SYMLINKS \"\${bundle_path}\")
|
||||
foreach(file \${files_in_bundle})
|
||||
if(\${file} IS_NEWER_THAN \"\${timestamp_file}\")
|
||||
set(anything_new TRUE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
if(anything_new)
|
||||
include(BundleUtilities)
|
||||
list(REMOVE_DUPLICATES plugin_libs)
|
||||
list(REMOVE_DUPLICATES plugin_dirs)
|
||||
fixup_bundle(\"\${bundle_path}\" \"\${plugin_libs}\" \"\${plugin_dirs}\")
|
||||
file(TOUCH \"\${timestamp_file}\")
|
||||
endif()
|
||||
endif()
|
||||
")
|
||||
|
||||
|
||||
|
||||
set(LY_BUILD_FIXUP_BUNDLE TRUE CACHE BOOL "Fix bundles on build (deploys frameworks and calls fixup_bundle)")
|
||||
|
||||
set(LY_RUNTIME_DEPENDENCIES_TEMPLATE ${LY_ROOT_FOLDER}/cmake/Platform/Mac/runtime_dependencies_mac.cmake.in)
|
||||
include(cmake/Platform/Common/RuntimeDependencies_common.cmake)
|
||||
@@ -0,0 +1,139 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
include(BundleUtilities)
|
||||
|
||||
#set(BU_COPY_FULL_FRAMEWORK_CONTENTS ON)
|
||||
|
||||
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)
|
||||
|
||||
# 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")
|
||||
|
||||
if("@LY_BUILD_FIXUP_BUNDLE@" STREQUAL FALSE)
|
||||
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}")
|
||||
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}")
|
||||
set(plugin_dirs ${local_plugin_dirs} PARENT_SCOPE)
|
||||
|
||||
elseif("${source_file}" MATCHES "qt/plugins" AND "${target_directory}" MATCHES "\\.app/Contents/MacOS")
|
||||
|
||||
if("@LY_BUILD_FIXUP_BUNDLE@" STREQUAL FALSE)
|
||||
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" AND "${target_directory}" MATCHES "\\.app/Contents/MacOS")
|
||||
|
||||
return() # skip, is this used?
|
||||
|
||||
elseif("${source_file}" MATCHES ".dylib")
|
||||
|
||||
set(local_plugin_dirs ${plugin_dirs})
|
||||
list(APPEND local_plugin_dirs "${target_directory}")
|
||||
set(plugin_dirs ${local_plugin_dirs} PARENT_SCOPE)
|
||||
|
||||
endif()
|
||||
|
||||
if(NOT "${source_file}" STREQUAL "${target_directory}/${target_filename}")
|
||||
if(NOT EXISTS "${target_directory}")
|
||||
file(MAKE_DIRECTORY "${target_directory}")
|
||||
endif()
|
||||
if(NOT EXISTS "${target_directory}/${target_filename}" OR "${source_file}" IS_NEWER_THAN "${target_directory}/${target_filename}")
|
||||
file(LOCK "${CMAKE_BINARY_DIR}/runtimedependencies.lock" GUARD FUNCTION TIMEOUT 30)
|
||||
message(STATUS "Copying \"${source_file}\" to \"${target_directory}\"...")
|
||||
file(COPY "${source_file}" DESTINATION "${target_directory}" FILE_PERMISSIONS @LY_COPY_PERMISSIONS@ FOLLOW_SYMLINK_CHAIN)
|
||||
set(anything_new TRUE PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
@LY_COPY_COMMANDS@
|
||||
|
||||
if("@LY_BUILD_FIXUP_BUNDLE@" STREQUAL FALSE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(@target_file_dir@ MATCHES ".app/Contents/MacOS")
|
||||
string(REGEX REPLACE "(.*\\.app)/Contents/MacOS.*" "\\1" bundle_path "@target_file_dir@")
|
||||
if(NOT anything_new)
|
||||
set(timestamp_file "${bundle_path}.fixup.stamp")
|
||||
if(NOT EXISTS "${timestamp_file}")
|
||||
set(anything_new TRUE)
|
||||
else()
|
||||
file(GLOB_RECURSE files_in_bundle FOLLOW_SYMLINKS "${bundle_path}")
|
||||
foreach(file ${files_in_bundle})
|
||||
if(${file} IS_NEWER_THAN "${timestamp_file}")
|
||||
set(anything_new TRUE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
if(anything_new)
|
||||
# LYN-4505: Patch dxc, is configured in the wrong folder in 3p
|
||||
if(EXISTS ${bundle_path}/Contents/MacOS/Builders/DirectXShaderCompiler/bin/dxc-3.7)
|
||||
file(RENAME
|
||||
${bundle_path}/Contents/MacOS/Builders/DirectXShaderCompiler/lib/libdxcompiler.3.7.dylib
|
||||
${bundle_path}/Contents/MacOS/Builders/DirectXShaderCompiler/bin/libdxcompiler.3.7.dylib
|
||||
)
|
||||
endif()
|
||||
if(EXISTS ${bundle_path}/Contents/Frameworks/Python.framework)
|
||||
# LYN-4502: Patch python bundle, it contains some windows executables, some files that fixup_bundle doesnt like and has
|
||||
# duplicated binaries between Versions/3.7 and Versions/Current.
|
||||
file(GLOB exe_files
|
||||
${bundle_path}/Contents/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/*.exe
|
||||
${bundle_path}/Contents/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distlib/*.exe
|
||||
${bundle_path}/Contents/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/*.exe
|
||||
)
|
||||
foreach(exe_file ${exe_files})
|
||||
file(REMOVE ${exe_file})
|
||||
endforeach()
|
||||
file(REMOVE_RECURSE
|
||||
${bundle_path}/Contents/Frameworks/Python.framework/Versions/3.7/lib/python3.7/test
|
||||
${bundle_path}/Contents/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/scipy/io/tests
|
||||
${bundle_path}/Contents/Frameworks/Python.framework/Versions/3.7/Resources
|
||||
${bundle_path}/Contents/Frameworks/Python.framework/Python
|
||||
${bundle_path}/Contents/Frameworks/Python.framework/Resources/Python.app
|
||||
${bundle_path}/Contents/Frameworks/Python.framework/Versions/3.7/Python
|
||||
)
|
||||
file(REMOVE_RECURSE ${bundle_path}/Contents/Frameworks/Python.framework/Versions/Current)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 3.7 Current
|
||||
WORKING_DIRECTORY ${bundle_path}/Contents/Frameworks/Python.framework/Versions/
|
||||
)
|
||||
endif()
|
||||
list(REMOVE_DUPLICATES plugin_libs)
|
||||
list(REMOVE_DUPLICATES plugin_dirs)
|
||||
fixup_bundle("${bundle_path}" "${plugin_libs}" "${plugin_dirs}")
|
||||
file(TOUCH "${timestamp_file}")
|
||||
endif()
|
||||
endif()
|
||||
@@ -9,19 +9,5 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(LY_RUNTIME_DEPENDENCIES_HEADER
|
||||
"function(ly_copy source_file target_directory)
|
||||
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}\")
|
||||
endif()
|
||||
if(\"\${source_file}\" IS_NEWER_THAN \"\${target_directory}/\${target_filename}\")
|
||||
file(LOCK \"\${CMAKE_BINARY_DIR}/runtimedependencies.lock\" GUARD FUNCTION TIMEOUT 30)
|
||||
file(COPY \"\${source_file}\" DESTINATION \"\${target_directory}\" FILE_PERMISSIONS ${LY_COPY_PERMISSIONS})
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
\n")
|
||||
|
||||
set(LY_RUNTIME_DEPENDENCIES_TEMPLATE ${LY_ROOT_FOLDER}/cmake/Platform/Common/runtime_dependencies_common.cmake.in)
|
||||
include(cmake/Platform/Common/RuntimeDependencies_common.cmake)
|
||||
Reference in New Issue
Block a user