Files
o3de/cmake/Platform/Mac/LYWrappers_mac.cmake
T
SJ 44b053df58 [Mac] Building and running game projects from an SDK (#2943)
* 1. Initial support for loading dylibs outside the bundle.
2. Child processes inherit parent's environment if no environment is explicitly specified(should change to append the parent's environment even if environment variables are explicitly specified).
3. Update some time functions to use system uptime instead of wall clock time when computing elapsed time. This fixes false timeouts when the OS goes to sleep.
4. Increase wait times for AssetBuilders and some Atom tools to connect to the AssetProcessor. This is needed because GateKeeper slows down first time bootup which results in asset processing failures.
With this change we'll be able to run Editor and AssetProcessor from an install on Mac and we will also be able to build and run projects using the installed engine as an SDK.

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

* 1. Remove debug messages.
2. Fix license
3. Pass parent's environment variables to child processes by default(on Mac).

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

* 1. Add more detailed comments.2. Use a custom ly_copy for Mac and leave the default as is.

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

* Address some feedback from review

Signed-off-by: amzn-sj <srikkant@amazon.com>
2021-08-10 10:10:37 -05:00

83 lines
2.7 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
#
#
function(ly_apply_platform_properties target)
set_target_properties(${target} PROPERTIES
BUILD_RPATH "@executable_path/;@executable_path/../Frameworks"
INSTALL_RPATH "@executable_path/;@executable_path/../Frameworks"
)
endfunction()
function(ly_handle_custom_output_directory target output_subdirectory)
if(output_subdirectory)
set_target_properties(${target} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${output_subdirectory}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${output_subdirectory}
)
foreach(conf ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${conf} UCONF)
set_target_properties(${target} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_${UCONF} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${UCONF}}/${output_subdirectory}
LIBRARY_OUTPUT_DIRECTORY_${UCONF} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${UCONF}}/${output_subdirectory}
)
endforeach()
endif()
endfunction()
#! ly_add_bundle_resources: add resource files to the current bundle application (if any) in the bundle's resource folder
# if a bundle is specified for the supporting platform.
#
# \arg:FILES files to copy to the resources
#
function(ly_add_bundle_resources)
set(options)
set(oneValueArgs TARGET)
set(multiValueArgs FILES)
cmake_parse_arguments(ly_add_bundle_resources "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# Validate input arguments
if(NOT ly_add_bundle_resources_TARGET)
message(FATAL_ERROR "You must provide a TARGET")
endif()
if(NOT ly_add_bundle_resources_FILES)
message(FATAL_ERROR "You must provide at least a file to copy")
endif()
if (TARGET ${ly_add_bundle_resources_TARGET})
set(destination_location $<TARGET_BUNDLE_CONTENT_DIR:${ly_add_bundle_resources_TARGET}>/Resources)
foreach(file ${ly_add_bundle_resources_FILES})
get_filename_component(filename ${file} NAME)
add_custom_command(
TARGET ${ly_add_bundle_resources_TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${destination_location}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${file} ${destination_location}
DEPENDS ${file}
VERBATIM
COMMENT "Copying ${file} to Resources..."
)
endforeach()
endif()
endfunction()