From d7343b6c930d22857f858929ea684acbbeefe482 Mon Sep 17 00:00:00 2001 From: adrido Date: Tue, 27 Jun 2017 11:54:40 +0200 Subject: Fix msvc annoyances (#5963) * MSVC: Fix '/std:c++11' is not a valid compiler option * MSVC/MINGW: Define 'WIN32_LEAN_AND_MEAN' for the whole project In some obscure cases 'Windows.h" got includet before that definition, which leaded to compilation warnings+errors * MSVC: '/arch:SSE' is only available for x86 * MSVC: Fix float conversation * MSVC/MINGW: use winthreads on Windows * MSVC: 'USE_CMAKE_CONFIG' might be already definied by CMake build system * MSVC: Use all available cpu cores for compiling * Add missing include ctime and use std::time_t --- src/threading/thread.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/threading') diff --git a/src/threading/thread.cpp b/src/threading/thread.cpp index 8f54fb762..09cc7d836 100644 --- a/src/threading/thread.cpp +++ b/src/threading/thread.cpp @@ -261,10 +261,14 @@ bool Thread::bindToProcessor(unsigned int proc_number) return false; -#elif USE_WIN_THREADS +#elif _MSC_VER return SetThreadAffinityMask(getThreadHandle(), 1 << proc_number); +#elif __MINGW32__ + + return SetThreadAffinityMask(pthread_gethandle(getThreadHandle()), 1 << proc_number); + #elif __FreeBSD_version >= 702106 || defined(__linux__) cpu_set_t cpuset; @@ -309,10 +313,14 @@ bool Thread::bindToProcessor(unsigned int proc_number) bool Thread::setPriority(int prio) { -#if USE_WIN_THREADS +#ifdef _MSC_VER return SetThreadPriority(getThreadHandle(), prio); +#elif __MINGW32__ + + return SetThreadPriority(pthread_gethandle(getThreadHandle()), prio); + #else struct sched_param sparam; -- cgit v1.2.3