CMakeLists.txt 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # We need to keep this code into separate directory so CMake will execute it after all other subdirectories install code
  2. # Otherwise we can't fix Mac bundle dependencies since binaries wouldn't be there when this code executed
  3. if(APPLE)
  4. if(ENABLE_LAUNCHER)
  5. find_program(TOOL_MACDEPLOYQT NAMES macdeployqt PATHS ${qt_base_dir}/bin)
  6. if(NOT TOOL_MACDEPLOYQT)
  7. message(FATAL_ERROR "Could not find macdeployqt")
  8. endif()
  9. install(CODE "
  10. execute_process(COMMAND ${TOOL_MACDEPLOYQT} \"\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_DIR}\" -verbose=2)
  11. ")
  12. endif()
  13. install(CODE "
  14. set(BU_CHMOD_BUNDLE_ITEMS ON)
  15. include(BundleUtilities)
  16. fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_DIR}\" \"\" \"\")
  17. " COMPONENT Runtime)
  18. endif(APPLE)
  19. # This will likely only work for Vcpkg
  20. if(WIN32)
  21. if(ENABLE_LAUNCHER)
  22. # Temporary ugly fix for Qt deployment since windeployqt broken in Vcpkg
  23. #there are some weird issues with variables used in path not evaluated properly when trying to remove code duplication from below lines
  24. if(EXISTS ${CMAKE_BINARY_DIR}/../../vcpkg) #current path to vcpkg main folder on appveyor CI
  25. if(CMAKE_SIZEOF_VOID_P EQUAL 8) #64 bit build
  26. install(CODE "
  27. file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x64-windows/plugins/bearer DESTINATION \${CMAKE_INSTALL_PREFIX})
  28. file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x64-windows/plugins/iconengines DESTINATION \${CMAKE_INSTALL_PREFIX})
  29. file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x64-windows/plugins/imageformats DESTINATION \${CMAKE_INSTALL_PREFIX})
  30. file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x64-windows/plugins/platforminputcontexts DESTINATION \${CMAKE_INSTALL_PREFIX})
  31. file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x64-windows/plugins/platforms DESTINATION \${CMAKE_INSTALL_PREFIX})
  32. ")
  33. else()
  34. install(CODE "
  35. file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x86-windows/plugins/bearer DESTINATION \${CMAKE_INSTALL_PREFIX})
  36. file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x86-windows/plugins/iconengines DESTINATION \${CMAKE_INSTALL_PREFIX})
  37. file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x86-windows/plugins/imageformats DESTINATION \${CMAKE_INSTALL_PREFIX})
  38. file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x86-windows/plugins/platforminputcontexts DESTINATION \${CMAKE_INSTALL_PREFIX})
  39. file(COPY ${CMAKE_BINARY_DIR}/../../vcpkg/installed/x86-windows/plugins/platforms DESTINATION \${CMAKE_INSTALL_PREFIX})
  40. ")
  41. endif()
  42. else() #not vcpkg build - lines below do not work properly
  43. install(CODE "
  44. execute_process(
  45. COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/bearer \${CMAKE_INSTALL_PREFIX}/bearer
  46. COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/iconengines \${CMAKE_INSTALL_PREFIX}/iconengines
  47. COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/imageformats \${CMAKE_INSTALL_PREFIX}/imageformats
  48. COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/platforminputcontexts \${CMAKE_INSTALL_PREFIX}/platforminputcontexts
  49. COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/platforms \${CMAKE_INSTALL_PREFIX}/platforms)
  50. ")
  51. endif()
  52. endif()
  53. install(CODE "
  54. if(\"\${BUILD_TYPE}\" STREQUAL \"Debug\")
  55. set(dirs \"${CMAKE_PREFIX_PATH}/debug/bin/\")
  56. else()
  57. set(dirs \"${CMAKE_PREFIX_PATH}/bin/\")
  58. endif()
  59. set(BU_CHMOD_BUNDLE_ITEMS ON)
  60. include(BundleUtilities)
  61. fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/VCMI_Client.exe\" \"\" \"\${dirs}\")
  62. " COMPONENT Runtime)
  63. endif(WIN32)