CopyMSVCBins.cmake 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. # Doesn't realy make sense anywhere else
  2. if(NOT MSVC)
  3. return()
  4. endif()
  5. # Internal variable to avoid copying more than once
  6. if(COPIED_DEPENDENCIES)
  7. return()
  8. endif()
  9. option(COPY_DEPENDENCIES "Automaticaly try copying all dependencies" ON)
  10. if(NOT COPY_DEPENDENCIES)
  11. return()
  12. endif()
  13. if(CMAKE_SIZEOF_VOID_P EQUAL 8)
  14. set(_bin_suffix 64)
  15. else()
  16. set(_bin_suffix 32)
  17. endif()
  18. file(GLOB FFMPEG_BIN_FILES
  19. "${FFMPEG_avcodec_INCLUDE_DIR}/../bin/avcodec-*.dll"
  20. "${FFMPEG_avcodec_INCLUDE_DIR}/../bin${_bin_suffix}/avcodec-*.dll"
  21. "${FFMPEG_avcodec_INCLUDE_DIR}/bin${_bin_suffix}/avcodec-*.dll"
  22. "${FFMPEG_avformat_INCLUDE_DIR}/../bin/avformat-*.dll"
  23. "${FFMPEG_avformat_INCLUDE_DIR}/../bin${_bin_suffix}/avformat-*.dll"
  24. "${FFMPEG_avformat_INCLUDE_DIR}/bin${_bin_suffix}/avformat-*.dll"
  25. "${FFMPEG_avutil_INCLUDE_DIR}/../bin/avutil-*.dll"
  26. "${FFMPEG_avutil_INCLUDE_DIR}/../bin${_bin_suffix}/avutil-*.dll"
  27. "${FFMPEG_avutil_INCLUDE_DIR}/bin${_bin_suffix}/avutil-*.dll"
  28. "${FFMPEG_avdevice_INCLUDE_DIR}/../bin/avdevice-*.dll"
  29. "${FFMPEG_avdevice_INCLUDE_DIR}/../bin${_bin_suffix}/avdevice-*.dll"
  30. "${FFMPEG_avdevice_INCLUDE_DIR}/bin${_bin_suffix}/avdevice-*.dll"
  31. "${FFMPEG_avfilter_INCLUDE_DIR}/../bin/avfilter-*.dll"
  32. "${FFMPEG_avfilter_INCLUDE_DIR}/../bin${_bin_suffix}/avfilter-*.dll"
  33. "${FFMPEG_avfilter_INCLUDE_DIR}/bin${_bin_suffix}/avfilter-*.dll"
  34. "${FFMPEG_postproc_INCLUDE_DIR}/../bin/postproc-*.dll"
  35. "${FFMPEG_postproc_INCLUDE_DIR}/../bin${_bin_suffix}/postproc-*.dll"
  36. "${FFMPEG_postproc_INCLUDE_DIR}/bin${_bin_suffix}/postproc-*.dll"
  37. "${FFMPEG_swscale_INCLUDE_DIR}/../bin/swscale-*.dll"
  38. "${FFMPEG_swscale_INCLUDE_DIR}/bin${_bin_suffix}/swscale-*.dll"
  39. "${FFMPEG_swscale_INCLUDE_DIR}/../bin${_bin_suffix}/swscale-*.dll"
  40. "${FFMPEG_swresample_INCLUDE_DIR}/../bin/swresample-*.dll"
  41. "${FFMPEG_swresample_INCLUDE_DIR}/../bin${_bin_suffix}/swresample-*.dll"
  42. "${FFMPEG_swresample_INCLUDE_DIR}/bin${_bin_suffix}/swresample-*.dll"
  43. "${FFMPEG_avcodec_INCLUDE_DIR}/../bin/libopus*.dll"
  44. "${FFMPEG_avcodec_INCLUDE_DIR}/../bin/opus*.dll"
  45. "${FFMPEG_avcodec_INCLUDE_DIR}/bin/libopus*.dll"
  46. "${FFMPEG_avcodec_INCLUDE_DIR}/bin/opus*.dll"
  47. "${FFMPEG_avcodec_INCLUDE_DIR}/../bin/libogg*.dll"
  48. "${FFMPEG_avcodec_INCLUDE_DIR}/../bin/libvorbis*.dll"
  49. "${FFMPEG_avcodec_INCLUDE_DIR}/bin/libogg*.dll"
  50. "${FFMPEG_avcodec_INCLUDE_DIR}/bin/libvorbis*.dll"
  51. "${FFMPEG_avcodec_INCLUDE_DIR}/../bin/libvpx*.dll"
  52. "${FFMPEG_avcodec_INCLUDE_DIR}/bin/libvpx*.dll"
  53. "${FFMPEG_avcodec_INCLUDE_DIR}/../bin${_bin_suffix}/libopus*.dll"
  54. "${FFMPEG_avcodec_INCLUDE_DIR}/../bin${_bin_suffix}/opus*.dll"
  55. "${FFMPEG_avcodec_INCLUDE_DIR}/bin${_bin_suffix}/libopus*.dll"
  56. "${FFMPEG_avcodec_INCLUDE_DIR}/bin${_bin_suffix}/opus*.dll"
  57. "${FFMPEG_avcodec_INCLUDE_DIR}/../bin/libbz2*.dll"
  58. "${FFMPEG_avcodec_INCLUDE_DIR}/../bin/zlib*.dll"
  59. "${FFMPEG_avcodec_INCLUDE_DIR}/bin/libbz2*.dll"
  60. "${FFMPEG_avcodec_INCLUDE_DIR}/bin/zlib*.dll"
  61. "${FFMPEG_avcodec_INCLUDE_DIR}/../bin${_bin_suffix}/libbz2*.dll"
  62. "${FFMPEG_avcodec_INCLUDE_DIR}/../bin${_bin_suffix}/zlib*.dll"
  63. "${FFMPEG_avcodec_INCLUDE_DIR}/bin${_bin_suffix}/libbz2*.dll"
  64. "${FFMPEG_avcodec_INCLUDE_DIR}/bin${_bin_suffix}/zlib*.dll"
  65. )
  66. file(GLOB X264_BIN_FILES
  67. "${X264_INCLUDE_DIR}/../bin${_bin_suffix}/libx264-*.dll"
  68. "${X264_INCLUDE_DIR}/../bin/libx264-*.dll"
  69. "${X264_INCLUDE_DIR}/bin/libx264-*.dll"
  70. "${X264_INCLUDE_DIR}/bin${_bin_suffix}/libx264-*.dll")
  71. file(GLOB FREETYPE_BIN_FILES
  72. "${FREETYPE_INCLUDE_DIR_ft2build}/../../bin${_bin_suffix}/libfreetype*-*.dll"
  73. "${FREETYPE_INCLUDE_DIR_ft2build}/../../bin/libfreetype*-*.dll"
  74. "${FREETYPE_INCLUDE_DIR_ft2build}/../bin${_bin_suffix}/libfreetype*-*.dll"
  75. "${FREETYPE_INCLUDE_DIR_ft2build}/../bin/libfreetype*-*.dll"
  76. "${FREETYPE_INCLUDE_DIR_ft2build}/bin/libfreetype*-*.dll"
  77. "${FREETYPE_INCLUDE_DIR_ft2build}/bin${_bin_suffix}/libfreetype*-*.dll")
  78. file(GLOB LIBFDK_BIN_FILES
  79. "${Libfdk_INCLUDE_DIR}/../bin${_bin_suffix}/libfdk*-*.dll"
  80. "${Libfdk_INCLUDE_DIR}/../bin/libfdk*-*.dll"
  81. "${Libfdk_INCLUDE_DIR}/bin/libfdk*-*.dll"
  82. "${Libfdk_INCLUDE_DIR}/bin${_bin_suffix}/libfdk*-*.dll")
  83. file(GLOB SSL_BIN_FILES
  84. "${SSL_INCLUDE_DIR}/../bin${_bin_suffix}/ssleay32*.dll"
  85. "${SSL_INCLUDE_DIR}/../bin${_bin_suffix}/libeay32*.dll"
  86. "${SSL_INCLUDE_DIR}/../bin/ssleay32*.dll"
  87. "${SSL_INCLUDE_DIR}/../bin/libeay32*.dll"
  88. "${SSL_INCLUDE_DIR}/bin${_bin_suffix}/ssleay32*.dll"
  89. "${SSL_INCLUDE_DIR}/bin${_bin_suffix}/libeay32*.dll"
  90. "${SSL_INCLUDE_DIR}/bin/ssleay32*.dll"
  91. "${SSL_INCLUDE_DIR}/bin/libeay32*.dll")
  92. file(GLOB CURL_BIN_FILES
  93. "${CURL_INCLUDE_DIR}/../build/Win${_bin_suffix}/VC12/DLL Release - DLL Windows SSPI/libcurl.dll"
  94. "${CURL_INCLUDE_DIR}/../bin${_bin_suffix}/libcurl*.dll"
  95. "${CURL_INCLUDE_DIR}/../bin${_bin_suffix}/curl*.dll"
  96. "${CURL_INCLUDE_DIR}/../bin/libcurl*.dll"
  97. "${CURL_INCLUDE_DIR}/../bin/curl*.dll"
  98. "${CURL_INCLUDE_DIR}/bin${_bin_suffix}/libcurl*.dll"
  99. "${CURL_INCLUDE_DIR}/bin${_bin_suffix}/curl*.dll"
  100. "${CURL_INCLUDE_DIR}/bin/libcurl*.dll"
  101. "${CURL_INCLUDE_DIR}/bin/curl*.dll"
  102. )
  103. if (ZLIB_LIB)
  104. GET_FILENAME_COMPONENT(ZLIB_BIN_PATH ${ZLIB_LIB} PATH)
  105. endif()
  106. file(GLOB ZLIB_BIN_FILES
  107. "${ZLIB_BIN_PATH}/zlib*.dll")
  108. if (NOT ZLIB_BIN_FILES)
  109. file(GLOB ZLIB_BIN_FILES
  110. "${ZLIB_INCLUDE_DIR}/../bin${_bin_suffix}/zlib*.dll"
  111. "${ZLIB_INCLUDE_DIR}/../bin/zlib*.dll"
  112. "${ZLIB_INCLUDE_DIR}/bin${_bin_suffix}/zlib*.dll"
  113. "${ZLIB_INCLUDE_DIR}/bin/zlib*.dll"
  114. )
  115. endif()
  116. if (CMAKE_CONFIGURATION_TYPES MATCHES "Debug")
  117. file(GLOB QT_DEBUG_BIN_FILES
  118. "${Qt5Core_DIR}/../../../bin/Qt5Cored.dll"
  119. "${Qt5Core_DIR}/../../../bin/Qt5Guid.dll"
  120. "${Qt5Core_DIR}/../../../bin/Qt5Widgetsd.dll"
  121. "${Qt5Core_DIR}/../../../bin/libGLESv2d.dll"
  122. "${Qt5Core_DIR}/../../../bin/libEGLd.dll")
  123. file(GLOB QT_DEBUG_PLAT_BIN_FILES
  124. "${Qt5Core_DIR}/../../../plugins/platforms/qwindowsd.dll")
  125. endif()
  126. if (CMAKE_CONFIGURATION_TYPES MATCHES "Rel")
  127. file(GLOB QT_BIN_FILES
  128. "${Qt5Core_DIR}/../../../bin/Qt5Core.dll"
  129. "${Qt5Core_DIR}/../../../bin/Qt5Gui.dll"
  130. "${Qt5Core_DIR}/../../../bin/Qt5Widgets.dll"
  131. "${Qt5Core_DIR}/../../../bin/libGLESv2.dll"
  132. "${Qt5Core_DIR}/../../../bin/libEGL.dll")
  133. file(GLOB QT_PLAT_BIN_FILES
  134. "${Qt5Core_DIR}/../../../plugins/platforms/qwindows.dll")
  135. endif()
  136. file(GLOB QT_ICU_BIN_FILES
  137. "${Qt5Core_DIR}/../../../bin/icu*.dll")
  138. set(ALL_BASE_BIN_FILES
  139. ${FFMPEG_BIN_FILES}
  140. ${X264_BIN_FILES}
  141. ${CURL_BIN_FILES}
  142. ${SSL_BIN_FILES}
  143. ${ZLIB_BIN_FILES}
  144. ${LIBFDK_BIN_FILES}
  145. ${FREETYPE_BIN_FILES}
  146. ${QT_ICU_BIN_FILES})
  147. set(ALL_REL_BIN_FILES
  148. ${QT_BIN_FILES})
  149. set(ALL_DBG_BIN_FILES
  150. ${QT_DEBUG_BIN_FILES})
  151. set(ALL_PLATFORM_BIN_FILES)
  152. set(ALL_PLATFORM_REL_BIN_FILES
  153. ${QT_PLAT_BIN_FILES})
  154. set(ALL_PLATFORM_DBG_BIN_FILES
  155. ${QT_DEBUG_PLAT_BIN_FILES})
  156. foreach(list
  157. ALL_BASE_BIN_FILES ALL_REL_BIN_FILES ALL_DBG_BIN_FILES
  158. ALL_PLATFORM_BIN_FILES ALL_PLATFORM_REL_BIN_FILES ALL_PLATFORM_DBG_BIN_FILES)
  159. if(${list})
  160. list(REMOVE_DUPLICATES ${list})
  161. endif()
  162. endforeach()
  163. message(STATUS "FFmpeg files: ${FFMPEG_BIN_FILES}")
  164. message(STATUS "x264 files: ${X264_BIN_FILES}")
  165. message(STATUS "Libfdk files: ${LIBFDK_BIN_FILES}")
  166. message(STATUS "Freetype files: ${FREETYPE_BIN_FILES}")
  167. message(STATUS "curl files: ${CURL_BIN_FILES}")
  168. message(STATUS "ssl files: ${SSL_BIN_FILES}")
  169. message(STATUS "zlib files: ${ZLIB_BIN_FILES}")
  170. message(STATUS "QT Debug files: ${QT_DEBUG_BIN_FILES}")
  171. message(STATUS "QT Debug Platform files: ${QT_DEBUG_PLAT_BIN_FILES}")
  172. message(STATUS "QT Release files: ${QT_BIN_FILES}")
  173. message(STATUS "QT Release Platform files: ${QT_PLAT_BIN_FILES}")
  174. message(STATUS "QT ICU files: ${QT_ICU_BIN_FILES}")
  175. foreach(BinFile ${ALL_BASE_BIN_FILES})
  176. message(STATUS "copying ${BinFile} to ${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}")
  177. file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/")
  178. endforeach()
  179. foreach(BinFile ${ALL_REL_BIN_FILES})
  180. message(STATUS "copying ${BinFile} to ${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r")
  181. file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/")
  182. endforeach()
  183. foreach(BinFile ${ALL_DBG_BIN_FILES})
  184. message(STATUS "copying ${BinFile} to ${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d")
  185. file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/")
  186. endforeach()
  187. foreach(BinFile ${ALL_PLATFORM_BIN_FILES})
  188. make_directory("${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/platforms")
  189. file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/platforms/")
  190. endforeach()
  191. foreach(BinFile ${ALL_PLATFORM_REL_BIN_FILES})
  192. make_directory("${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/platforms")
  193. file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/platforms/")
  194. endforeach()
  195. foreach(BinFile ${ALL_PLATFORM_DBG_BIN_FILES})
  196. make_directory("${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/platforms")
  197. file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/platforms/")
  198. endforeach()
  199. set(COPIED_DEPENDENCIES TRUE CACHE BOOL "Dependencies have been copied, set to false to copy again" FORCE)