mirror of https://github.com/mgba-emu/mgba.git
All: Initial work on MSVC support.
This commit is contained in:
parent
bddebef90b
commit
fc74db8c09
|
@ -1,3 +1,4 @@
|
||||||
/build
|
/build
|
||||||
|
*.user*
|
||||||
*~
|
*~
|
||||||
*.swp
|
*.swp
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
cmake_minimum_required(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
project(mGBA C)
|
project(mGBA C)
|
||||||
set(BINARY_NAME mgba CACHE INTERNAL "Name of output binaries")
|
set(BINARY_NAME mgba CACHE INTERNAL "Name of output binaries")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99")
|
if(NOT MSVC)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99")
|
||||||
|
else()
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS /wd4003 /wd4244 /wd4146")
|
||||||
|
endif()
|
||||||
set(USE_CLI_DEBUGGER ON CACHE BOOL "Whether or not to enable the CLI-mode ARM debugger")
|
set(USE_CLI_DEBUGGER ON CACHE BOOL "Whether or not to enable the CLI-mode ARM debugger")
|
||||||
set(USE_GDB_STUB ON CACHE BOOL "Whether or not to enable the GDB stub ARM debugger")
|
set(USE_GDB_STUB ON CACHE BOOL "Whether or not to enable the GDB stub ARM debugger")
|
||||||
set(USE_FFMPEG ON CACHE BOOL "Whether or not to enable FFmpeg support")
|
set(USE_FFMPEG ON CACHE BOOL "Whether or not to enable FFmpeg support")
|
||||||
|
@ -187,7 +191,7 @@ if(APPLE)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.6")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.6")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT HAIKU)
|
if(NOT HAIKU AND NOT MSVC)
|
||||||
list(APPEND OS_LIB m)
|
list(APPEND OS_LIB m)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -29,14 +29,14 @@ static uint32_t _popcount32(unsigned bits) {
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CREATE_SHIM(NAME, RETURN, TYPES, ARGS...) \
|
#define CREATE_SHIM(NAME, RETURN, TYPES, ...) \
|
||||||
static RETURN ARMDebuggerShim_ ## NAME TYPES { \
|
static RETURN ARMDebuggerShim_ ## NAME TYPES { \
|
||||||
struct ARMDebugger* debugger; \
|
struct ARMDebugger* debugger; \
|
||||||
FIND_DEBUGGER(debugger, cpu); \
|
FIND_DEBUGGER(debugger, cpu); \
|
||||||
return debugger->originalMemory.NAME(cpu, ARGS); \
|
return debugger->originalMemory.NAME(cpu, __VA_ARGS__); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CREATE_WATCHPOINT_SHIM(NAME, WIDTH, RETURN, TYPES, ARGS...) \
|
#define CREATE_WATCHPOINT_SHIM(NAME, WIDTH, RETURN, TYPES, ...) \
|
||||||
static RETURN ARMDebuggerShim_ ## NAME TYPES { \
|
static RETURN ARMDebuggerShim_ ## NAME TYPES { \
|
||||||
struct ARMDebugger* debugger; \
|
struct ARMDebugger* debugger; \
|
||||||
FIND_DEBUGGER(debugger, cpu); \
|
FIND_DEBUGGER(debugger, cpu); \
|
||||||
|
@ -44,7 +44,7 @@ static uint32_t _popcount32(unsigned bits) {
|
||||||
if (_checkWatchpoints(debugger, address, &info, WIDTH)) { \
|
if (_checkWatchpoints(debugger, address, &info, WIDTH)) { \
|
||||||
ARMDebuggerEnter(debugger, DEBUGGER_ENTER_WATCHPOINT, &info); \
|
ARMDebuggerEnter(debugger, DEBUGGER_ENTER_WATCHPOINT, &info); \
|
||||||
} \
|
} \
|
||||||
return debugger->originalMemory.NAME(cpu, ARGS); \
|
return debugger->originalMemory.NAME(cpu, __VA_ARGS__); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CREATE_MULTIPLE_WATCHPOINT_SHIM(NAME) \
|
#define CREATE_MULTIPLE_WATCHPOINT_SHIM(NAME) \
|
||||||
|
|
|
@ -22,12 +22,14 @@
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
typedef intptr_t off_t;
|
#include <sys/types.h>
|
||||||
typedef intptr_t ssize_t;
|
typedef intptr_t ssize_t;
|
||||||
|
#define inline __inline
|
||||||
#define restrict __restrict
|
#define restrict __restrict
|
||||||
#define strcasecmp _stricmp
|
#define strcasecmp _stricmp
|
||||||
#define strncasecmp _strnicmp
|
#define strncasecmp _strnicmp
|
||||||
#define ftruncate _chsize
|
#define ftruncate _chsize
|
||||||
|
#define snprintf _snprintf
|
||||||
#else
|
#else
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
|
|
||||||
#include "util/common.h"
|
#include "util/common.h"
|
||||||
|
|
||||||
#ifndef strndup
|
#ifndef HAVE_STRNDUP
|
||||||
// This is sometimes a macro
|
// This is sometimes a macro
|
||||||
char* strndup(const char* start, size_t len);
|
char* strndup(const char* start, size_t len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef strdup
|
#ifndef HAVE_STRDUP
|
||||||
char* strdup(const char* str);
|
char* strdup(const char* str);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue