mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 02:21:34 +08:00
Fixed cygwin support
This commit is contained in:
parent
79e97fa1ec
commit
f70b2ef3b8
@ -1,5 +1,5 @@
|
|||||||
CXX ?= g++
|
CXX ?= g++
|
||||||
CXXFLAGS = -D_WIN32_WINNT=0x600 -march=native -Wall -Wextra -Wshadow -pedantic -std=c++11 -pthread -Wl,--no-as-needed -I../include
|
CXXFLAGS = -D_WIN32_WINNT=0x600 -march=native -Wall -Wextra -Wshadow -pedantic -std=gnu++0x -pthread -Wl,--no-as-needed -I../include
|
||||||
CXX_RELEASE_FLAGS = -O3
|
CXX_RELEASE_FLAGS = -O3
|
||||||
CXX_DEBUG_FLAGS= -g
|
CXX_DEBUG_FLAGS= -g
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ inline size_t filesize(FILE *f)
|
|||||||
{
|
{
|
||||||
if (f == nullptr)
|
if (f == nullptr)
|
||||||
throw spdlog_ex("Failed getting file size. fd is null");
|
throw spdlog_ex("Failed getting file size. fd is null");
|
||||||
#ifdef _WIN32
|
#if defined ( _WIN32) && !defined(__CYGWIN__)
|
||||||
int fd = _fileno(f);
|
int fd = _fileno(f);
|
||||||
#if _WIN64 //64 bits
|
#if _WIN64 //64 bits
|
||||||
struct _stat64 st;
|
struct _stat64 st;
|
||||||
@ -236,12 +236,12 @@ inline size_t filesize(FILE *f)
|
|||||||
|
|
||||||
#else // unix
|
#else // unix
|
||||||
int fd = fileno(f);
|
int fd = fileno(f);
|
||||||
//64 bits(but not in osx, where fstat64 is deprecated)
|
//64 bits(but not in osx or cygwin, where fstat64 is deprecated)
|
||||||
#if !defined(__FreeBSD__) && !defined(__APPLE__) && (defined(__x86_64__) || defined(__ppc64__))
|
#if !defined(__FreeBSD__) && !defined(__APPLE__) && (defined(__x86_64__) || defined(__ppc64__)) && !defined(__CYGWIN__)
|
||||||
struct stat64 st;
|
struct stat64 st;
|
||||||
if (fstat64(fd, &st) == 0)
|
if (fstat64(fd, &st) == 0)
|
||||||
return static_cast<size_t>(st.st_size);
|
return static_cast<size_t>(st.st_size);
|
||||||
#else // unix 32 bits or osx
|
#else // unix 32 bits or cygwin
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (fstat(fd, &st) == 0)
|
if (fstat(fd, &st) == 0)
|
||||||
return static_cast<size_t>(st.st_size);
|
return static_cast<size_t>(st.st_size);
|
||||||
|
Loading…
Reference in New Issue
Block a user