InitRuntime.cmake 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. if(GJDM_ENABLE_DEV)
  2. if(SYS_WIN)
  3. if(NOT EXISTS "$<TARGET_FILE_DIR:${PROJECT_NAME}>/FastCAE.ini")
  4. get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
  5. get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
  6. foreach(_lib ${FastCAE_Runtimes_Libraries})
  7. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  8. COMMAND ${CMAKE_COMMAND} -E copy
  9. $<TARGET_FILE:${_lib}>
  10. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  11. )
  12. endforeach()
  13. # 在windows环境需要拷贝所有依赖库的dll到构建目录
  14. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  15. #[[COMMAND ${CMAKE_COMMAND} -E copy
  16. $<TARGET_RUNTIME_DLLS:${PROJECT_NAME}>
  17. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  18. COMMAND_EXPAND_LISTS]]
  19. COMMAND ${CMAKE_COMMAND} -E copy
  20. # 拷贝Gmsh执行程序
  21. ${Gmsh_EXECUTABLE}
  22. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  23. COMMAND ${CMAKE_COMMAND} -E copy
  24. # 拷贝CFD执行程序
  25. ${CFD_EXECUTABLE}
  26. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  27. COMMAND ${CMAKE_COMMAND} -E copy
  28. # 拷贝IR执行程序
  29. ${IR_EXECUTABLE}
  30. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  31. COMMAND ${CMAKE_COMMAND} -E copy_directory
  32. # 拷贝python的Lib文件夹
  33. ${Python_DIRS}/Lib
  34. $<TARGET_FILE_DIR:${PROJECT_NAME}>/Lib
  35. COMMAND ${CMAKE_COMMAND} -E copy_directory
  36. # 拷贝python的DLLs文件夹
  37. ${Python_DIRS}/DLLs
  38. $<TARGET_FILE_DIR:${PROJECT_NAME}>/DLLs
  39. COMMAND ${CMAKE_COMMAND} -E copy_directory
  40. # 拷贝Qt图片格式支持文件
  41. ${_qt_bin_dir}/../plugins/imageformats
  42. $<TARGET_FILE_DIR:${PROJECT_NAME}>/imageformats
  43. COMMAND ${CMAKE_COMMAND} -E copy_directory
  44. # 拷贝Qt平台支持文件
  45. ${_qt_bin_dir}/../plugins/platforms
  46. $<TARGET_FILE_DIR:${PROJECT_NAME}>/platforms
  47. )
  48. endif()
  49. else()
  50. if(NOT EXISTS "$<TARGET_FILE_DIR:${PROJECT_NAME}>/FastCAE.ini")
  51. get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
  52. get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
  53. foreach(_lib ${FastCAE_Runtimes_Libraries})
  54. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  55. COMMAND ${CMAKE_COMMAND} -E copy
  56. $<TARGET_LINKER_FILE:${_lib}>
  57. $<TARGET_SONAME_FILE:${_lib}>
  58. $<TARGET_FILE_DIR:PythonModule>
  59. )
  60. endforeach()
  61. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  62. COMMAND ${CMAKE_COMMAND} -E copy
  63. ${Gmsh_EXECUTABLE}
  64. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  65. COMMAND ${CMAKE_COMMAND} -E copy_directory
  66. # 拷贝python的python3.12文件夹
  67. ${Python_DIRS}/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}
  68. $<TARGET_FILE_DIR:PythonModule>/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}
  69. COMMAND ${CMAKE_COMMAND} -E copy_directory
  70. # 拷贝Qt图片格式支持文件
  71. ${_qt_bin_dir}/../plugins/imageformats
  72. $<TARGET_FILE_DIR:${PROJECT_NAME}>/imageformats
  73. COMMAND ${CMAKE_COMMAND} -E copy_directory
  74. ${_qt_bin_dir}/../plugins/platforms
  75. $<TARGET_FILE_DIR:${PROJECT_NAME}>/platforms
  76. COMMAND ${CMAKE_COMMAND} -E copy_directory
  77. ${_qt_bin_dir}/../plugins/platforminputcontexts
  78. $<TARGET_FILE_DIR:${PROJECT_NAME}>/platforminputcontexts
  79. COMMAND ${CMAKE_COMMAND} -E copy_directory
  80. ${_qt_bin_dir}/../plugins/xcbglintegrations
  81. $<TARGET_FILE_DIR:${PROJECT_NAME}>/xcbglintegrations
  82. COMMAND ${CMAKE_COMMAND} -E copy
  83. $<TARGET_LINKER_FILE:Qt5::XcbQpa>
  84. $<TARGET_SONAME_FILE:Qt5::XcbQpa>
  85. $<TARGET_FILE_DIR:PythonModule>
  86. )
  87. file(
  88. COPY
  89. # 拷贝Qt多国语言支持文件
  90. ${_qt_bin_dir}/../lib
  91. DESTINATION ${DEVRUNTIME_LIBDIR}/..
  92. USE_SOURCE_PERMISSIONS
  93. FILES_MATCHING
  94. PATTERN "cmake*" EXCLUDE
  95. PATTERN "pkgconfig*" EXCLUDE
  96. PATTERN "libicu*.so*"
  97. )
  98. endif()
  99. endif()
  100. # FastCAE的配置文件,python脚本,有可能会修改,每次构建都会拷贝
  101. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  102. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  103. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/FastCAE.ini
  104. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/CAD.py
  105. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Case.py
  106. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/ControlPanel.py
  107. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Geometry.py
  108. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/MainWindow.py
  109. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Material.py
  110. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Mesh.py
  111. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Mesher.py
  112. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Post.py
  113. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/PostProcess.py
  114. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  115. )
  116. endif()