# HG changeset patch # User Sebastien Jodogne # Date 1432900674 -7200 # Node ID 0d9812893262caeb9678d16fb6038dc5edb4f09d # Parent 31b884468b058aa07e503644020f1e7cb9ec3b1d fix diff -r 31b884468b05 -r 0d9812893262 Resources/CMake/Compiler.cmake --- a/Resources/CMake/Compiler.cmake Fri May 29 13:23:54 2015 +0200 +++ b/Resources/CMake/Compiler.cmake Fri May 29 13:57:54 2015 +0200 @@ -71,9 +71,15 @@ # This is a patch for MinGW64 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++") - # This line is necessary to compile with recent versions of MinGW, - # otherwise "libwinpthread-1.dll" is not statically linked. - SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic") + CHECK_LIBRARY_EXISTS(winpthread pthread_create "" HAVE_WIN_PTHREAD) + if (HAVE_WIN_PTHREAD) + # This line is necessary to compile with recent versions of MinGW, + # otherwise "libwinpthread-1.dll" is not statically linked. + SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic") + add_definitions(-DHAVE_WIN_PTHREAD=1) + else() + add_definitions(-DHAVE_WIN_PTHREAD=0) + endif() endif() elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") diff -r 31b884468b05 -r 0d9812893262 Resources/Patches/glog-port-h-v2.diff --- a/Resources/Patches/glog-port-h-v2.diff Fri May 29 13:23:54 2015 +0200 +++ b/Resources/Patches/glog-port-h-v2.diff Fri May 29 13:57:54 2015 +0200 @@ -1,4 +1,13 @@ -124a125,149 +124,130c124,146 +< // ----------------------------------- THREADS +< typedef DWORD pthread_t; +< typedef DWORD pthread_key_t; +< typedef LONG pthread_once_t; +< enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock +< #define pthread_self GetCurrentThreadId +< #define pthread_equal(pthread_t_1, pthread_t_2) ((pthread_t_1)==(pthread_t_2)) +--- +> // ----------------------------------- SECURE STRINGS > > #if HAVE_SECURE_STRING_EXTENSIONS == 0 > // Emulation of "localtime_s" and "strerror_s" for old versions of MinGW @@ -21,9 +30,23 @@ > return strncpy(buf, str, buflen - 1); > } > #endif -> +131a148,149 > > #if !defined(__MINGW32__) || HAVE_SECURE_STRING_EXTENSIONS == 0 -135a161,162 +135a154,155 > #endif > +140a161,173 +> +> +> // ----------------------------------- THREADS +> +> #if !defined(__MINGW32__) || HAVE_WIN_PTHREAD == 0 +> typedef DWORD pthread_t; +> typedef DWORD pthread_key_t; +> typedef LONG pthread_once_t; +> enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock +> #define pthread_self GetCurrentThreadId +> #define pthread_equal(pthread_t_1, pthread_t_2) ((pthread_t_1)==(pthread_t_2)) +> #endif +>