install_resources.cmake 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # This is only one working solution I found to be working for normal and Archive builds under Xcode 15.4
  2. # I expect higger sensitivity to Xcode version.
  3. if(DEFINED ENV{INSTALL_ROOT} AND EXISTS "$ENV{INSTALL_ROOT}")
  4. set(RESOURCES_DIR "$ENV{INSTALL_ROOT}/Applications/$ENV{PRODUCT_NAME}.app/Contents/Resources")
  5. else()
  6. set(RESOURCES_DIR "$ENV{TARGET_BUILD_DIR}/$ENV{UNLOCALIZED_RESOURCES_FOLDER_PATH}")
  7. endif()
  8. # Write debug information to a file
  9. #file(WRITE "$ENV{PROJECT_FILE_PATH}/../debug_output.txt" "INSTALL_ROOT: $ENV{INSTALL_ROOT}\n")
  10. #file(APPEND "$ENV{PROJECT_FILE_PATH}/../debug_output.txt" "RESOURCES_DIR: ${RESOURCES_DIR}\n")
  11. #file(APPEND "$ENV{PROJECT_FILE_PATH}/../debug_output.txt" "TARGET_BUILD_DIR: $ENV{TARGET_BUILD_DIR}\n")
  12. #file(APPEND "$ENV{PROJECT_FILE_PATH}/../debug_output.txt" "BUILT_PRODUCTS_DIR: $ENV{BUILT_PRODUCTS_DIR}\n")
  13. #file(APPEND "$ENV{PROJECT_FILE_PATH}/../debug_output.txt" "SOURCE_ROOT: $ENV{SOURCE_ROOT}\n")
  14. #file(APPEND "$ENV{PROJECT_FILE_PATH}/../debug_output.txt" "PRODUCT_NAME: $ENV{PRODUCT_NAME}\n")
  15. execute_process(
  16. COMMAND ${CMAKE_COMMAND} -E copy_directory
  17. "$ENV{SOURCE_ROOT}/builtin"
  18. "${RESOURCES_DIR}/builtin"
  19. )
  20. execute_process(
  21. COMMAND ${CMAKE_COMMAND} -E copy_directory
  22. "$ENV{SOURCE_ROOT}/client/shaders"
  23. "${RESOURCES_DIR}/client/shaders"
  24. )
  25. execute_process(
  26. COMMAND ${CMAKE_COMMAND} -E copy_directory
  27. "$ENV{SOURCE_ROOT}/fonts"
  28. "${RESOURCES_DIR}/fonts"
  29. )
  30. execute_process(
  31. COMMAND ${CMAKE_COMMAND} -E copy_directory
  32. "$ENV{PROJECT_FILE_PATH}/../locale"
  33. "${RESOURCES_DIR}/locale"
  34. )
  35. execute_process(
  36. COMMAND ${CMAKE_COMMAND} -E make_directory
  37. "${RESOURCES_DIR}/$ENV{PRODUCT_NAME}"
  38. )
  39. set(RESOURCE_LUANTI_FILES
  40. "$ENV{SOURCE_ROOT}/README.md"
  41. "$ENV{SOURCE_ROOT}/doc/client_lua_api.md"
  42. "$ENV{SOURCE_ROOT}/doc/lua_api.md"
  43. "$ENV{SOURCE_ROOT}/doc/menu_lua_api.md"
  44. "$ENV{SOURCE_ROOT}/minetest.conf.example"
  45. "$ENV{SOURCE_ROOT}/doc/texture_packs.md"
  46. "$ENV{SOURCE_ROOT}/doc/world_format.md"
  47. )
  48. foreach (file ${RESOURCE_LUANTI_FILES})
  49. execute_process(
  50. COMMAND ${CMAKE_COMMAND} -E copy
  51. "${file}"
  52. "${RESOURCES_DIR}/$ENV{PRODUCT_NAME}/"
  53. )
  54. endforeach()
  55. execute_process(
  56. COMMAND ${CMAKE_COMMAND} -E copy_directory
  57. "$ENV{SOURCE_ROOT}/textures/base/pack"
  58. "${RESOURCES_DIR}/textures/base/pack"
  59. )