InitRuntime.cmake 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. if(GJDM_ENABLE_DEV)
  2. if(SYS_WIN)
  3. if(NOT EXISTS "$<TARGET_FILE_DIR:${PROJECT_NAME}>/GJDM.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_BINARY_DIRS}
  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
  32. # 拷贝Ps-Tools执行程序
  33. ${CMAKE_SOURCE_DIR}/extlib/PSTools/pssuspend.exe
  34. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  35. COMMAND ${CMAKE_COMMAND} -E copy_directory
  36. # 拷贝python的Lib文件夹
  37. ${Python_DIRS}/Lib
  38. $<TARGET_FILE_DIR:${PROJECT_NAME}>/Lib
  39. COMMAND ${CMAKE_COMMAND} -E copy_directory
  40. # 拷贝python的DLLs文件夹
  41. ${Python_DIRS}/DLLs
  42. $<TARGET_FILE_DIR:${PROJECT_NAME}>/DLLs
  43. COMMAND ${CMAKE_COMMAND} -E copy_directory
  44. # 拷贝python的tcl文件夹
  45. ${Python_DIRS}/tcl
  46. $<TARGET_FILE_DIR:${PROJECT_NAME}>/tcl
  47. COMMAND ${CMAKE_COMMAND} -E copy
  48. # 拷贝python执行程序
  49. ${Python_EXECUTABLE}
  50. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  51. COMMAND ${CMAKE_COMMAND} -E copy_directory
  52. # 拷贝Qt图片格式支持文件
  53. ${_qt_bin_dir}/../plugins/imageformats
  54. $<TARGET_FILE_DIR:${PROJECT_NAME}>/imageformats
  55. COMMAND ${CMAKE_COMMAND} -E copy_directory
  56. # 拷贝Qt平台支持文件
  57. ${_qt_bin_dir}/../plugins/platforms
  58. $<TARGET_FILE_DIR:${PROJECT_NAME}>/platforms
  59. COMMAND ${CMAKE_COMMAND} -E copy
  60. # 拷贝licensecc库
  61. ${licensecc_LIB}
  62. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  63. COMMAND ${CMAKE_COMMAND} -E copy
  64. ${CMAKE_SOURCE_DIR}/src/CFD/reprocess.py
  65. ${CMAKE_SOURCE_DIR}/src/IR/irPlot.py
  66. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  67. COMMAND ${CMAKE_COMMAND} -E copy_directory
  68. ${CMAKE_SOURCE_DIR}/extlib/Database
  69. $<TARGET_FILE_DIR:${PROJECT_NAME}>/Database
  70. COMMAND ${CMAKE_COMMAND} -E copy_directory
  71. # 拷贝cart需要的数据库目录
  72. ${CART_DIRS}/USER
  73. $<TARGET_FILE_DIR:${PROJECT_NAME}>/USER
  74. COMMAND ${CMAKE_COMMAND} -E copy_directory
  75. # 拷贝cart需要的数据库目录
  76. ${CART_DIRS}/DATA
  77. $<TARGET_FILE_DIR:${PROJECT_NAME}>/DATA
  78. COMMAND ${CMAKE_COMMAND} -E copy_directory
  79. # 拷贝cart需要的数据库目录
  80. ${CART_DIRS}/INPUT
  81. $<TARGET_FILE_DIR:${PROJECT_NAME}>/INPUT
  82. COMMAND ${CMAKE_COMMAND} -E copy_directory
  83. # 拷贝cart需要的数据库目录
  84. ${CART_DIRS}/OUTPUT
  85. $<TARGET_FILE_DIR:${PROJECT_NAME}>/OUTPUT
  86. COMMAND ${CMAKE_COMMAND} -E copy
  87. # 拷贝cart需要的库
  88. ${CART_DIRS}/msvcr110.dll
  89. ${CART_DIRS}/svml_dispmd.dll
  90. ${CART_DIRS}/Licensecode.txt
  91. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  92. COMMAND ${CMAKE_COMMAND} -E copy_directory
  93. # 拷贝Modtran的Lib文件夹
  94. ${MODTRAN_DIRS}
  95. $<TARGET_FILE_DIR:${PROJECT_NAME}>/Modtran
  96. COMMAND ${CMAKE_COMMAND} -E copy_directory
  97. # 拷贝ParaView的Lib文件夹
  98. ${PARAVIEW_DIRS}
  99. $<TARGET_FILE_DIR:${PROJECT_NAME}>/ParaView
  100. COMMAND ${CMAKE_COMMAND} -E copy_directory
  101. # 拷贝mesh文件夹
  102. ${Gmsh_DIRS}/mesh
  103. $<TARGET_FILE_DIR:${PROJECT_NAME}>/mesh
  104. COMMAND ${CMAKE_COMMAND} -E copy_directory
  105. # 拷贝tecplot
  106. ${CMAKE_SOURCE_DIR}/extlib/tecplot
  107. $<TARGET_FILE_DIR:${PROJECT_NAME}>/Tecplot
  108. )
  109. endif()
  110. else()
  111. if(NOT EXISTS "$<TARGET_FILE_DIR:${PROJECT_NAME}>/GJDM.ini")
  112. get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
  113. get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
  114. foreach(_lib ${FastCAE_Runtimes_Libraries})
  115. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  116. COMMAND ${CMAKE_COMMAND} -E copy
  117. $<TARGET_LINKER_FILE:${_lib}>
  118. $<TARGET_SONAME_FILE:${_lib}>
  119. $<TARGET_FILE_DIR:PythonModule>
  120. )
  121. endforeach()
  122. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  123. COMMAND ${CMAKE_COMMAND} -E copy
  124. ${Gmsh_EXECUTABLE}
  125. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  126. COMMAND ${CMAKE_COMMAND} -E copy_directory
  127. # 拷贝python的python3.12文件夹
  128. ${Python_DIRS}/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}
  129. $<TARGET_FILE_DIR:PythonModule>/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}
  130. COMMAND ${CMAKE_COMMAND} -E copy_directory
  131. # 拷贝Qt图片格式支持文件
  132. ${_qt_bin_dir}/../plugins/imageformats
  133. $<TARGET_FILE_DIR:${PROJECT_NAME}>/imageformats
  134. COMMAND ${CMAKE_COMMAND} -E copy_directory
  135. ${_qt_bin_dir}/../plugins/platforms
  136. $<TARGET_FILE_DIR:${PROJECT_NAME}>/platforms
  137. COMMAND ${CMAKE_COMMAND} -E copy_directory
  138. ${_qt_bin_dir}/../plugins/platforminputcontexts
  139. $<TARGET_FILE_DIR:${PROJECT_NAME}>/platforminputcontexts
  140. COMMAND ${CMAKE_COMMAND} -E copy_directory
  141. ${_qt_bin_dir}/../plugins/xcbglintegrations
  142. $<TARGET_FILE_DIR:${PROJECT_NAME}>/xcbglintegrations
  143. COMMAND ${CMAKE_COMMAND} -E copy
  144. $<TARGET_LINKER_FILE:Qt5::XcbQpa>
  145. $<TARGET_SONAME_FILE:Qt5::XcbQpa>
  146. $<TARGET_FILE_DIR:PythonModule>
  147. )
  148. file(
  149. COPY
  150. # 拷贝Qt多国语言支持文件
  151. ${_qt_bin_dir}/../lib
  152. DESTINATION ${DEVRUNTIME_LIBDIR}/..
  153. USE_SOURCE_PERMISSIONS
  154. FILES_MATCHING
  155. PATTERN "cmake*" EXCLUDE
  156. PATTERN "pkgconfig*" EXCLUDE
  157. PATTERN "libicu*.so*"
  158. )
  159. endif()
  160. endif()
  161. #配置文件,python脚本,有可能会修改,每次构建都会拷贝
  162. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  163. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  164. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/GJDM.ini
  165. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/CAD.py
  166. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Case.py
  167. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/ControlPanel.py
  168. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Geometry.py
  169. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/MainWindow.py
  170. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Material.py
  171. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Mesh.py
  172. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Mesher.py
  173. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Post.py
  174. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/PostProcess.py
  175. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  176. )
  177. endif()