Fix the build on MSVC.

This commit is contained in:
waddlesplash 2017-03-16 15:33:30 -04:00 committed by endrift
parent 40e9dfcf5c
commit 15b4df3b2b
7 changed files with 20 additions and 7 deletions

View File

@ -195,6 +195,7 @@ if(WIN32)
source_group("Windows-specific code" FILES ${OS_SRC}) source_group("Windows-specific code" FILES ${OS_SRC})
if(MSVC) if(MSVC)
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN) add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
endif() endif()
elseif(UNIX) elseif(UNIX)
add_definitions(-DUSE_PTHREADS) add_definitions(-DUSE_PTHREADS)
@ -525,11 +526,13 @@ elseif(USE_ZLIB)
list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-zip.c list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-zip.c
${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/ioapi.c ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/ioapi.c
${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/unzip.c) ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/unzip.c)
if(NOT MSVC)
set_source_files_properties( set_source_files_properties(
${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/ioapi.c ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/ioapi.c
${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/unzip.c ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/unzip.c
PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter -Wno-implicit-function-declaration") PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter -Wno-implicit-function-declaration")
endif() endif()
endif()
if (USE_LZMA) if (USE_LZMA)
include_directories(AFTER ${CMAKE_CURRENT_SOURCE_DIR}/third-party/lzma) include_directories(AFTER ${CMAKE_CURRENT_SOURCE_DIR}/third-party/lzma)

View File

@ -46,6 +46,7 @@ typedef intptr_t ssize_t;
#define snprintf _snprintf #define snprintf _snprintf
#define strdup _strdup #define strdup _strdup
#define lseek _lseek #define lseek _lseek
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
#elif defined(__wii__) #elif defined(__wii__)
#include <sys/time.h> #include <sys/time.h>
typedef intptr_t ssize_t; typedef intptr_t ssize_t;

View File

@ -12,6 +12,10 @@ CXX_GUARD_START
#ifdef USE_PNG #ifdef USE_PNG
// png.h defines its own version of restrict which conflicts with mGBA's.
#ifdef restrict
#undef restrict
#endif
#include <png.h> #include <png.h>
struct VFile; struct VFile;

View File

@ -54,7 +54,7 @@ static void _disassemble(struct CLIDebuggerSystem* debugger, struct CLIDebugVect
static inline uint16_t _printLine(struct CLIDebugger* debugger, uint16_t address, int segment) { static inline uint16_t _printLine(struct CLIDebugger* debugger, uint16_t address, int segment) {
struct CLIDebuggerBackend* be = debugger->backend; struct CLIDebuggerBackend* be = debugger->backend;
struct LR35902InstructionInfo info = {}; struct LR35902InstructionInfo info = {0};
char disassembly[48]; char disassembly[48];
char* disPtr = disassembly; char* disPtr = disassembly;
if (segment >= 0) { if (segment >= 0) {

View File

@ -14,6 +14,7 @@
#include <QTimer> #include <QTimer>
#include <memory> #include <memory>
#include <functional>
#include <mgba/core/core.h> #include <mgba/core/core.h>
#include <mgba/core/thread.h> #include <mgba/core/thread.h>

View File

@ -49,6 +49,10 @@
#include <mgba/internal/gb/gb.h> #include <mgba/internal/gb/gb.h>
#include <mgba/internal/gb/video.h> #include <mgba/internal/gb/video.h>
#endif #endif
#ifdef M_CORE_GBA
#include <mgba/internal/gba/gba.h>
#include <mgba/internal/gba/video.h>
#endif
#include "feature/commandline.h" #include "feature/commandline.h"
#include "feature/sqlite3/no-intro.h" #include "feature/sqlite3/no-intro.h"
#include <mgba-util/vfs.h> #include <mgba-util/vfs.h>

View File

@ -53,7 +53,7 @@ struct VFile* VFileFromFD(int fd) {
} }
struct stat stat; struct stat stat;
if (fstat(fd, &stat) < 0 || S_ISDIR(stat.st_mode)) { if (fstat(fd, &stat) < 0 || (stat.st_mode & S_IFDIR)) {
close(fd); close(fd);
return 0; return 0;
} }