Skip to content

Commit

Permalink
build: copy + install mingw dll's libgcc_s_seh-1.dll, libstdc++-6.dll…
Browse files Browse the repository at this point in the history
…, libwinpthread-1.dll
  • Loading branch information
ericwa committed Sep 16, 2023
1 parent d189145 commit 872f5fe
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 0 deletions.
35 changes: 35 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}" "$<TARGET_FILE_DIR:${TARGETNAME}>"
)
endif()
if (LIB_STDCPP_6_DLL)
add_custom_command(TARGET ${TARGETNAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${LIB_STDCPP_6_DLL}" "$<TARGET_FILE_DIR:${TARGETNAME}>"
)
endif()
if (LIB_WINPTHREAD_1_DLL)
add_custom_command(TARGET ${TARGETNAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${LIB_WINPTHREAD_1_DLL}" "$<TARGET_FILE_DIR:${TARGETNAME}>"
)
endif()
endfunction()

if (WIN32)
set("NO_ITERATOR_DEBUG" FALSE CACHE BOOL "Whether to use MSVC iterator debugging or not")

Expand Down
1 change: 1 addition & 0 deletions bspinfo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ add_custom_command(TARGET bspinfo POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:TBB::tbb>" "$<TARGET_FILE_DIR:bspinfo>"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:TBB::tbbmalloc>" "$<TARGET_FILE_DIR:bspinfo>"
)
copy_mingw_dlls(bspinfo)

install(TARGETS bspinfo RUNTIME DESTINATION bin)
1 change: 1 addition & 0 deletions bsputil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ add_custom_command(TARGET bsputil POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:TBB::tbb>" "$<TARGET_FILE_DIR:bsputil>"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:TBB::tbbmalloc>" "$<TARGET_FILE_DIR:bsputil>"
)
copy_mingw_dlls(bsputil)

install(TARGETS bsputil RUNTIME DESTINATION bin)
2 changes: 2 additions & 0 deletions light/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions lightpreview/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}" "$<TARGET_FILE_DIR:lightpreview>")
endif()
copy_mingw_dlls(lightpreview)

# Install Qt DLL's
install(FILES $<TARGET_FILE:Qt5::Widgets> DESTINATION bin)
Expand Down
1 change: 1 addition & 0 deletions maputil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ add_custom_command(TARGET maputil POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:TBB::tbb>" "$<TARGET_FILE_DIR:maputil>"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:TBB::tbbmalloc>" "$<TARGET_FILE_DIR:maputil>"
)
copy_mingw_dlls(maputil)

install(TARGETS maputil RUNTIME DESTINATION bin)
2 changes: 2 additions & 0 deletions qbsp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ install(TARGETS qbsp RUNTIME DESTINATION bin)
add_custom_command(TARGET qbsp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:TBB::tbb>" "$<TARGET_FILE_DIR:qbsp>"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:TBB::tbbmalloc>" "$<TARGET_FILE_DIR:qbsp>")

copy_mingw_dlls(qbsp)
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}" "$<TARGET_FILE_DIR:tests>")
endif()
copy_mingw_dlls(tests)

add_definitions(-DHAVE_EMBREE)
1 change: 1 addition & 0 deletions vis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ add_custom_command(TARGET vis POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:TBB::tbb>" "$<TARGET_FILE_DIR:vis>"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:TBB::tbbmalloc>" "$<TARGET_FILE_DIR:vis>"
)
copy_mingw_dlls(vis)

install(TARGETS vis RUNTIME DESTINATION bin)

0 comments on commit 872f5fe

Please sign in to comment.