launcher_project_mac.cmake 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. set(LY_TARGET_PROPERTIES
  9. BUILD_RPATH @executable_path/
  10. )
  11. # Add resources and app icons to launchers
  12. list(APPEND candidate_paths ${project_real_path}/Resources/Platform/Mac)
  13. list(APPEND candidate_paths ${project_real_path}/Gem/Resources/Platform/Mac) # Legacy projects
  14. list(APPEND candidate_paths ${project_real_path}/Gem/Resources/MacLauncher) # Legacy projects
  15. foreach(resource_path IN LISTS candidate_paths)
  16. if(EXISTS ${resource_path})
  17. set(ly_game_resource_folder ${resource_path})
  18. break()
  19. endif()
  20. endforeach()
  21. if(NOT EXISTS ${ly_game_resource_folder})
  22. list(JOIN candidate_paths " " formatted_error)
  23. message(FATAL_ERROR "Missing 'Resources' folder. Candidate paths tried were: ${formatted_error}")
  24. endif()
  25. target_sources(${project_name}.GameLauncher PRIVATE ${ly_game_resource_folder}/Images.xcassets)
  26. set_target_properties(${project_name}.GameLauncher PROPERTIES
  27. MACOSX_BUNDLE_INFO_PLIST ${ly_game_resource_folder}/Info.plist
  28. RESOURCE ${ly_game_resource_folder}/Images.xcassets
  29. XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME ${project_name}AppIcon
  30. )
  31. set(layout_tool_dir ${LY_ROOT_FOLDER}/cmake/Tools)
  32. add_custom_command(TARGET ${project_name}.GameLauncher POST_BUILD
  33. COMMAND ${LY_PYTHON_CMD} layout_tool.py
  34. -p Mac
  35. -a ${LY_ASSET_DEPLOY_ASSET_TYPE}
  36. --project-path ${project_real_path}
  37. -m ${LY_ASSET_DEPLOY_MODE}
  38. --create-layout-root
  39. -l $<TARGET_BUNDLE_DIR:${project_name}.GameLauncher>/Contents/Resources/assets
  40. --build-config $<CONFIG>
  41. --warn-on-missing-assets
  42. --verify
  43. ${LY_OVERRIDE_PAK_ARGUMENT}
  44. WORKING_DIRECTORY ${layout_tool_dir}
  45. COMMENT "Synchronizing Layout Assets ..."
  46. VERBATIM
  47. )