Merge pull request #40 from waddlesplash/patch-1

All: initial work on MSVC support.
This commit is contained in:
endrift 2015-07-01 00:19:57 -07:00
commit ac7a9a8174
5 changed files with 16 additions and 9 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/build
*.user*
*~
*.swp

View File

@ -1,7 +1,11 @@
cmake_minimum_required(VERSION 2.6)
project(mGBA C)
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_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")
@ -187,7 +191,7 @@ if(APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.6")
endif()
if(NOT HAIKU)
if(NOT HAIKU AND NOT MSVC)
list(APPEND OS_LIB m)
endif()

View File

@ -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 { \
struct ARMDebugger* debugger; \
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 { \
struct ARMDebugger* debugger; \
FIND_DEBUGGER(debugger, cpu); \
@ -44,7 +44,7 @@ static uint32_t _popcount32(unsigned bits) {
if (_checkWatchpoints(debugger, address, &info, WIDTH)) { \
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) \

View File

@ -22,12 +22,14 @@
#include "version.h"
#ifdef _MSC_VER
typedef intptr_t off_t;
#include <sys/types.h>
typedef intptr_t ssize_t;
#define inline __inline
#define restrict __restrict
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define ftruncate _chsize
#define snprintf _snprintf
#else
#include <strings.h>
#include <unistd.h>

View File

@ -8,12 +8,12 @@
#include "util/common.h"
#ifndef strndup
#ifndef HAVE_STRNDUP
// This is sometimes a macro
char* strndup(const char* start, size_t len);
#endif
#ifndef strdup
#ifndef HAVE_STRDUP
char* strdup(const char* str);
#endif