Commits

Anonymous committed 7c9610d

Add support for MingW32

Comments (0)

Files changed (6)

projects/unix/Makefile

 ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
   OS = LINUX
 endif
+ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW")
+  OS = MINGW
+  CC = gcc
+endif
 ifeq ("$(OS)","NONE")
   $(error OS type "$(UNAME)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
 endif
     endif
   endif
 endif
+ifeq ($(OS), MINGW)
+  TARGET = mupen64plus.dll
+  LDFLAGS += -Wl,-Bsymbolic -shared -Wl,-export-all-symbols -Wl
+  LDLIBS += -lopengl32
+  # only export api symbols
+  LDFLAGS += -Wl,-version-script,$(SRCDIR)/api/api_export.ver
+endif
+
 ifeq ($(CPU_ENDIANNESS), BIG)
   CFLAGS += -DM64P_BIG_ENDIAN
 endif
 	$(SRCDIR)/memory/n64_cic_nus_6105.c \
 	$(SRCDIR)/memory/pif.c \
 	$(SRCDIR)/memory/tlb.c \
-	$(SRCDIR)/osal/dynamiclib_unix.c \
-	$(SRCDIR)/osal/files_unix.c \
 	$(SRCDIR)/plugin/plugin.c \
 	$(SRCDIR)/plugin/dummy_video.c \
 	$(SRCDIR)/plugin/dummy_audio.c \
 	$(SRCDIR)/r4300/recomp.c \
 	$(SRCDIR)/r4300/reset.c \
 	$(SRCDIR)/osd/screenshot.cpp
+ifeq ("$(OS)","MINGW")
+SOURCE += \
+	$(SRCDIR)/osal/dynamiclib_win32.c \
+	$(SRCDIR)/osal/files_win32.c
+else
+SOURCE += \
+	$(SRCDIR)/osal/dynamiclib_unix.c \
+	$(SRCDIR)/osal/files_unix.c
+endif
 
 ifeq ($(OSD), 1)
 SOURCE += \
 #include <dirent.h>
 #include <errno.h>
 
+#ifndef __MINGW32__
 #include <sys/mman.h>
+#endif
 
 #include "api/m64p_types.h"
 
             break;
         case 2:
             time(&curtime_time);
-#if defined(WIN32)
+#if defined(WIN32) && !defined(__MINGW32__)
             localtime_s(&curtime, &curtime_time);
+//this is quickfix; theres gotta be better solution
+#elif defined(__MINGW32__)
+            localtime(&curtime);
 #else
             localtime_r(&curtime_time, &curtime);
 #endif
 #define OSAL_FILES_H
 
 /* some file-related preprocessor definitions */
-#if defined(WIN32)
+#if defined(WIN32) && !defined(__MINGW32__)
   #include <io.h> // For _unlink()
   #define unlink _unlink
 
 #if !defined (OSAL_PREPROC_H)
 #define OSAL_PREPROC_H
 
-#if defined(WIN32)
+#if defined(WIN32) && !defined(__MINGW32__)
   #define osal_insensitive_strcmp(x, y) _stricmp(x, y)
   #define snprintf _snprintf
   #define strdup _strdup
 
 #if defined(__GNUC__)
 #include <unistd.h>
+#ifndef __MINGW32__
 #include <sys/mman.h>
 #endif
+#endif
 
 #include "api/m64p_types.h"
 #include "api/callbacks.h"