1f542838bb
* [Mac] Initial support for building with hardened runtime enabled and code signing the binaries and bundles generated by the CMake install process. Signed-off-by: amzn-sj <srikkant@amazon.com> * 1. Move call to ly_post_install_step 2. Entitlements should only be added for executables 3. Change use of CMake exec_program to newer execute_process 4. Remove broken symlinks from embedded Python frameworks 5. Run post install code signing only if hardened runtime is enabled Signed-off-by: amzn-sj <srikkant@amazon.com> * Remove unnecessary flag Signed-off-by: amzn-sj <srikkant@amazon.com> * Remove unnecessary additional call to condesign python inside a bundle Signed-off-by: amzn-sj <srikkant@amazon.com> * 1. Move commonly used install functions for codesigning, copying files, and fixing frameworks to a utility script 2. Remove unnecessary wait in the Editor/AP launchers I added earlier. 3. Codesign 3rd party libraries for distribution. Signed-off-by: amzn-sj <srikkant@amazon.com> * 1. Codesigning on 3rd party libs should only happen when hardened runtime is enabled. 2. Change the order of the if blocks in Editor's main_dummy.cpp. This was causing strange notarization issues because it wass too similar to AP's main executable. Signed-off-by: amzn-sj <srikkant@amazon.com> * Add new line to end of file Signed-off-by: amzn-sj <srikkant@amazon.com> * 1. Move architecture specification to PAL_mac cmake file. 2. Codesign failure should be fatal. Signed-off-by: amzn-sj <srikkant@amazon.com> * Address some PR feedback Signed-off-by: amzn-sj <srikkant@amazon.com> * Remove unnecessary comment. Change if to use IN_LIST. Signed-off-by: amzn-sj <srikkant@amazon.com> * HOME may not always be defined. Adding alternate POSIX way of determining HOME. Signed-off-by: amzn-sj <srikkant@amazon.com> * Checking in partial work to get O3DE SDK built as an app bundle. Has a bunch of debug code that needs to be cleaned up. Signed-off-by: amzn-sj <srikkant@amazon.com> * Remove this and add it back later with fixed casing. Signed-off-by: amzn-sj <srikkant@amazon.com> * Adding file back with fixed case Signed-off-by: amzn-sj <srikkant@amazon.com> * 1. Add entitlements sparingly(only when necessary) 2. Convert entitlements to plist files which we can directly pass to codesign 3. Install python site-packages in the o3de_sdk launcher and then launch the project manger. Signed-off-by: amzn-sj <srikkant@amazon.com> * 1. Move hardened runtime check to codesigning functions only. This way, non-hardened runtime install is identical to the former except for codesign. Makes it easy for QA to test internally. 2. Move cmake min version for install to the pre-install steps. Signed-off-by: amzn-sj <srikkant@amazon.com> * 1. Remove the dummy launchers for AssetProcessor and Editor 2. Add loader_path to the rpaths of binaries outside an app bundle so that the dynamic loader can load their dependencies if any. Signed-off-by: amzn-sj <srikkant@amazon.com> * Remove file named main_dummy.cpp Signed-off-by: amzn-sj <srikkant@amazon.com> * Add O3DE SDK launcher Signed-off-by: amzn-sj <srikkant@amazon.com> * Add missing runtime dependencies to gems Signed-off-by: amzn-sj <srikkant@amazon.com> * 1. Update the path to binaries when codesigning to the correct one. 2. Remove some debug messages. 3. Move installed binary path setreg generation to the target install function. This way, we get the correct path to the bundle accounting for different configs and subdirectories. Signed-off-by: amzn-sj <srikkant@amazon.com> * Add explanatory comments. Signed-off-by: amzn-sj <srikkant@amazon.com> * 1. ly_install_add_install_path_setreg cannot be called during install target because the runtime dependencies are already processed by then. 2. The SDK launcher now uses the ProjectManager's bundle setreg to find the path to the installed binaries Signed-off-by: amzn-sj <srikkant@amazon.com> * Update path to install relative binaries after merge from dev Signed-off-by: amzn-sj <srikkant@amazon.com> * Only one config of the SDK launcher needs to be installed. Preinstall steps should not be run per config, but only once. Signed-off-by: amzn-sj <srikkant@amazon.com> * 1. Install python dependencies using the get_python.sh script. 2. Replace any reference to hard-coded package name/version numbers with variables. 3. Add one more missing runtime dependency. 4. Misc. PR feedback. Signed-off-by: amzn-sj <srikkant@amazon.com> * 1. Remove the need for setreg files in all tool bundle. Project binary path can be used instead. 2. Move O3DE_SDK_Launcher to Code/Tools/BundleLauncher 3. Add ly_install_run_script() function for install(SCRIPT) functionality. 4. Address some other PR feedback. Signed-off-by: amzn-sj <srikkant@amazon.com> * Add source permission when installing O3DE_SDK executable. Signed-off-by: amzn-sj <srikkant@amazon.com> * Rename setreg file to add specialization tag. Signed-off-by: amzn-sj <srikkant@amazon.com> * Remove LY_BUILD_PERMUTATION that's not needed Signed-off-by: amzn-sj <srikkant@amazon.com> * 1. Add BinariesInstallPath.setreg to all our bundles like before. This is now only added during the install process though. 2. Fix path in Install_common.cmake Signed-off-by: amzn-sj <srikkant@amazon.com> * Fix comment Signed-off-by: amzn-sj <srikkant@amazon.com>
171 lines
6.0 KiB
CMake
171 lines
6.0 KiB
CMake
#
|
|
# Copyright (c) Contributors to the Open 3D Engine Project.
|
|
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
#
|
|
#
|
|
|
|
ly_set(LY_INSTALL_ENABLED TRUE)
|
|
if(INSTALLED_ENGINE)
|
|
ly_set(LY_INSTALL_ENABLED FALSE)
|
|
endif()
|
|
|
|
if(LY_INSTALL_ENABLED)
|
|
ly_get_absolute_pal_filename(pal_dir ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Platform/${PAL_PLATFORM_NAME})
|
|
include(${pal_dir}/Install_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
|
|
endif()
|
|
|
|
#! ly_install_directory: specifies a directory to be copied to the install layout at install time
|
|
#
|
|
# \arg:DIRECTORIES directories to install
|
|
# \arg:DESTINATION (optional) destination to install the directory to (relative to CMAKE_PREFIX_PATH)
|
|
# \arg:EXCLUDE_PATTERNS (optional) patterns to exclude
|
|
# \arg:VERBATIM (optional) copies the directories as they are, this excludes the default exclude patterns
|
|
#
|
|
# \notes:
|
|
# - refer to cmake's install(DIRECTORY documentation for more information
|
|
# - If the directory contains programs/scripts, exclude them from this call and add a specific ly_install_files with
|
|
# PROGRAMS set. This is necessary to set the proper execution permissions.
|
|
# - This function will automatically filter out __pycache__, *.egg-info, CMakeLists.txt, *.cmake files. If those files
|
|
# need to be installed, use ly_install_files. Use VERBATIM to exclude such filters.
|
|
#
|
|
function(ly_install_directory)
|
|
|
|
if(NOT LY_INSTALL_ENABLED)
|
|
return()
|
|
endif()
|
|
|
|
set(options VERBATIM)
|
|
set(oneValueArgs DESTINATION)
|
|
set(multiValueArgs DIRECTORIES EXCLUDE_PATTERNS)
|
|
|
|
cmake_parse_arguments(ly_install_directory "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
|
|
if(NOT ly_install_directory_DIRECTORIES)
|
|
message(FATAL_ERROR "You must provide at least a directory to install")
|
|
endif()
|
|
|
|
foreach(directory ${ly_install_directory_DIRECTORIES})
|
|
|
|
cmake_path(ABSOLUTE_PATH directory)
|
|
|
|
if(NOT ly_install_directory_DESTINATION)
|
|
# maintain the same structure relative to LY_ROOT_FOLDER
|
|
set(ly_install_directory_DESTINATION ${directory})
|
|
if(${ly_install_directory_DESTINATION} STREQUAL ".")
|
|
set(ly_install_directory_DESTINATION ${CMAKE_CURRENT_LIST_DIR})
|
|
else()
|
|
cmake_path(ABSOLUTE_PATH ly_install_directory_DESTINATION BASE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
|
endif()
|
|
# take out the last directory since install asks for the destination of the folder, without including the fodler itself
|
|
cmake_path(GET ly_install_directory_DESTINATION PARENT_PATH ly_install_directory_DESTINATION)
|
|
cmake_path(RELATIVE_PATH ly_install_directory_DESTINATION BASE_DIRECTORY ${LY_ROOT_FOLDER})
|
|
endif()
|
|
|
|
unset(exclude_patterns)
|
|
if(ly_install_directory_EXCLUDE_PATTERNS)
|
|
foreach(exclude_pattern ${ly_install_directory_EXCLUDE_PATTERNS})
|
|
list(APPEND exclude_patterns PATTERN ${exclude_pattern} EXCLUDE)
|
|
endforeach()
|
|
endif()
|
|
|
|
if(NOT ly_install_directory_VERBATIM)
|
|
# Exclude cmake since that has to be generated
|
|
list(APPEND exclude_patterns PATTERN CMakeLists.txt EXCLUDE)
|
|
list(APPEND exclude_patterns PATTERN *.cmake EXCLUDE)
|
|
|
|
# Exclude python-related things that dont need to be installed
|
|
list(APPEND exclude_patterns PATTERN __pycache__ EXCLUDE)
|
|
list(APPEND exclude_patterns PATTERN *.egg-info EXCLUDE)
|
|
endif()
|
|
|
|
install(DIRECTORY ${directory}
|
|
DESTINATION ${ly_install_directory_DESTINATION}
|
|
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the deafult for the time being
|
|
${exclude_patterns}
|
|
)
|
|
endforeach()
|
|
|
|
endfunction()
|
|
|
|
#! ly_install_files: specifies files to be copied to the install layout at install time
|
|
#
|
|
# \arg:FILES files to install
|
|
# \arg:DESTINATION destination to install the directory to (relative to CMAKE_PREFIX_PATH)
|
|
# \arg:PROGRAMS (optional) indicates if the files are programs that should be installed with EXECUTE permissions
|
|
#
|
|
# \notes:
|
|
# - refer to cmake's install(FILES/PROGRAMS documentation for more information
|
|
#
|
|
function(ly_install_files)
|
|
|
|
if(NOT LY_INSTALL_ENABLED)
|
|
return()
|
|
endif()
|
|
|
|
set(options PROGRAMS)
|
|
set(oneValueArgs DESTINATION)
|
|
set(multiValueArgs FILES)
|
|
|
|
cmake_parse_arguments(ly_install_files "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
|
|
if(NOT ly_install_files_FILES)
|
|
message(FATAL_ERROR "You must provide a list of files to install")
|
|
endif()
|
|
if(NOT ly_install_files_DESTINATION)
|
|
message(FATAL_ERROR "You must provide a destination to install files to")
|
|
endif()
|
|
|
|
unset(files)
|
|
foreach(file ${ly_install_files_FILES})
|
|
cmake_path(ABSOLUTE_PATH file)
|
|
list(APPEND files ${file})
|
|
endforeach()
|
|
|
|
if(ly_install_files_PROGRAMS)
|
|
set(install_type PROGRAMS)
|
|
else()
|
|
set(install_type FILES)
|
|
endif()
|
|
|
|
install(${install_type} ${files}
|
|
DESTINATION ${ly_install_files_DESTINATION}
|
|
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the default for the time being
|
|
)
|
|
|
|
endfunction()
|
|
|
|
#! ly_install_run_code: specifies code to be added to the install process (will run at install time)
|
|
#
|
|
# \notes:
|
|
# - refer to cmake's install(CODE documentation for more information
|
|
#
|
|
function(ly_install_run_code CODE)
|
|
|
|
if(NOT LY_INSTALL_ENABLED)
|
|
return()
|
|
endif()
|
|
|
|
install(CODE ${CODE}
|
|
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the default for the time being
|
|
)
|
|
|
|
endfunction()
|
|
|
|
#! ly_install_run_script: specifies path to script to be added to the install process (will run at install time)
|
|
#
|
|
# \notes:
|
|
# - refer to cmake's install(SCRIPT documentation for more information
|
|
#
|
|
function(ly_install_run_script SCRIPT)
|
|
|
|
if(NOT LY_INSTALL_ENABLED)
|
|
return()
|
|
endif()
|
|
|
|
install(SCRIPT ${SCRIPT}
|
|
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the default for the time being
|
|
)
|
|
|
|
endfunction() |