OSDN Git Service

fix for gcc-4.5 on cygwin
authorousttrue <ousttrue@gmail.com>
Wed, 7 Mar 2012 14:51:43 +0000 (23:51 +0900)
committerousttrue <ousttrue@gmail.com>
Wed, 7 Mar 2012 14:51:43 +0000 (23:51 +0900)
src/binary.cpp
src/premake4.lua
src/text.h

index 52a8a33..33257bd 100644 (file)
@@ -98,7 +98,7 @@ namespace meshio {
       }
     }
 
       }
     }
 
-#ifdef _WIN32
+#ifdef _MSC_VER
     void readAll(const wchar_t *path, std::vector<char> &buf)
     {
       FILE* fp = _wfopen(path, L"rb");
     void readAll(const wchar_t *path, std::vector<char> &buf)
     {
       FILE* fp = _wfopen(path, L"rb");
@@ -115,7 +115,7 @@ namespace meshio {
       io_=fopen(path, "wb");
     }
 
       io_=fopen(path, "wb");
     }
 
-#if _WIN32
+#if _MSC_VER
     FileWriter::FileWriter(const wchar_t *path)
     {
       io_=_wfopen(path, L"wb");
     FileWriter::FileWriter(const wchar_t *path)
     {
       io_=_wfopen(path, L"wb");
index 5d2691f..e533321 100644 (file)
@@ -1,6 +1,15 @@
 solution "meshio"
 configurations { "Debug", "Release" }
 
 solution "meshio"
 configurations { "Debug", "Release" }
 
+configuration { "windows*" }
+do
+    defines {
+        'WIN32',
+        '_WIN32',
+        '_WINDOWS',
+    }
+end
+
 configuration { "vs*" }
 do
     buildoptions {
 configuration { "vs*" }
 do
     buildoptions {
index 34b6f96..aecbf3b 100644 (file)
@@ -1,7 +1,13 @@
 #ifndef MESH_IO_TEXT_H_INCLUDED
 #define MESH_IO_TEXT_H_INCLUDED
 
 #ifndef MESH_IO_TEXT_H_INCLUDED
 #define MESH_IO_TEXT_H_INCLUDED
 
-//#include "binary.h"
+#ifdef _WINDOWS
+#define NOMINMAX
+#include <windows.h>
+#else
+#include <iconv.h>
+#endif
+
 #include "la.h"
 #include "color.h"
 #include <string>
 #include "la.h"
 #include "color.h"
 #include <string>
 #include <stdlib.h>
 #include <cstring>
 
 #include <stdlib.h>
 #include <cstring>
 
-#ifdef _MSC_VER
-#include <windows.h>
-#else
-#include <iconv.h>
-#endif
-
 namespace meshio {
 
   class cstr
 namespace meshio {
 
   class cstr
@@ -162,7 +162,7 @@ namespace meshio {
     }
 #endif
 
     }
 #endif
 
-#if defined(_MSC_VER)
+#if defined(_WINDOWS)
   inline std::wstring to_WideChar(UINT uCodePage, const std::string &text)
   {
     int size=MultiByteToWideChar(uCodePage, 0, text.c_str(), -1, NULL, 0);
   inline std::wstring to_WideChar(UINT uCodePage, const std::string &text)
   {
     int size=MultiByteToWideChar(uCodePage, 0, text.c_str(), -1, NULL, 0);