diff --git a/CMakeLists.txt b/CMakeLists.txt index a386b09f..a3c33934 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,41 @@ endif () add_definitions(-DERICWTOOLS_VERSION="${GIT_DESCRIBE}") +# MINGW stuff +if(MINGW) + find_file(LIB_GCC_S_SEH_1_DLL NAMES "libgcc_s_seh-1.dll") + find_file(LIB_STDCPP_6_DLL NAMES "libstdc++-6.dll") + find_file(LIB_WINPTHREAD_1_DLL NAMES "libwinpthread-1.dll") + + if(LIB_GCC_S_SEH_1_DLL) + install(FILES ${LIB_GCC_S_SEH_1_DLL} DESTINATION bin) + endif() + if(LIB_STDCPP_6_DLL) + install(FILES ${LIB_STDCPP_6_DLL} DESTINATION bin) + endif() + if(LIB_WINPTHREAD_1_DLL) + install(FILES ${LIB_WINPTHREAD_1_DLL} DESTINATION bin) + endif() +endif() + +function(copy_mingw_dlls TARGETNAME) + if (LIB_GCC_S_SEH_1_DLL) + add_custom_command(TARGET ${TARGETNAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${LIB_GCC_S_SEH_1_DLL}" "$" + ) + endif() + if (LIB_STDCPP_6_DLL) + add_custom_command(TARGET ${TARGETNAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${LIB_STDCPP_6_DLL}" "$" + ) + endif() + if (LIB_WINPTHREAD_1_DLL) + add_custom_command(TARGET ${TARGETNAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${LIB_WINPTHREAD_1_DLL}" "$" + ) + endif() +endfunction() + if (WIN32) set("NO_ITERATOR_DEBUG" FALSE CACHE BOOL "Whether to use MSVC iterator debugging or not") diff --git a/bspinfo/CMakeLists.txt b/bspinfo/CMakeLists.txt index a8987d74..3aab9bc2 100644 --- a/bspinfo/CMakeLists.txt +++ b/bspinfo/CMakeLists.txt @@ -6,5 +6,6 @@ add_custom_command(TARGET bspinfo POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" ) +copy_mingw_dlls(bspinfo) install(TARGETS bspinfo RUNTIME DESTINATION bin) diff --git a/bsputil/CMakeLists.txt b/bsputil/CMakeLists.txt index 7f8adde2..129b1bb7 100644 --- a/bsputil/CMakeLists.txt +++ b/bsputil/CMakeLists.txt @@ -14,5 +14,6 @@ add_custom_command(TARGET bsputil POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" ) +copy_mingw_dlls(bsputil) install(TARGETS bsputil RUNTIME DESTINATION bin) diff --git a/light/CMakeLists.txt b/light/CMakeLists.txt index 0b66db07..2e4646ab 100644 --- a/light/CMakeLists.txt +++ b/light/CMakeLists.txt @@ -145,5 +145,7 @@ if (embree_FOUND) endif() endif(embree_FOUND) +copy_mingw_dlls(light) + install(TARGETS light RUNTIME DESTINATION bin) install(FILES ../gpl_v3.txt DESTINATION bin) diff --git a/lightpreview/CMakeLists.txt b/lightpreview/CMakeLists.txt index 03ed3995..f0ec5e31 100644 --- a/lightpreview/CMakeLists.txt +++ b/lightpreview/CMakeLists.txt @@ -60,6 +60,7 @@ if (NOT EMBREE_TBB_DLL STREQUAL EMBREE_TBB_DLL-NOTFOUND) add_custom_command(TARGET lightpreview POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${EMBREE_TBB_DLL}" "$") endif() +copy_mingw_dlls(lightpreview) # Install Qt DLL's install(FILES $ DESTINATION bin) diff --git a/maputil/CMakeLists.txt b/maputil/CMakeLists.txt index 55deabed..dc24a42d 100644 --- a/maputil/CMakeLists.txt +++ b/maputil/CMakeLists.txt @@ -27,5 +27,6 @@ add_custom_command(TARGET maputil POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" ) +copy_mingw_dlls(maputil) install(TARGETS maputil RUNTIME DESTINATION bin) diff --git a/qbsp/CMakeLists.txt b/qbsp/CMakeLists.txt index 78d52de7..15075fc7 100644 --- a/qbsp/CMakeLists.txt +++ b/qbsp/CMakeLists.txt @@ -44,3 +44,5 @@ install(TARGETS qbsp RUNTIME DESTINATION bin) add_custom_command(TARGET qbsp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$") + +copy_mingw_dlls(qbsp) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 720257f4..8056ba96 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -43,5 +43,6 @@ if (NOT EMBREE_TBB_DLL STREQUAL EMBREE_TBB_DLL-NOTFOUND) add_custom_command(TARGET tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${EMBREE_TBB_DLL}" "$") endif() +copy_mingw_dlls(tests) add_definitions(-DHAVE_EMBREE) diff --git a/vis/CMakeLists.txt b/vis/CMakeLists.txt index 987542a0..a6b8c659 100644 --- a/vis/CMakeLists.txt +++ b/vis/CMakeLists.txt @@ -26,5 +26,6 @@ add_custom_command(TARGET vis POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" ) +copy_mingw_dlls(vis) install(TARGETS vis RUNTIME DESTINATION bin)