InitRuntime.cmake 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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_directory
  24. # 拷贝python的Lib文件夹
  25. ${Python_DIRS}/Lib
  26. $<TARGET_FILE_DIR:${PROJECT_NAME}>/Lib
  27. COMMAND ${CMAKE_COMMAND} -E copy_directory
  28. # 拷贝python的DLLs文件夹
  29. ${Python_DIRS}/DLLs
  30. $<TARGET_FILE_DIR:${PROJECT_NAME}>/DLLs
  31. COMMAND ${CMAKE_COMMAND} -E copy_directory
  32. # 拷贝Qt图片格式支持文件
  33. ${_qt_bin_dir}/../plugins/imageformats
  34. $<TARGET_FILE_DIR:${PROJECT_NAME}>/imageformats
  35. COMMAND ${CMAKE_COMMAND} -E copy_directory
  36. # 拷贝Qt平台支持文件
  37. ${_qt_bin_dir}/../plugins/platforms
  38. $<TARGET_FILE_DIR:${PROJECT_NAME}>/platforms
  39. )
  40. endif()
  41. else()
  42. if(NOT EXISTS "$<TARGET_FILE_DIR:${PROJECT_NAME}>/FastCAE.ini")
  43. get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
  44. get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
  45. foreach(_lib ${FastCAE_Runtimes_Libraries})
  46. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  47. COMMAND ${CMAKE_COMMAND} -E copy
  48. $<TARGET_LINKER_FILE:${_lib}>
  49. $<TARGET_SONAME_FILE:${_lib}>
  50. $<TARGET_FILE_DIR:PythonModule>
  51. )
  52. endforeach()
  53. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  54. COMMAND ${CMAKE_COMMAND} -E copy
  55. ${Gmsh_EXECUTABLE}
  56. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  57. COMMAND ${CMAKE_COMMAND} -E copy_directory
  58. # 拷贝python的python3.7文件夹
  59. ${Python_DIRS}/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}
  60. $<TARGET_FILE_DIR:PythonModule>/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}
  61. COMMAND ${CMAKE_COMMAND} -E copy_directory
  62. # 拷贝Qt图片格式支持文件
  63. ${_qt_bin_dir}/../plugins/imageformats
  64. $<TARGET_FILE_DIR:${PROJECT_NAME}>/imageformats
  65. COMMAND ${CMAKE_COMMAND} -E copy_directory
  66. ${_qt_bin_dir}/../plugins/platforms
  67. $<TARGET_FILE_DIR:${PROJECT_NAME}>/platforms
  68. COMMAND ${CMAKE_COMMAND} -E copy_directory
  69. ${_qt_bin_dir}/../plugins/platforminputcontexts
  70. $<TARGET_FILE_DIR:${PROJECT_NAME}>/platforminputcontexts
  71. COMMAND ${CMAKE_COMMAND} -E copy_directory
  72. ${_qt_bin_dir}/../plugins/xcbglintegrations
  73. $<TARGET_FILE_DIR:${PROJECT_NAME}>/xcbglintegrations
  74. COMMAND ${CMAKE_COMMAND} -E copy
  75. $<TARGET_LINKER_FILE:Qt5::XcbQpa>
  76. $<TARGET_SONAME_FILE:Qt5::XcbQpa>
  77. $<TARGET_FILE_DIR:PythonModule>
  78. )
  79. file(
  80. COPY
  81. # 拷贝Qt多国语言支持文件
  82. ${_qt_bin_dir}/../lib
  83. DESTINATION ${DEVRUNTIME_LIBDIR}/..
  84. USE_SOURCE_PERMISSIONS
  85. FILES_MATCHING
  86. PATTERN "cmake*" EXCLUDE
  87. PATTERN "pkgconfig*" EXCLUDE
  88. PATTERN "libicu*.so*"
  89. )
  90. endif()
  91. endif()
  92. # FastCAE的配置文件,python脚本,有可能会修改,每次构建都会拷贝
  93. add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
  94. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  95. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/FastCAE.ini
  96. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/CAD.py
  97. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Case.py
  98. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/ControlPanel.py
  99. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Geometry.py
  100. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/MainWindow.py
  101. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Material.py
  102. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Mesh.py
  103. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Mesher.py
  104. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/Post.py
  105. ${CMAKE_SOURCE_DIR}/src/PythonModule/py/PostProcess.py
  106. $<TARGET_FILE_DIR:${PROJECT_NAME}>
  107. )
  108. endif()