Commits

ecsv committed dbf4af6

Fix boost::filesystem usage for MinGW

  • Participants
  • Parent commits f299afe

Comments (0)

Files changed (4)

File projects/unix/Makefile

   SO_EXTENSION = dll
   SHARED = -shared
   PIC = 0
+  BOOST_SUFFIX = -mt
+  BOOST_THREAD_SUFFIX = _win32-mt
 endif
 ifeq ("$(OS)","NONE")
   $(error OS type "$(UNAME)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
 CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src -I../../src/Glitch64/inc -DGCC
 CXXFLAGS += -fvisibility-inlines-hidden
 LDFLAGS += $(SHARED)
-LDLIBS += -lboost_filesystem-mt -lboost_system-mt -lboost_thread-mt
+BOOST_SUFFIX ?= -mt
+BOOST_THREAD_SUFFIX ?= -mt
+LDLIBS += -lboost_filesystem$(BOOST_SUFFIX) -lboost_system$(BOOST_SUFFIX) -lboost_thread$(BOOST_THREAD_SUFFIX)
 
 ifeq ($(OS), MINGW)
-  CFLAGS += -lpthread
+  CFLAGS += -DBOOST_THREAD_USE_LIB
   LDLIBS += -lpthread
 else
   CFLAGS += -pthread

File src/Glide64/Main.cpp

 #include <stdarg.h>
 int  ghq_dmptex_toggle_key = 0;
 #endif
+#if defined(__MINGW32__)
+#define swprintf _snwprintf
+#define vswprintf _vsnwprintf
+#endif
 
 #define G64_VERSION "G64 Mk2"
 #define RELTIME "Date: " __DATE__// " Time: " __TIME__

File src/GlideHQ/TxCache.cpp

     boost::filesystem::create_directory(cachepath);
 
     /* Ugly hack to enable fopen/gzopen in Win9x */
-#ifdef WIN32
+#ifdef BOOST_WINDOWS_API
     wchar_t curpath[MAX_PATH];
     GETCWD(MAX_PATH, curpath);
-    CHDIR(cachepath.string().c_str());
+    CHDIR(cachepath.wstring().c_str());
 #else
     char curpath[MAX_PATH];
     wcstombs(cbuf, cachepath.wstring().c_str(), MAX_PATH);
 
   boost::filesystem::wpath cachepath(path);
 
-#ifdef WIN32
+#ifdef BOOST_WINDOWS_API
   wchar_t curpath[MAX_PATH];
   GETCWD(MAX_PATH, curpath);
-  CHDIR(cachepath.string().c_str());
+  CHDIR(cachepath.wstring().c_str());
 #else
   char curpath[MAX_PATH];
   wcstombs(cbuf, cachepath.wstring().c_str(), MAX_PATH);

File src/GlideHQ/TxHiResCache.cpp

 #ifdef WIN32
   wchar_t curpath[MAX_PATH];
   GETCWD(MAX_PATH, curpath);
-  CHDIR(dir_path.string().c_str());
+  CHDIR(dir_path.wstring().c_str());
 #else
   char curpath[MAX_PATH];
   char cbuf[MAX_PATH];
 #define CRCFMTSIZ_LEN 13
 #define PALCRC_LEN 9
     //wcstombs(fname, it->path().leaf().c_str(), MAX_PATH);
-    strncpy(fname, it->path().leaf().c_str(), sizeof(fname));
+    strncpy(fname, it->path().leaf().string().c_str(), sizeof(fname));
     fname[sizeof(fname) - 1] = '\0';
     /* XXX case sensitivity fiasco!
      * files must use _a, _rgb, _all, _allciByRGBA, _ciByRGBA, _ci