diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a153e23d..b193ff600 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -278,7 +278,7 @@ else() if(MSVC) set(PTHREAD_NAMES pthreadVC2) elseif(MINGW) - set(PTHREAD_NAMES "winpthread-1" pthreadGC2) + set(PTHREAD_NAMES "winpthread-1" "pthreadGC2" "libwinpthread-1") endif() find_library(PTHREAD_LIBRARY NAMES pthread ${PTHREAD_NAMES} PATHS ${PROJECT_SOURCE_DIR}/dependencies/lib) mark_as_advanced(PTHREAD_LIBRARY) @@ -379,6 +379,25 @@ if(MSVC OR MINGW) add_custom_target(stkshaders SOURCES ${STK_SHADERS}) endif() +if(MINGW) + find_library(LIBGCC NAMES "libgcc_s_dw2-1.dll" "libgcc_s_sjlj-1.dll" PATHS ${CMAKE_FIND_ROOT_PATH}) + if(LIBGCC) + file(COPY ${LIBGCC} DESTINATION ${CMAKE_BINARY_DIR}/bin/) + endif() + find_library(LIBSTDCPP NAMES "libstdc++-6.dll" PATHS ${CMAKE_FIND_ROOT_PATH}) + if(LIBSTDCPP) + file(COPY ${LIBSTDCPP} DESTINATION ${CMAKE_BINARY_DIR}/bin/) + endif() + find_library(LIBOPENMP NAMES "libgomp-1.dll" PATHS ${CMAKE_FIND_ROOT_PATH}) + if(LIBOPENMP) + file(COPY ${LIBOPENMP} DESTINATION ${CMAKE_BINARY_DIR}/bin/) + endif() + find_library(LIBPTHREAD NAMES "winpthread-1.dll" "pthreadGC2.dll" "libwinpthread-1.dll" PATHS ${CMAKE_FIND_ROOT_PATH}) + if(LIBPTHREAD) + file(COPY ${LIBPTHREAD} DESTINATION ${CMAKE_BINARY_DIR}/bin/) + endif() +endif() + # Optional tools add_subdirectory(tools/font_tool) @@ -441,3 +460,8 @@ install(FILES data/supertuxkart_32.png DESTINATION share/icons/hicolor/32x32/app install(FILES data/supertuxkart_128.png DESTINATION share/icons/hicolor/128x128/apps RENAME supertuxkart.png) install(FILES data/supertuxkart_32.png data/supertuxkart_128.png DESTINATION share/pixmaps) install(FILES data/supertuxkart.appdata.xml DESTINATION share/appdata) + +if(MINGW) + install(DIRECTORY ${CMAKE_BINARY_DIR}/bin/ DESTINATION ${STK_INSTALL_BINARY_DIR} + FILES_MATCHING PATTERN "*.dll") +endif() diff --git a/cmake/Toolchain-mingw.cmake b/cmake/Toolchain-mingw.cmake index 1ecb47ac2..56908e12e 100644 --- a/cmake/Toolchain-mingw.cmake +++ b/cmake/Toolchain-mingw.cmake @@ -7,11 +7,11 @@ SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++-posix) SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres) # here is the target environment located -SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 ${PROJECT_SOURCE_DIR}/dependencies) +SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 /usr/lib/gcc/i686-w64-mingw32/4.9-posix ${PROJECT_SOURCE_DIR}/dependencies) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search # programs in the host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)