InitRuntime.cmake 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. COMMAND ${CMAKE_COMMAND} -E copy
  48. # 拷贝licensecc库
  49. ${licensecc_LIB}
  50. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  51. )
  52. endif()
  53. else()
  54. if(NOT EXISTS "$<TARGET_FILE_DIR:${PROJECT_NAME}>/FastCAE.ini")
  55. get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
  56. get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
  57. foreach(_lib ${FastCAE_Runtimes_Libraries})
  58. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  59. COMMAND ${CMAKE_COMMAND} -E copy
  60. $<TARGET_LINKER_FILE:${_lib}>
  61. $<TARGET_SONAME_FILE:${_lib}>
  62. $<TARGET_FILE_DIR:PythonModule>
  63. )
  64. endforeach()
  65. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  66. COMMAND ${CMAKE_COMMAND} -E copy
  67. ${Gmsh_EXECUTABLE}
  68. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  69. COMMAND ${CMAKE_COMMAND} -E copy_directory
  70. # 拷贝python的python3.12文件夹
  71. ${Python_DIRS}/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}
  72. $<TARGET_FILE_DIR:PythonModule>/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}
  73. COMMAND ${CMAKE_COMMAND} -E copy_directory
  74. # 拷贝Qt图片格式支持文件
  75. ${_qt_bin_dir}/../plugins/imageformats
  76. $<TARGET_FILE_DIR:${PROJECT_NAME}>/imageformats
  77. COMMAND ${CMAKE_COMMAND} -E copy_directory
  78. ${_qt_bin_dir}/../plugins/platforms
  79. $<TARGET_FILE_DIR:${PROJECT_NAME}>/platforms
  80. COMMAND ${CMAKE_COMMAND} -E copy_directory
  81. ${_qt_bin_dir}/../plugins/platforminputcontexts
  82. $<TARGET_FILE_DIR:${PROJECT_NAME}>/platforminputcontexts
  83. COMMAND ${CMAKE_COMMAND} -E copy_directory
  84. ${_qt_bin_dir}/../plugins/xcbglintegrations
  85. $<TARGET_FILE_DIR:${PROJECT_NAME}>/xcbglintegrations
  86. COMMAND ${CMAKE_COMMAND} -E copy
  87. $<TARGET_LINKER_FILE:Qt5::XcbQpa>
  88. $<TARGET_SONAME_FILE:Qt5::XcbQpa>
  89. $<TARGET_FILE_DIR:PythonModule>
  90. )
  91. file(
  92. COPY
  93. # 拷贝Qt多国语言支持文件
  94. ${_qt_bin_dir}/../lib
  95. DESTINATION ${DEVRUNTIME_LIBDIR}/..
  96. USE_SOURCE_PERMISSIONS
  97. FILES_MATCHING
  98. PATTERN "cmake*" EXCLUDE
  99. PATTERN "pkgconfig*" EXCLUDE
  100. PATTERN "libicu*.so*"
  101. )
  102. endif()
  103. endif()
  104. # FastCAE的配置文件,python脚本,有可能会修改,每次构建都会拷贝
  105. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  106. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  107. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/FastCAE.ini
  108. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/CAD.py
  109. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Case.py
  110. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/ControlPanel.py
  111. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Geometry.py
  112. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/MainWindow.py
  113. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Material.py
  114. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Mesh.py
  115. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Mesher.py
  116. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Post.py
  117. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/PostProcess.py
  118. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  119. )
  120. endif()