From: ousttrue Date: Wed, 7 Mar 2012 14:51:43 +0000 (+0900) Subject: fix for gcc-4.5 on cygwin X-Git-Url: http://git.osdn.jp/view?a=commitdiff_plain;ds=sidebyside;h=984c94cd3b0a966c03bf1ff470797f7337ad5fee;p=meshio%2Fmeshio.git fix for gcc-4.5 on cygwin --- diff --git a/src/binary.cpp b/src/binary.cpp index 52a8a33..33257bd 100644 --- a/src/binary.cpp +++ b/src/binary.cpp @@ -98,7 +98,7 @@ namespace meshio { } } -#ifdef _WIN32 +#ifdef _MSC_VER void readAll(const wchar_t *path, std::vector &buf) { FILE* fp = _wfopen(path, L"rb"); @@ -115,7 +115,7 @@ namespace meshio { io_=fopen(path, "wb"); } -#if _WIN32 +#if _MSC_VER FileWriter::FileWriter(const wchar_t *path) { io_=_wfopen(path, L"wb"); diff --git a/src/premake4.lua b/src/premake4.lua index 5d2691f..e533321 100644 --- a/src/premake4.lua +++ b/src/premake4.lua @@ -1,6 +1,15 @@ solution "meshio" configurations { "Debug", "Release" } +configuration { "windows*" } +do + defines { + 'WIN32', + '_WIN32', + '_WINDOWS', + } +end + configuration { "vs*" } do buildoptions { diff --git a/src/text.h b/src/text.h index 34b6f96..aecbf3b 100644 --- a/src/text.h +++ b/src/text.h @@ -1,7 +1,13 @@ #ifndef MESH_IO_TEXT_H_INCLUDED #define MESH_IO_TEXT_H_INCLUDED -//#include "binary.h" +#ifdef _WINDOWS +#define NOMINMAX +#include +#else +#include +#endif + #include "la.h" #include "color.h" #include @@ -10,12 +16,6 @@ #include #include -#ifdef _MSC_VER -#include -#else -#include -#endif - namespace meshio { class cstr @@ -162,7 +162,7 @@ namespace meshio { } #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);