Generate install layout for Mac (#2144)

* 1. Move call to install(TARGETS...) to its own function to create a platform specific implementation for Mac.
2. Add linker-signed flag to work around cmake install issue.

Signed-off-by: amzn-sj <srikkant@amazon.com>

* Add newline

Signed-off-by: amzn-sj <srikkant@amazon.com>

* 1. Rename function to ly_install_target_override and only call it if it has been implemented.
2. Pass in runtime, archive, and library directory paths as params to clean it up a bit.

Signed-off-by: amzn-sj <srikkant@amazon.com>
monroegm-disable-blank-issue-2
SJ 4 years ago committed by GitHub
parent 9e81cedf80
commit 7eeaf7dad5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -100,6 +100,16 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
cmake_path(RELATIVE_PATH target_library_output_directory BASE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} OUTPUT_VARIABLE target_library_output_subdirectory)
endif()
if(COMMAND ly_install_target_override)
# Mac needs special handling because of a cmake issue
ly_install_target_override(TARGET ${TARGET_NAME}
ARCHIVE_DIR ${archive_output_directory}
LIBRARY_DIR ${library_output_directory}
RUNTIME_DIR ${runtime_output_directory}
LIBRARY_SUBDIR ${target_library_output_subdirectory}
RUNTIME_SUBDIR ${target_runtime_output_subdirectory}
)
else()
install(
TARGETS ${TARGET_NAME}
ARCHIVE
@ -112,6 +122,7 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
DESTINATION ${runtime_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_runtime_output_subdirectory}
COMPONENT ${install_component}
)
endif()
# CMakeLists.txt file
string(REGEX MATCH "(.*)::(.*)$" match ${ALIAS_TARGET_NAME})
@ -487,7 +498,7 @@ function(ly_setup_others)
# Scripts
file(GLOB o3de_scripts "${LY_ROOT_FOLDER}/scripts/o3de.*")
install(FILES
install(PROGRAMS
${o3de_scripts}
DESTINATION ./scripts
)
@ -505,6 +516,14 @@ function(ly_setup_others)
DESTINATION .
REGEX "downloaded_packages" EXCLUDE
REGEX "runtime" EXCLUDE
REGEX ".*$\.sh" EXCLUDE
)
# For Mac/Linux shell scripts need to be installed as PROGRAMS to have execute permission
file(GLOB python_scripts "${LY_ROOT_FOLDER}/python/*.sh")
install(PROGRAMS
${python_scripts}
DESTINATION ./python
)
# Registry

@ -28,7 +28,9 @@ else()
endif()
# Signing
ly_set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS --deep)
# The "-o linker-signed" flag is required as a work-around for the following CMake issue:
# https://gitlab.kitware.com/cmake/cmake/-/issues/21854
ly_set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "--deep -o linker-signed")
# Generate scheme files for Xcode
ly_set(CMAKE_XCODE_GENERATE_SCHEME TRUE)

@ -5,7 +5,47 @@
#
#
# Empty implementations for untested platforms to fix build errors.
#! ly_install_target_override: Mac specific target installation
function(ly_install_target_override)
function(ly_setup_o3de_install)
set(options)
set(oneValueArgs TARGET ARCHIVE_DIR LIBRARY_DIR RUNTIME_DIR LIBRARY_SUBDIR RUNTIME_SUBDIR)
set(multiValueArgs)
cmake_parse_arguments(ly_platform_install_target "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
get_property(install_component TARGET ${ly_platform_install_target_TARGET} PROPERTY INSTALL_COMPONENT)
# For bundles on Mac, we set the icons by passing in a path to the Images.xcassets directory.
# However, the CMake install command expects paths to files for the the RESOURCE property.
# More details can be found in the CMake issue: https://gitlab.kitware.com/cmake/cmake/-/issues/22409
get_target_property(is_bundle ${ly_platform_install_target_TARGET} MACOSX_BUNDLE)
if (${is_bundle})
get_target_property(cached_resources_dir ${ly_platform_install_target_TARGET} RESOURCE)
set_property(TARGET ${ly_platform_install_target_TARGET} PROPERTY RESOURCE "")
endif()
install(
TARGETS ${ly_platform_install_target_TARGET}
ARCHIVE
DESTINATION ${ly_platform_install_target_ARCHIVE_DIR}/${PAL_PLATFORM_NAME}/$<CONFIG>
COMPONENT ${install_component}
LIBRARY
DESTINATION ${ly_platform_install_target_LIBRARY_DIR}/${PAL_PLATFORM_NAME}/$<CONFIG>/${ly_platform_install_target_LIBRARY_SUBDIR}
COMPONENT ${install_component}
RUNTIME
DESTINATION ${ly_platform_install_target_RUNTIME_DIR}/${PAL_PLATFORM_NAME}/$<CONFIG>/${ly_platform_install_target_RUNTIME_SUBDIR}
COMPONENT ${install_component}
BUNDLE
DESTINATION ${ly_platform_install_target_RUNTIME_DIR}/${PAL_PLATFORM_NAME}/$<CONFIG>/${ly_platform_install_target_RUNTIME_SUBDIR}
COMPONENT ${install_component}
RESOURCE
DESTINATION ${ly_platform_install_target_RUNTIME_DIR}/${PAL_PLATFORM_NAME}/$<CONFIG>/${ly_platform_install_target_RUNTIME_SUBDIR}/
COMPONENT ${install_component}
)
if (${is_bundle})
set_property(TARGET ${ly_platform_install_target_TARGET} PROPERTY RESOURCE ${cached_resources_dir})
endif()
endfunction()
include(cmake/Platform/Common/Install_common.cmake)

Loading…
Cancel
Save