mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-27 09:12:46 +01:00
Fix MinGW build
This commit is contained in:
parent
2a4b698f8e
commit
459502e48c
9 changed files with 42 additions and 22 deletions
|
@ -19,12 +19,15 @@ endif()
|
||||||
|
|
||||||
add_executable(citra ${SRCS} ${HEADERS})
|
add_executable(citra ${SRCS} ${HEADERS})
|
||||||
target_link_libraries(citra core common video_core)
|
target_link_libraries(citra core common video_core)
|
||||||
target_link_libraries(citra ${OPENGL_gl_LIBRARY} ${GLFW_LIBRARIES} inih)
|
target_link_libraries(citra ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih)
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
target_link_libraries(citra iconv pthread ${COREFOUNDATION_LIBRARY})
|
target_link_libraries(citra iconv pthread ${COREFOUNDATION_LIBRARY})
|
||||||
elseif (WIN32)
|
elseif (WIN32)
|
||||||
target_link_libraries(citra winmm)
|
target_link_libraries(citra winmm)
|
||||||
|
if (MINGW)
|
||||||
|
target_link_libraries(citra iconv)
|
||||||
|
endif()
|
||||||
else() # Unix
|
else() # Unix
|
||||||
target_link_libraries(citra pthread rt)
|
target_link_libraries(citra pthread rt)
|
||||||
target_link_libraries(citra ${X11_X11_LIB} ${X11_Xi_LIB} ${X11_Xcursor_LIB} ${X11_Xrandr_LIB} ${X11_xv86vmode_LIB})
|
target_link_libraries(citra ${X11_X11_LIB} ${X11_Xi_LIB} ${X11_Xcursor_LIB} ${X11_Xrandr_LIB} ${X11_xv86vmode_LIB})
|
||||||
|
|
|
@ -50,11 +50,13 @@ private:
|
||||||
#elif defined _WIN32
|
#elif defined _WIN32
|
||||||
|
|
||||||
// Check MSC ver
|
// Check MSC ver
|
||||||
#if !defined _MSC_VER || _MSC_VER <= 1000
|
#if defined _MSC_VER && _MSC_VER <= 1000
|
||||||
#error needs at least version 1000 of MSC
|
#error needs at least version 1000 of MSC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef NOMINMAX
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
|
|
||||||
// Memory leak checks
|
// Memory leak checks
|
||||||
#define CHECK_HEAP_INTEGRITY()
|
#define CHECK_HEAP_INTEGRITY()
|
||||||
|
|
|
@ -28,7 +28,7 @@ template<> struct CompileTimeAssert<true> {};
|
||||||
|
|
||||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _MSC_VER
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
@ -72,7 +72,7 @@ inline u64 _rotr64(u64 x, unsigned int shift){
|
||||||
return (x >> n) | (x << (64 - n));
|
return (x >> n) | (x << (64 - n));
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // WIN32
|
#else // _MSC_VER
|
||||||
// Function Cross-Compatibility
|
// Function Cross-Compatibility
|
||||||
#define strcasecmp _stricmp
|
#define strcasecmp _stricmp
|
||||||
#define strncasecmp _strnicmp
|
#define strncasecmp _strnicmp
|
||||||
|
@ -135,7 +135,7 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#define Crash() {DebugBreak();}
|
#define Crash() {DebugBreak();}
|
||||||
#endif // M_IX86
|
#endif // M_IX86
|
||||||
#endif // WIN32 ndef
|
#endif // _MSC_VER ndef
|
||||||
|
|
||||||
// Dolphin's min and max functions
|
// Dolphin's min and max functions
|
||||||
#undef min
|
#undef min
|
||||||
|
@ -163,7 +163,7 @@ inline u32 swap24(const u8* _data) {return (_data[0] << 16) | (_data[1] << 8) |
|
||||||
#undef swap64
|
#undef swap64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _MSC_VER
|
||||||
inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);}
|
inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);}
|
||||||
inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);}
|
inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);}
|
||||||
inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);}
|
inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);}
|
||||||
|
|
|
@ -104,7 +104,7 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int
|
||||||
#endif // loglevel
|
#endif // loglevel
|
||||||
#endif // logging
|
#endif // logging
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef MSVC_VER
|
||||||
#ifndef __func__
|
#ifndef __func__
|
||||||
#define __func__ __FUNCTION__
|
#define __func__ __FUNCTION__
|
||||||
#endif
|
#endif
|
||||||
|
@ -149,17 +149,17 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int
|
||||||
#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
|
#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
|
||||||
|
|
||||||
#ifndef GEKKO
|
#ifndef GEKKO
|
||||||
#ifdef _WIN32
|
#ifdef MSVC_VER
|
||||||
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
|
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
|
||||||
if (!(_a_)) {\
|
if (!(_a_)) {\
|
||||||
if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \
|
if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \
|
||||||
}
|
}
|
||||||
#else // not win32
|
#else // not msvc
|
||||||
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
|
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
|
||||||
if (!(_a_)) {\
|
if (!(_a_)) {\
|
||||||
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \
|
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \
|
||||||
}
|
}
|
||||||
#endif // WIN32
|
#endif // MSVC_VER
|
||||||
#else // GEKKO
|
#else // GEKKO
|
||||||
#define _assert_msg_(_t_, _a_, _fmt_, ...)
|
#define _assert_msg_(_t_, _a_, _fmt_, ...)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,7 @@ extern bool MsgAlert(bool yes_no, int Style, const char* format, ...)
|
||||||
void SetEnableAlert(bool enable);
|
void SetEnableAlert(bool enable);
|
||||||
|
|
||||||
#ifndef GEKKO
|
#ifndef GEKKO
|
||||||
#ifdef _WIN32
|
#ifdef MSVC_VER
|
||||||
#define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__)
|
#define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__)
|
||||||
#define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__)
|
#define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__)
|
||||||
#define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__)
|
#define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__)
|
||||||
|
|
|
@ -71,14 +71,18 @@
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#ifndef NOMINMAX
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
#define EMU_FASTCALL __fastcall
|
#define EMU_FASTCALL __fastcall
|
||||||
|
|
||||||
|
#ifdef _MSVC_VER
|
||||||
inline struct tm* localtime_r(const time_t *clock, struct tm *result) {
|
inline struct tm* localtime_r(const time_t *clock, struct tm *result) {
|
||||||
if (localtime_s(result, clock) == 0)
|
if (localtime_s(result, clock) == 0)
|
||||||
return result;
|
return result;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef MSVC_VER
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
#else
|
#else
|
||||||
|
@ -45,7 +45,7 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar
|
||||||
{
|
{
|
||||||
int writtenCount;
|
int writtenCount;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef MSVC_VER
|
||||||
// You would think *printf are simple, right? Iterate on each character,
|
// You would think *printf are simple, right? Iterate on each character,
|
||||||
// if it's a format specifier handle it properly, etc.
|
// if it's a format specifier handle it properly, etc.
|
||||||
//
|
//
|
||||||
|
@ -410,7 +410,7 @@ std::string UriEncode(const std::string & sSrc)
|
||||||
return sResult;
|
return sResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef MSVC_VER
|
||||||
|
|
||||||
std::string UTF16ToUTF8(const std::u16string& input)
|
std::string UTF16ToUTF8(const std::u16string& input)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace Common
|
||||||
|
|
||||||
int CurrentThreadId()
|
int CurrentThreadId()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef MSVC_VER
|
||||||
return GetCurrentThreadId();
|
return GetCurrentThreadId();
|
||||||
#elif defined __APPLE__
|
#elif defined __APPLE__
|
||||||
return mach_thread_self();
|
return mach_thread_self();
|
||||||
|
@ -27,6 +27,14 @@ int CurrentThreadId()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
// Supporting functions
|
||||||
|
void SleepCurrentThread(int ms)
|
||||||
|
{
|
||||||
|
Sleep(ms);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MSVC_VER
|
||||||
|
|
||||||
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask)
|
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask)
|
||||||
{
|
{
|
||||||
|
@ -38,12 +46,6 @@ void SetCurrentThreadAffinity(u32 mask)
|
||||||
SetThreadAffinityMask(GetCurrentThread(), mask);
|
SetThreadAffinityMask(GetCurrentThread(), mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Supporting functions
|
|
||||||
void SleepCurrentThread(int ms)
|
|
||||||
{
|
|
||||||
Sleep(ms);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SwitchCurrentThread()
|
void SwitchCurrentThread()
|
||||||
{
|
{
|
||||||
SwitchToThread();
|
SwitchToThread();
|
||||||
|
@ -82,7 +84,7 @@ void SetCurrentThreadName(const char* szThreadName)
|
||||||
{}
|
{}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // !WIN32, so must be POSIX threads
|
#else // !MSVC_VER, so must be POSIX threads
|
||||||
|
|
||||||
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask)
|
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask)
|
||||||
{
|
{
|
||||||
|
@ -106,6 +108,7 @@ void SetCurrentThreadAffinity(u32 mask)
|
||||||
SetThreadAffinity(pthread_self(), mask);
|
SetThreadAffinity(pthread_self(), mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
void SleepCurrentThread(int ms)
|
void SleepCurrentThread(int ms)
|
||||||
{
|
{
|
||||||
usleep(1000 * ms);
|
usleep(1000 * ms);
|
||||||
|
@ -115,7 +118,10 @@ void SwitchCurrentThread()
|
||||||
{
|
{
|
||||||
usleep(1000 * 1);
|
usleep(1000 * 1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// MinGW with the POSIX threading model does not support pthread_setname_np
|
||||||
|
#if !defined(_WIN32) || defined(MSVC_VER)
|
||||||
void SetCurrentThreadName(const char* szThreadName)
|
void SetCurrentThreadName(const char* szThreadName)
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
@ -126,6 +132,7 @@ void SetCurrentThreadName(const char* szThreadName)
|
||||||
pthread_setname_np(pthread_self(), szThreadName);
|
pthread_setname_np(pthread_self(), szThreadName);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,10 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#undef __WIN32__
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "core/arm/skyeye_common/armdefs.h"
|
#include "core/arm/skyeye_common/armdefs.h"
|
||||||
#include "core/arm/skyeye_common/armmmu.h"
|
#include "core/arm/skyeye_common/armmmu.h"
|
||||||
#include "arm_dyncom_thumb.h"
|
#include "arm_dyncom_thumb.h"
|
||||||
|
|
Loading…
Reference in a new issue