1
0
Fork 0

Merge pull request #2172 from jroweboy/fix-mingw

Fix mingw compilation support
This commit is contained in:
bunnei 2016-11-15 20:07:23 -05:00 committed by GitHub
commit fb13bfe693
5 changed files with 20 additions and 6 deletions

View File

@ -68,6 +68,15 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (NOT MSVC) if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
if (MINGW)
add_definitions(-DMINGW_HAS_SECURE_API)
if (MINGW_STATIC_BUILD)
add_definitions(-DQT_STATICPLUGIN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
endif()
endif()
else() else()
# Silence "deprecation" warnings # Silence "deprecation" warnings
add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /D_SCL_SECURE_NO_WARNINGS) add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /D_SCL_SECURE_NO_WARNINGS)
@ -175,7 +184,7 @@ IF (APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
ELSEIF(MINGW) ELSEIF(MINGW)
# PSAPI is the Process Status API # PSAPI is the Process Status API
set(PLATFORM_LIBRARIES winmm ws2_32 psapi) set(PLATFORM_LIBRARIES winmm ws2_32 psapi imm32 version)
# WSAPoll functionality doesn't exist before WinNT 6.x (Vista and up) # WSAPoll functionality doesn't exist before WinNT 6.x (Vista and up)
add_definitions(-D_WIN32_WINNT=0x0600) add_definitions(-D_WIN32_WINNT=0x0600)

View File

@ -512,7 +512,7 @@ typedef int MpSocket;
#ifndef _WIN32 #ifndef _WIN32
typedef pthread_t MicroProfileThread; typedef pthread_t MicroProfileThread;
#elif defined(_WIN32) #elif defined(_MSC_VER)
typedef HANDLE MicroProfileThread; typedef HANDLE MicroProfileThread;
#else #else
typedef std::thread* MicroProfileThread; typedef std::thread* MicroProfileThread;
@ -921,7 +921,7 @@ void MicroProfileThreadJoin(MicroProfileThread* pThread)
int r = pthread_join(*pThread, 0); int r = pthread_join(*pThread, 0);
MP_ASSERT(r == 0); MP_ASSERT(r == 0);
} }
#elif defined(_WIN32) #elif defined(_MSC_VER)
typedef HANDLE MicroProfileThread; typedef HANDLE MicroProfileThread;
DWORD _stdcall ThreadTrampoline(void* pFunc) DWORD _stdcall ThreadTrampoline(void* pFunc)
{ {

View File

@ -48,6 +48,10 @@
#include "qhexedit.h" #include "qhexedit.h"
#include "video_core/video_core.h" #include "video_core/video_core.h"
#ifdef QT_STATICPLUGIN
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
#endif
GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
Pica::g_debug_context = Pica::DebugContext::Construct(); Pica::g_debug_context = Pica::DebugContext::Construct();

View File

@ -11,7 +11,8 @@
#include "common/common_paths.h" #include "common/common_paths.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/string_util.h" #include "common/string_util.h"
#ifdef _MSC_VER
#ifdef _WIN32
#include <codecvt> #include <codecvt>
#include <Windows.h> #include <Windows.h>
#include "common/common_funcs.h" #include "common/common_funcs.h"
@ -270,7 +271,7 @@ std::string ReplaceAll(std::string result, const std::string& src, const std::st
return result; return result;
} }
#ifdef _MSC_VER #ifdef _WIN32
std::string UTF16ToUTF8(const std::u16string& input) { std::string UTF16ToUTF8(const std::u16string& input) {
#if _MSC_VER >= 1900 #if _MSC_VER >= 1900

View File

@ -14,7 +14,7 @@
#include <numeric> #include <numeric>
#include <fcntl.h> #include <fcntl.h>
#ifdef _MSC_VER #ifdef _WIN32
#include <WinSock2.h> #include <WinSock2.h>
#include <common/x64/abi.h> #include <common/x64/abi.h>
#include <io.h> #include <io.h>